Einzelnen Beitrag anzeigen

wschrabi

Registriert seit: 16. Jan 2005
448 Beiträge
 
#24

AW: Komponente Android Daten USB senden/empfangen

  Alt 23. Mär 2016, 10:40
I have tried it this way.
Code:
function TJvHidDevice.GetFeatureReport: string;
const
  STD_USB_REQUEST_RECIPIENT = $01; // Interface
  STD_USB_REQUEST_GET_REPORT = $01; //HID GET_REPORT
  STD_USB_REQUEST_SET_REPORT = $09; //HID SET_REPORT
  LIBUSB_FEATURE_REPORT = $0301; //Feature report ($0300), ID = 1 ($01)
  LIBUSB_FEATURE_REPORT_LENGTH = $FF;

  (* my try
  //STD_USB_REQUEST_GET_DESCRIPTOR = $06;
  STD_USB_REQUEST_GET_REPORT = $01;
  STD_USB_REQUEST_TYPE_GET_REPORT = $A1;  
  STD_USB_REQUEST_VALUE_GET_REPORT = $100;  
  LIBUSB_DT_STRING = $03;
  *)
 
var
  i,rdo:integer;
  buffer : TJavaArray<Byte>;
  S : String;
begin

  if Openfile then
  begin

    buffer := TJavaArray<Byte>.Create(255);

    rdo := FUsbDeviceConnection.controlTransfer(
           (TJUsbConstantsUSB_DIR_IN OR TJUsbConstantsUSB_TYPE_CLASS OR STD_USB_REQUEST_RECIPIENT),
           STD_USB_REQUEST_GET_REPORT,
           LIBUSB_FEATURE_REPORT,
           0,
           buffer,
           LIBUSB_FEATURE_REPORT_LENGTH,
           2000);
    (* my try
    rdo := FUsbDeviceConnection.controlTransfer(
           STD_USB_REQUEST_TYPE_GET_REPORT,
           STD_USB_REQUEST_GET_REPORT,
           STD_USB_REQUEST_VALUE_GET_REPORT,  
           0,
           buffer,
           $0B,
           0);
    *)
           

    if rdo<0 then
    begin
      buffer.Free;
      result:='';
      exit;
    end;

    if rdo>255 then rdo:=255;

    S:='';
    for i:=0 to rdo do
    begin
      S:=S+Char(buffer.Items[i]);
    end;
    result:=S;
    buffer.Free;
  end
  else result:='';
end;
Accoring to my sniffer snappshot of my working windows prg.
(See attached screeshoot)
Miniaturansicht angehängter Grafiken
getreport.jpg  

Geändert von wschrabi (23. Mär 2016 um 10:49 Uhr) Grund: just got the try from Don - similar to my try
  Mit Zitat antworten Zitat