Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy can't i get report from hid usb device by GetInputReport
    primarykey
    data
    text
    <p>In my delphi application, i use TJvHidDevice for writing and reading report from a usb device.</p> <p>The <strong>device info</strong> bellows</p> <pre><code>Bus Type: USB Device Type: Human Interface Device Power Drawn: 100 milliamps @ 5.0 volts Endpoint 0: Type=CTL Class=03 SubClass=00 Protocol=00 MaxPacket=8 Endpoint 1 OUT: Type=INT Class=03 SubClass=00 Protocol=00 MaxPacket=40 Endpoint 2 IN: Type=INT Class=03 SubClass=00 Protocol=00 MaxPacket=40 Hardware ID: USB\Vid_0483&amp;Pid_5750&amp;Rev_0200 Data Read: 572 bytes Data Written: 384 bytes Utilization: 100% </code></pre> <p>It has three endpoints,and it will out put report with endpoint 2 when i send report to it. My codes are</p> <p><strong>Report structure</strong></p> <pre><code>TReport = packed record ReportID: byte; Data: array[0..64] of byte; end; </code></pre> <p><strong>Check out Device</strong></p> <pre><code>procedure TfrmMain.HidDevsDeviceChange(Sender: TObject); begin if HidDevs.CheckOutByID(FHidDev, USB_VID, USB_PID) then begin FHidDev.NumInputBuffers := 65; FHidDev.NumOverlappedBuffers := 65; FUsbDevice.Device := FHidDev; FHidDev.OnData:=OnRead; end; end; </code></pre> <p><strong>OnRead Enent</strong></p> <pre><code>procedure TfrmMain.OnRead(HidDev: TJvHidDevice; ReportID: Byte; const Data: Pointer; Size: Word); var I: Integer; Str: string; begin Str := Format('RD %.2x ', [ReportID]); for I := 0 to Size - 1 do Str := Str + Format('%.2x ', [Cardinal(PChar(Data)[I])]); AddLog('Received: '); SetLogColor(clPurple); AddLog(Str, False); end; </code></pre> <p>I can write report by </p> <pre><code>if not FDevice.SetOutputReport(FBuffer, FDevice.Caps.OutputReportByteLength) then </code></pre> <p>but , after <strong>SetOutputReport</strong> nothing happens.If i used <strong>GetInputReport</strong> instead of <strong>OnRead</strong>, there will be an error : 31 , if use <strong>readFile</strong>,the application will hang up. why,and what should i do?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload