different result on hid_get_input_report and hid_read, or how to read a specified reportid? #801

Closed
opened 2026-05-05 13:03:34 -05:00 by lexr1 · 2 comments
lexr1 commented 2026-05-05 13:03:34 -05:00 (Migrated from github.com)

I have a Logitech mouse which can be configured by sending data to 0xff00/0x2.
Report descriptor in Windows.

0x06, 0x00, 0xFF,  // Usage Page (Vendor Defined 0xFF00)
0x09, 0x02,        // Usage (0x02)
0xA1, 0x01,        // Collection (Application)
0x85, 0x11,        //   Report ID (17)
0x09, 0x02,        //   Usage (0x02)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x13,        //   Report Count (19)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x02,        //   Usage (0x02)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x13,        //   Report Count (19)
0x91, 0x00,        //   Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

// 36 bytes

Below code set LED light to red(so I know it's working). read-input returns correct data but read-input-report always returns same result, even in Linux.

C:\>hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input
Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2
Device opened
Writing output report of 20-bytes...wrote 20 bytes:
 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00
Reading up to 20-byte input report, 250 msec timeout...read 20 bytes:
 11 FF 02 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Closing device

C:\>hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input-report 17
Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2
Device opened
Writing output report of 20-bytes...wrote 20 bytes:
 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00
Reading 20-byte input report using hid_get_input_report, report_id 17...read 20 bytes:
 11 FF 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Closing device

In Windows, each usagepage/usage is assigned as a separated device and I can use hid_read, but in Linux several usagepage/usage are all under same /dev/hidraw1, read-input reads 0 bytes and read-input-report returns same wrong data as in Windows.

# ./hidapitester  --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open --get-report-descriptor
Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2
Device opened
Report Descriptor:
 05 01 09 06 A1 01 85 01 05 07 19 E0 29 E7 15 00 25 01 75 01 95 08 81 02 81 03 95 06 75 08 15 00
 26 A4 00 19 00 2A A4 00 81 00 C0 05 0C 09 01 A1 01 85 03 75 10 95 02 15 01 26 8C 02 19 01 2A 8C
 02 81 00 C0 05 01 09 80 A1 01 85 04 75 02 95 01 15 01 25 03 09 82 09 81 09 83 81 60 75 06 81 03
 C0 06 00 FF 09 01 A1 01 85 10 75 08 95 06 15 00 26 FF 00 09 01 81 00 09 01 91 00 C0 06 00 FF 09
 02 A1 01 85 11 75 08 95 13 15 00 26 FF 00 09 02 81 00 09 02 91 00 C0

# ./hidapitester  --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input
Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2
Device opened
Writing output report of 20-bytes...wrote 20 bytes:
 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00
Reading up to 20-byte input report, 250 msec timeout...read 0 bytes:
Closing device

# ./hidapitester  --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input-report 0x11
Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2
Device opened
Writing output report of 20-bytes...wrote 20 bytes:
 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00
Reading 20-byte input report using hid_get_input_report, report_id 17...read 20 bytes:
 11 FF 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

So how to read data from report id 0x11 in Linux? Thanks.

I have a Logitech mouse which can be configured by sending data to 0xff00/0x2. Report descriptor in Windows. ``` 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) 0x09, 0x02, // Usage (0x02) 0xA1, 0x01, // Collection (Application) 0x85, 0x11, // Report ID (17) 0x09, 0x02, // Usage (0x02) 0x15, 0x00, // Logical Minimum (0) 0x26, 0xFF, 0x00, // Logical Maximum (255) 0x75, 0x08, // Report Size (8) 0x95, 0x13, // Report Count (19) 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 0x09, 0x02, // Usage (0x02) 0x15, 0x00, // Logical Minimum (0) 0x26, 0xFF, 0x00, // Logical Maximum (255) 0x75, 0x08, // Report Size (8) 0x95, 0x13, // Report Count (19) 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 0xC0, // End Collection // 36 bytes ``` Below code set LED light to red(so I know it's working). read-input returns correct data but read-input-report always returns same result, even in Linux. ``` C:\>hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2 Device opened Writing output report of 20-bytes...wrote 20 bytes: 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 Reading up to 20-byte input report, 250 msec timeout...read 20 bytes: 11 FF 02 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Closing device C:\>hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input-report 17 Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2 Device opened Writing output report of 20-bytes...wrote 20 bytes: 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 Reading 20-byte input report using hid_get_input_report, report_id 17...read 20 bytes: 11 FF 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Closing device ``` In Windows, each usagepage/usage is assigned as a separated device and I can use hid_read, but in Linux several usagepage/usage are all under same /dev/hidraw1, read-input reads 0 bytes and read-input-report returns same wrong data as in Windows. ``` # ./hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open --get-report-descriptor Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2 Device opened Report Descriptor: 05 01 09 06 A1 01 85 01 05 07 19 E0 29 E7 15 00 25 01 75 01 95 08 81 02 81 03 95 06 75 08 15 00 26 A4 00 19 00 2A A4 00 81 00 C0 05 0C 09 01 A1 01 85 03 75 10 95 02 15 01 26 8C 02 19 01 2A 8C 02 81 00 C0 05 01 09 80 A1 01 85 04 75 02 95 01 15 01 25 03 09 82 09 81 09 83 81 60 75 06 81 03 C0 06 00 FF 09 01 A1 01 85 10 75 08 95 06 15 00 26 FF 00 09 01 81 00 09 01 91 00 C0 06 00 FF 09 02 A1 01 85 11 75 08 95 13 15 00 26 FF 00 09 02 81 00 09 02 91 00 C0 # ./hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2 Device opened Writing output report of 20-bytes...wrote 20 bytes: 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 Reading up to 20-byte input report, 250 msec timeout...read 0 bytes: Closing device # ./hidapitester --vidpid 046d/c08b --usagePage 0xFF00 --usage 2 --open -l 20 --send-output 0x11,0xff,2,0x3f,0,1,0xff --read-input-report 0x11 Opening device, vid/pid:0x046D/0xC08B, usagePage/usage: FF00/2 Device opened Writing output report of 20-bytes...wrote 20 bytes: 11 FF 02 3F 00 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 Reading 20-byte input report using hid_get_input_report, report_id 17...read 20 bytes: 11 FF 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ``` So how to read data from report id 0x11 in Linux? Thanks.
Youw commented 2026-05-09 04:50:36 -05:00 (Migrated from github.com)

When hid_get_input_report is issued, it sends a reques to the device over a different channel (control pipe), to which the device has to respond explicitly in the FW implementation.
That path is different in the FW implementation than sending interrupt input reports (available with hid_read).

Most likely the device FW itself if faulty and you're doing it right, but the device doesn't respond with the correct data.

Also, based on my experience with Logitech FW, it is highly likely that they've implented the same logical action (LED set/get status/color) using different reports for read and write (i.e. you send report 0x11 but to get the LED status you might need to get a different report).

When hid_get_input_report is issued, it sends a reques to the device over a different channel (control pipe), to which the device has to respond explicitly in the FW implementation. That path is different in the FW implementation than sending interrupt input reports (available with hid_read). Most likely the device FW itself if faulty and you're doing it right, but the device doesn't respond with the correct data. Also, based on my experience with Logitech FW, it is highly likely that they've implented the same logical action (LED set/get status/color) using different reports for read and write (i.e. you send report 0x11 but to get the LED status you might need to get a different report).
Youw commented 2026-05-19 16:20:01 -05:00 (Migrated from github.com)

I'm pretty sure this is device-specific and nothing that could be fixed on HIDAPI side, closing;
If there really is an issue in HIDAPI code - do reopen.

I'm pretty sure this is device-specific and nothing that could be fixed on HIDAPI side, closing; If there really is an issue in HIDAPI code - do reopen.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi#801
No description provided.