public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: Andrew Fish <afish@apple.com>, edk2-devel <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>, "Zeng, Star" <star.zeng@intel.com>
Subject: Re: Question about connecting USB HID devices.
Date: Fri, 4 May 2018 09:21:55 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE72F3@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <6D9ACD4E-A5B7-4A91-B4E9-0AE6B3763EA6@apple.com>

It is about USB short form device path handling? Check https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c#L1368?

Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andrew Fish
Sent: Friday, May 4, 2018 6:28 AM
To: edk2-devel <edk2-devel@lists.01.org>
Subject: [edk2] Question about connecting USB HID devices.

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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2018-05-04  9:21 UTC|newest]

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

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=0C09AFA07DD0434D9E2A0C6AEB0483103BAE72F3@shsmsx102.ccr.corp.intel.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