footswitch
footswitch copied to clipboard
allow addressing of multiple independent footswitch devices
Adds a new parameter -d with an integer argument, 0 for first device, 1 for second device,...
Thank you! At least for me this does not seem to work fully though:
I have four 1a86:e026
footswitches ("QinHeng Electronics FootSwitch") connected via a USB hub 1a40:0101
("Terminus Technology Inc. Hub (branded "hama")). I can program the first three devices just fine using:
sudo footswitch -d 1 -k a
sudo footswitch -d 2 -k b
sudo footswitch -d 3 -k c
The fourth device fails though:
$ sudo footswitch -d 4 -k d
Cannot find footswitch with one of the supported VID:PID.
Check that the device is connected and that you have the correct permissions to access it. [init(), footswitch.c:121]
They are all connected and they all send a key when I press them (the fourth device sends a "3" currently because I programmed it independently.
footswitch -r
is incomplete as well, I am not sure if this is the root cause:
$ sudo footswitch -r
[switch 1]: unconfigured
[switch 2]: 3
[switch 3]: unconfigured
@kannes As you can see in my comment the addressing starts at 0 so your four devices are 0 to 3, not 1 to 4.
Oh wow, how did I not read that :D
Thank you, it works flawlessly now:
$ sudo footswitch -d 0 -k 1
$ sudo footswitch -d 1 -k 2
$ sudo footswitch -d 2 -k 3
$ sudo footswitch -d 3 -k 4
Hitting all the devices gives me
$ 4132
Yay!
@rgerganov @taladar I've rebase the branch on actual master to support latest devices and I've also removed the OSX marker to support multiple devices on OSX on this branch: https://github.com/MRigal/footswitch/tree/multiple_devices I'm keen to make a pull request to this PR or to open another one if that helps.
Note that the actual code is a bit buggy, one should initialize the addressing in crescent -d
order, in descent it creates problems... But still useful
@MRigal Since i haven't used this in a while feel free to create an updated pull request and adjust the code as required to fix the issues you mentioned. Next time I use it I will just adjust my usage to whatever you come up with.