Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Does windows hid_write prepend a 0x00 report id? #750

Unanswered
MicRaj asked this question in Q&A
Discussion options

I am trying to send HID reports with different report ids - my report id is the first byte in the buffer. On my device the report always comes through as report id 0x00. I am not getting this issue on linux.

int res;
uint8_t buffer[65] = {0}; 
buffer[0] = REPORT_ID_CUSTOM; // Report ID (must be 1st byte)
buffer[1] = CMD_ADD; // Command
buffer[2] = data.modifier; // First data byte
memcpy(&buffer[3], data.keycode, 6); // Remaining 6 data bytes
res = hid_write(handle, buffer, sizeof(buffer));```
You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

You may want to post more info about your device's HID report descriptors, hidapi version used, etc.

You must be logged in to vote
1 reply
Comment options

Yes ofcourse:
HID api version v0.15.0
My descriptor using usbview is as follows:

[Port4] : USB Composite Device
Is Port User Connectable: yes
Is Port Debug Capable: no
Companion Port Number: 0
Companion Hub Symbolic Link Name: 
Protocols Supported:
 USB 1.1: yes
 USB 2.0: yes
 USB 3.0: no
Device Power State: PowerDeviceD0
 ---===>Device Information<===---
English product name: "Macropad"
ConnectionStatus: 
Current Config Value: 0x01 -> Device Bus Speed: Full (is not SuperSpeed or higher capable)
Device Address: 0x08
Open Pipes: 3
 ===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0x00 -> This is an Interface Class Defined Device
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0xCAFE = Vendor ID not listed with USB.org
idProduct: 0x400C
bcdDevice: 0x0100
iManufacturer: 0x01
 English (United States) "MicRaj"
iProduct: 0x02
 English (United States) "Macropad"
iSerialNumber: 0x03
 English (United States) "503359276ACE359F"
bNumConfigurations: 0x01
 ---===>Open Pipes<===---
 ===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x05
 ===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x0A
 ===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82 -> Direction: IN - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x0A
 ---===>Full Configuration Descriptor<===---
 ===>Configuration Descriptor<===
bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x0042 -> Validated
bNumInterfaces: 0x02
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0xA0 -> Bus Powered
 -> Remote Wakeup
MaxPower: 0x32 = 100 mA
 ===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x03 -> HID Interface Class
bInterfaceSubClass: 0x01
bInterfaceProtocol: 0x01
iInterface: 0x00
 ===>HID Descriptor<===
bLength: 0x09
bDescriptorType: 0x21
bcdHID: 0x0111
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22 (Report Descriptor)
wDescriptorLength: 0x0043
 ===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x05
 ===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x03 -> HID Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00
 ===>HID Descriptor<===
bLength: 0x09
bDescriptorType: 0x21
bcdHID: 0x0111
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22 (Report Descriptor)
wDescriptorLength: 0x0024
 ===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x0A
 ===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82 -> Direction: IN - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x0A

I have tried different buffersizes eg uint8_t buffer[64] = {0}; , uint8_t buffer[63] = {0}; but all of them seem to have a prepended 0x00 report id

Comment options

Please take a look at this thread and see if it helps you.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /