Skip to content

Navigation Menu

Sign in
Sign up

hid_read only reads two bytes #716

Unanswered
microhenrio asked this question in Q&A
Discussion options

I've been using hidapi to send from an RPI to a custom board with an STM32 microcontroller without problem. But when trying to receive hid_read only returns two bytes. I've checked the sent data with wireshark and seems correct, all the data is in the data frame.
I've tried with different sizes of frames, using hid_read_timeout, enabling nonblock, etc.. Always reads two byes, normally the first two but sometimes others from the data frame.

The part of the descriptor in the microcontroller used to send to the RPI is like this:

0x85, 0x04, // REPORT_ID (4)
0x09, 0x04, // USAGE (Vendor Usage 1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0xFF,		 // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x0C, // REPORT_COUNT (12)
0x81, 0x04, // INPUT (Data,Var,Abs)

I'm using hidapi 0.13.1 ina and RPI with Raspian 12, kernel 6.6.72-v8+, but I've tried in an Ubuntu with the same behavior.

The packet captured in the wireshark shows all the data (Descriptor ID + 12 bytes):

Frame 37: 40 bytes on wire (320 bits), 40 bytes captured (320 bits) on interface \\.\USBPcap1, id 0
USB URB
 [Source: 1.11.1]
 [Destination: host]
 USBPcap pseudoheader length: 27
 IRP ID: 0xffffdf86b2d4daa0
 IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
 URB Function: URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER (0x0009)
 IRP information: 0x01, Direction: PDO -> FDO
 URB bus id: 1
 Device address: 11
 Endpoint: 0x81, Direction: IN
 URB transfer type: URB_INTERRUPT (0x01)
 Packet Data Length: 13
 [bInterfaceClass: HID (0x03)]
HID Data: 04aabbccddeeff5aa533889911
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

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