2012-02-12 374 views
2

寫入HID設備時出現問題; 下面是用史努比製作的兩個日誌。 第一個是使用設備製造商的原始演示SW製作的,第二個是我的SW日誌。 我的軟件不支持此設備,但可與另一個HID設備一起使用。寫入USB 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」 被執行後爲真。

任何想法?

我在做什麼錯了?

回答

1

原文:

Function: 0009 (BULK_OR_INTERRUPT_TRANSFER) 

你的程序:

Function: 0008 (CONTROL_TRANSFER) 

HID規範允許兩個IIRC,但似乎你的硬件是挑剔,只使用中斷端點時工作。