public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ali Shirvani" <aj.shirvani@gmail.com>
To: devel@edk2.groups.io
Subject: Correct method to send data to the USB device
Date: Mon, 4 Jan 2021 19:16:07 +0330	[thread overview]
Message-ID: <CAFQ97XGq1rjQfH+XU0CCE=Qv7sWeF-ODdfQLOgXfcV3xx4WFSg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2935 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3855 bytes --]

                 reply	other threads:[~2021-01-04 15:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFQ97XGq1rjQfH+XU0CCE=Qv7sWeF-ODdfQLOgXfcV3xx4WFSg@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox