public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: edk2-devel <edk2-devel@lists.01.org>
Subject: Question about connecting USB HID devices.
Date: Thu, 03 May 2018 15:27:44 -0700	[thread overview]
Message-ID: <6D9ACD4E-A5B7-4A91-B4E9-0AE6B3763EA6@apple.com> (raw)

I was looking at this code: https://github.com/tianocore/edk2/blob/master/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c#L405 <https://github.com/tianocore/edk2/blob/master/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c#L405>

        Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
        if (!EFI_ERROR (Status)) {
          if ((PCI_CLASS_SERIAL == Class[2]) &&
              (PCI_CLASS_SERIAL_USB == Class[1])) {
            if (HostControllerPI == Class[0] || HostControllerPI == 0xFF) {
              Status = gBS->ConnectController (
                              HandleArray[Index],
                              NULL,
                              RemainingDevicePath,
                              FALSE
                              );
              if (!EFI_ERROR(Status)) {
                AtLeastOneConnected = TRUE;
              }
            }
          }
        }


I'm missing something? This code is doing a non-recursive ConnectController() on the PCI Handle for the USB HC. I would expect that this call would cause the creation of all the USB IO handles, or at least the ones that match RemainingDevicePath. In this code RemainingDevicePath is a USB Class device path node for HID devices. The main thing I don't understand is why the keyboard got connected?  I would think after this loop the BDS would need to loop on the created USB IO Protocols, call UsbGetInterfaceDescriptor() and do a recursive connect controller on the matching InterfaceClass. It looks like the USB bus driver may be connecting the console devices? I'm unclear why that work was not done in the BDS? 

Thanks,

Andrew Fish


             reply	other threads:[~2018-05-03 22:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 22:27 Andrew Fish [this message]
2018-05-04  9:21 ` Question about connecting USB HID devices Zeng, Star

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=6D9ACD4E-A5B7-4A91-B4E9-0AE6B3763EA6@apple.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