写入HID设备时遇到问题; 下面是使用史努比制作的两个日志。 第一个是使用设备制造商的原始演示SW制作的,第二个是我的SW日志。 我的软件不适用于此设备,但适用于其他HID设备。
原始软件:
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
我的软件:
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
用于发送数据的代码如下所示:
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是正确的,执行后变量“b”为True。
有什么想法吗?
我做错了什么?
答案 0 :(得分:1)
原文:
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
您的计划:
Function: 0008 (CONTROL_TRANSFER)
HID规范允许两个IIRC,但看起来你的硬件很挑剔,只有在使用中断端点时才有效。