user1205538
user1205538

Reputation: 21

Writing to USB HID device

I have a problem writing to HID device; Below are two logs made with Snoopy. The first one is made using original demo SW of device manufacturer and the second is my SW log. My software doesn't work with this device but works with another HID device.

Original software:

9   ??? down    n/a 27.868  BULK_OR_INTERRUPT_TRANSFER  06 16 19 17 00 00 00 00 
URB Header (length: 72)
SequenceNumber: 9
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
TransferFlags: 0x00000002

TransferBuffer: 0x00000040 (64) length
0000: 06 16 19 17 00 00 00 00 00 00 00 00 00 00 00 00 
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
9   ??? up  n/a 27.874  BULK_OR_INTERRUPT_TRANSFER  -   0x00000000
URB Header (length: 72)
SequenceNumber: 9
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
TransferFlags: 0x00000002

No TransferBuffer

My software:

9   out down    n/a 22.224  CLASS_INTERFACE 06 16 19 17 00 00 00 00 
URB Header (length: 80)
SequenceNumber: 9
Function: 001b (CLASS_INTERFACE)
PipeHandle: 00000000

SetupPacket:
0000: 22 09 00 02 00 00 00 00 
bmRequestType: 22
  DIR: Host-To-Device
  TYPE: Class
  RECIPIENT: Endpoint
bRequest: 09  


TransferBuffer: 0x00000040 (64) length
0000: 06 16 19 17 00 00 00 00 00 00 00 00 00 00 00 00 
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
9   out up  n/a 22.227  CONTROL_TRANSFER    -   0x00000000
URB Header (length: 80)
SequenceNumber: 9
Function: 0008 (CONTROL_TRANSFER)
PipeHandle: 877af60c

SetupPacket:
0000: 21 09 00 02 00 00 40 00 
bmRequestType: 21
  DIR: Host-To-Device
  TYPE: Class
  RECIPIENT: Interface
bRequest: 09  


No TransferBuffer

Code used to send the data looks like this:

hiddata.ReportID := 0;
hiddata.Data[0] := 6;
hiddata.Data[1] := $16;
hiddata.Data[2] := $19;
hiddata.Data[3] := $17;
for I := 4 to 64 do
  hiddata.Data[I] := $0;
b := HidD_SetOutputReport(HidHandle, @hiddata, 65);

HidHandle is correct and variable "b" is True after execution.

Any ideas?

What I'm doing wrong?

Upvotes: 2

Views: 3269

Answers (1)

Turbo J
Turbo J

Reputation: 7691

Original:

Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)

Your program:

Function: 0008 (CONTROL_TRANSFER)

HID spec allows both IIRC, but it seems your Hardware is picky and only works when using the interrupt endpoint.

Upvotes: 1

Related Questions