hidapi-rs: Incorrect function with SET_REPORT Request
Hi,
I am trying to mimic the behavior of an application that sets the time on a screen of a USB connected keyboard, by using a SET_REPORT Request, with the time/date set on the Data Fragment, which looks something like:
28000000000000d707e901060a130a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(the date/time is set in d707e901060a130a)
if I try to send this data to the device, by using (hex_message is the Data Fragment above):
device.send_feature_report(&hex_message).expect("Failed to write data");
I get:
"HidD_SetFeature: (0x00000001) Incorrect function."
I am basically trying to mimic this packet:
Frame 3173804: 100 bytes on wire (800 bits), 100 bytes captured (800 bits) on interface \\.\USBPcap1, id 0
Section number: 1
Interface id: 0 (\\.\USBPcap1)
Interface name: \\.\USBPcap1
Interface description: USBPcap1
Encapsulation type: USB packets with USBPcap header (152)
Arrival Time: Nov 6, 2024 10:29:29.266357000 Romance Standard Time
UTC Arrival Time: Nov 6, 2024 09:29:29.266357000 UTC
Epoch Arrival Time: 1730885369.266357000
[Time shift for this packet: 0.000000000 seconds]
[Time delta from previous captured frame: 0.000044000 seconds]
[Time delta from previous displayed frame: 14.160412000 seconds]
[Time since reference or first frame: -5269774.783267000 seconds]
Frame Number: 3173804
Frame Length: 100 bytes (800 bits)
Capture Length: 100 bytes (800 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb:usbhid]
USB URB
[Source: host]
[Destination: 1.13.0]
USBPcap pseudoheader length: 28
IRP ID: 0xffff818b0dee2760
IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
URB Function: URB_FUNCTION_CLASS_INTERFACE (0x001b)
IRP information: 0x00, Direction: FDO -> PDO
0000 000. = Reserved: 0x00
.... ...0 = Direction: FDO -> PDO (0x0)
URB bus id: 1
Device address: 13
Endpoint: 0x00, Direction: OUT
0... .... = Direction: OUT (0)
.... 0000 = Endpoint number: 0
URB transfer type: URB_CONTROL (0x02)
Packet Data Length: 72
[Response in: 3173806]
Control transfer stage: Setup (0)
[bInterfaceClass: HID (0x03)]
Setup Data
bmRequestType: 0x21
0... .... = Direction: Host-to-device
.01. .... = Type: Class (0x1)
...0 0001 = Recipient: Interface (0x01)
bRequest: SET_REPORT (0x09)
wValue: 0x0300
ReportID: 0
ReportType: Feature (3)
wIndex: 2
wLength: 64
Data Fragment: 28000000000000d707e80b060a1d1d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
I know this is more of a support request, than an issue with the library per se, but what am I doing wrong here?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (10 by maintainers)
thank you for all the support! the issue was indeed in selecting the right interface.
My advice is to analyze the problem step by step. E.g. start by calling hidapi send report with a static byte slice, if that works continue from there. If it does not work we might actually have a problem with my lib ^^