Writing to device works on windows but fails on linux #472
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi#472
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I am trying to control the lighting on my keyboard with hidapi. It works perfectly on windows, but doesn't on linux.
It seems like it's disconnecting as soon as I try to send data to it.
kernel.log
can you share your HID descriptor?
not sure why there are two but here it is
That could be exactly your issue.
Why exactly there is two devices - that's a separate question. Maybe there is two different devices on different USB interfaces (try hidtest - it prints a little more info, including USB interface the device is defined at).
When you're trying to open a device with
--vidpid 258a:0059filter, it would open only a first device that matches it, and the order of devices reported is not specified, and often different on different platforms (i.e. Windows vs Linux).Try https://eleccelerator.com/usbdescreqparser/ to parse your reports.
Looks like your first device is the keyboard, and the seconds one is a special (Sys Control) device. And only the second device has a feature report with id
0A(10)(the one you're trying to use).Make sure to use
--usagePageand--usageto open a device that has a specific collection (0xFF/0x01in your case).You are right, I didn't realize there could be multiple devices with vid and pid of 258a:0059.
Both of these work. Thanks for your help.
sudo ./hidapitester --open-path /dev/hidraw4 -l 65 --send-feature 10,1,1,2,41,17,0,5,5,255,0,0,0,1sudo ./hidapitester --vidpid 258a:0059 --usagePage 1 --usage 6 --open -l 65 --send-feature 10,1,1,2,41,17,0,5,5,255,0,0,0,1