workinghard / jslisten

listen to gamepad inputs and trigger a command
GNU General Public License v3.0
31 stars 18 forks source link

Multiple button press combo not working #20

Open emdeex opened 4 years ago

emdeex commented 4 years ago

Hi, Merry Christmas !

Thanks for all your help with this!

Tonight, I'm trying to get the multiple button press logic working.

It doesn't seem to be detecting the multiple button press. I'm trying to debug it...

I'm trying # sudo /bin/jslisten --loglevel debug

/var/log/syslog says:

Dec 25 20:53:51 raspberrypi jslisten[2161]: Using device path: /js Dec 25 20:53:51 raspberrypi jslisten[2161]: Using button mode: plain Dec 25 20:53:51 raspberrypi jslisten[2161]: Listen to joystick inputs ... Dec 25 20:53:51 raspberrypi jslisten[2161]: taking user config Dec 25 20:53:51 raspberrypi jslisten[2161]: reading config /etc/jslisten.cfg Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: "/home/pi/combo1.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 0 Dec 25 20:53:51 raspberrypi jslisten[2161]: button2: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play1.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 0 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play2.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play3.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 2 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play4.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 3 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play5.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 4 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play6.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 5 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play7.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 6 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play8.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 7 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play9.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 8 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play10.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 9 Dec 25 20:53:51 raspberrypi jslisten[2161]: Filename: /home/pi/play11.sh Dec 25 20:53:51 raspberrypi jslisten[2161]: button1: 10 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 0: Dec 25 20:53:51 raspberrypi jslisten[2161]: 2 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 1: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 2: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 3: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 4: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 5: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 6: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 7: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 8: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 9: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 10: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Active assigned buttons in section 11: Dec 25 20:53:51 raspberrypi jslisten[2161]: 1 Dec 25 20:53:51 raspberrypi jslisten[2161]: Found Device: /dev/input/js0 Dec 25 20:53:51 raspberrypi jslisten[2161]: Driver version is 2.1.0. Dec 25 20:53:51 raspberrypi jslisten[2161]: Joystick (Logitech Logitech Attack 3) has 3 axes ( Dec 25 20:53:51 raspberrypi jslisten[2161]: X Dec 25 20:53:51 raspberrypi jslisten[2161]: , Y Dec 25 20:53:51 raspberrypi jslisten[2161]: , Z Dec 25 20:53:51 raspberrypi jslisten[2161]: ) Dec 25 20:53:51 raspberrypi jslisten[2161]: and 11 buttons ( Dec 25 20:53:51 raspberrypi jslisten[2161]: Trigger Dec 25 20:53:51 raspberrypi jslisten[2161]: , ThumbBtn Dec 25 20:53:51 raspberrypi jslisten[2161]: , ThumbBtn2 Dec 25 20:53:51 raspberrypi jslisten[2161]: , TopBtn Dec 25 20:53:51 raspberrypi jslisten[2161]: , TopBtn2 Dec 25 20:53:51 raspberrypi jslisten[2161]: , PinkieBtn Dec 25 20:53:51 raspberrypi jslisten[2161]: , BaseBtn Dec 25 20:53:51 raspberrypi jslisten[2161]: , BaseBtn2 Dec 25 20:53:51 raspberrypi jslisten[2161]: , BaseBtn3 Dec 25 20:53:51 raspberrypi jslisten[2161]: , BaseBtn4 Dec 25 20:53:51 raspberrypi jslisten[2161]: , BaseBtn5 Dec 25 20:53:51 raspberrypi jslisten[2161]: ).

But pressing button 0 and 1 only triggers each button separately... not the combo1.sh

Any thoughts?

workinghard commented 4 years ago

Looks to me like you've defined same buttons for different actions. The definition of single button 0 and button 1 gets a precedence over the combination of 0+1. Remove the single definitions and the combination should trigger.

emdeex commented 4 years ago

Ah...I see...

Is there a way I can have the single button presses work as well as the combos? That would be awesome ...is there an area of code I could modify and recompile?

workinghard commented 4 years ago

Right now it’s not possible. First a grace time need to be implemented where you have to analyze what’s happening in this time frame. It kind of goes along with #16 feature request.

emdeex commented 4 years ago

As a hack...would it be possible to run two processes of jslisten with two separate configs?

On Thu, 26 Dec 2019 at 10:52 am, Nikolai notifications@github.com wrote:

Right now it’s not possible. First a grace time need to be implemented where you have to analyze what’s happening in this time frame. It kind of goes along with #16 https://github.com/workinghard/jslisten/issues/16 feature request.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/workinghard/jslisten/issues/20?email_source=notifications&email_token=AAAMO7ZOGEZGGFP4BFOBX5TQ2PW4ZA5CNFSM4J7D43C2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHUVCHY#issuecomment-568938783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMO73XW333UBYV4HVCQUTQ2PW4ZANCNFSM4J7D43CQ .

workinghard commented 4 years ago

@emdeex Not really. Only if want to trigger both at the same time. Play1, Play2 will be triggered and combination as well.

emdeex commented 4 years ago

Thanks that makes sense.

I’ll have a look at the code and see if I can work it out...

On Thu, 26 Dec 2019 at 3:59 pm, Nikolai notifications@github.com wrote:

@emdeex https://github.com/emdeex Not really. Only if want to trigger both at the same time. Play1, Play2 will be triggered and combination as well.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/workinghard/jslisten/issues/20?email_source=notifications&email_token=AAAMO77DSULLXLWUBPTGC63Q2Q24LA5CNFSM4J7D43C2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHU4XFA#issuecomment-568970132, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMO76SXWSLSICSEIZXOATQ2Q24LANCNFSM4J7D43CQ .

cgmckeever commented 4 years ago

This may be a similar question (or the same and Im just a bit slow), could two separate instances be run each listening to a different input? I should try this out ..

workinghard commented 4 years ago

could two separate instances be run each listening to a different input? I should try this out .. Should work. No resources are being locked by this program.