Closed SergioRibera closed 2 years ago
What do you mean with "does not work"? I am also not sure what your crkbd_gui command does, when listing, I am interested in what the numbers are exactly.
I suspect the device just has multiple interfaces or usage pages, and hidapi lists them separately. Just one of them will be the "device" you actually want to open.
Oh right, I forgot to show you that part of the code, it lists all the devices, when I realized that there wasn't one, so I changed the find to a filter
The path seems to be different for all the four devices, the last .X is different. That means there are different interfaces on the device. You have to open the correct one.
I suppose you application will need some code for matching devices, and opening the correct one (with the correct interface id).
libusb backend does not expose all the interfaces, which is actually a limitation of the implementation. hidraw backend gives you full access.
I suggest you make a filter, in which you match for pre-programmed vid + pid + interface number.
Or just create special handling for just this vid + pid. Idk if it is usual for the device kind you handle to have multiple interfaces.
Ooooooh, using the interface number, it works perfect, now I will see if it works correctly on other platforms, thank you very much.
This causes that when selecting the first or the last one to open, it does not work, so how can I know which one is the correct one or what am I doing wrong?
I leave you the udev rules that I wrote, maybe they have something to do, even when listing with libusb, only one device is shown
HIDAPI/hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="4653", ATTRS{idProduct}=="4d4d", TAG+="uaccess" SUBSYSTEM=="hidraw", ATTRS{idVendor}=="4653", ATTRS{idProduct}=="4d4d", TAG+="uaccess", RUN{builtin}+="uaccess"