Closed jose1711 closed 3 years ago
I started working on it. Please run
sudo python3
import evdev
for path in evdev.list_devices():
device = evdev.InputDevice(path)
print(device.name, device.uniq)
to see if uniq has the correct uniqueness for this. I don't have two devices of the same model at home
device.uniq
seems to be empty string for all detected devices. hmm..
>>> import evdev
>>> for path in evdev.list_devices():
... device = evdev.InputDevice(path)
... print(device.name, device.uniq)
...
Microsoft X-Box 360 pad
SPEEDLINK TORID
Microsoft X-Box 360 pad
..
HDA NVidia HDMI/DP,pcm=3
SPEEDLINK TORID
..
PC Speaker
Eee PC WMI hotkeys
Power Button
Power Button
oh. Then maybe we have more luck with splitting device.phys, which can be empty as well though.
sudo python3
import evdev
for path in evdev.list_devices():
device = evdev.InputDevice(path)
print(device.name, device.phys)
Yeah, that looks promising:
>>> import evdev
>>> for path in evdev.list_devices():
... device = evdev.InputDevice(path)
... if 'SPEEDLINK' not in device.name: continue
... print(device.name, device.phys)
...
SPEEDLINK TORID usb-0000:0c:00.3-3.1/input0
SPEEDLINK TORID usb-0000:0c:00.3-4/input0
>>>
Please try the "getdevices-duplicate-2" branch.
It also has unittests already
Thank you for your pro-support, tested in Broforce and it works nicely.
nice. I'll continue working a bit on improving the architecture in that regard though and will let you know once it is in main.
because currently getdevices contains a global variable with a bunch of helper function to access it. It should be a proper class instead.
No I think there is an issue
Will it store the preset for the second device in a different location? i.e. do you have two different sets of presets for each one of them?
I get two separate files:
find .config/key-mapper/presets/SPEEDLINK\ TORID* -type f -ls
90048293 4 -rw------- 1 jose users 278 apr 13 23:32 .config/key-mapper/presets/SPEEDLINK\ TORID/move\ or\ die.json
50860257 4 -rw------- 1 jose users 191 apr 13 23:33 .config/key-mapper/presets/SPEEDLINK\ TORID\ 2/move_or_die.json
Yeah, I'll be refactoring quite some stuff in that regard because the data structure and how things are being indexed is getting ridiculous. Will take a little bit more time
I didn't fix the issue yet, but made a lot of changes that I would love to get tested by somebody else as well.
Please install the latest changes on the getdevices-duplicate-2 branch and check if it still works like it used to
it might actually already show two entries in the dropdown though, but that aspect is not tested at all. all old unittests are passing.
I didn't fix the issue yet
Sorry, which issue? I mean.. I was already getting two separate files per each device which I think is the way it's supposed to work. Or am I missing something?
If you got two keyboards of the same type and configure two presets on day 1, and connect only one of them on day 2, the gui will only list one of the presets
Instead what I want to do is show all of them. Since they fit the device
i.e. all of the available presets for "keyboard foo" should also be available for "keyboard foo 2". It should put the preset .json files for both devices into a single directory.
autoloading should probably make a difference between "keyboard foo" and "keyboard foo 2", so that the second device can get a different preset applied automatically.
Thank you, that makes perfect sense. Will try to test in the following days.
I'm finished with my work on the "getdevices-duplicate-2" branch, I expect it to correctly handle devices of the same model now.
It's not yet pushed to main
Sorry, did not have a chance to test it yet and I am traveling during weekend. I suggest you push to main and if there are any issues I will reopen.
I have two wireless SpeedLink gamepads - each has its own USB receiver. In the output of
evtest
I can see both of them.key-mapper
is only showing singleSPEEDLINK TORID
entry receiving events from either controllers. This prevents from configuring them separately.