[edk2-devel] Correct method to send data to the USB device

Ali Shirvani aj.shirvani at gmail.com
Mon Jan 4 15:46:07 UTC 2021


Hi all,

I want to send data to an USB device, I tried the following method, but I
always got the TIME_OUT error message.

Status = UsbIo->UsbSyncInterruptTransfer (UsbIo, 0x01, (VOID *)DataBuffer,
                                         &DataLength, 100, &TransferStatus);

I've read the source code for mouse and keyboard drivers, but both of them
receive data from the device and I want to send data to the device.
Would you please guide me how I can send/ data from a USB device?

Following is the output of `lsusb` related to the qemu virtual U2F device
that I want to communicate with.

Bus 002 Device 002: ID 46f4:0005
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x46f4
  idProduct          0x0005
  bcdDevice            0.00
  iManufacturer           1 QEMU
  iProduct                2 U2F USB key
  iSerial                 3 0-0000:00:1d.7-1
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 U2F key config
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               30mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      34
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0000
  (Bus Powered)

Regards,
Ali


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69593): https://edk2.groups.io/g/devel/message/69593
Mute This Topic: https://groups.io/mt/79426534/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20210104/2ddef828/attachment.htm>


More information about the edk2-devel-archive mailing list