* Question about connecting USB HID devices.
@ 2018-05-03 22:27 Andrew Fish
2018-05-04 9:21 ` Zeng, Star
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Fish @ 2018-05-03 22:27 UTC (permalink / raw)
To: edk2-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Question about connecting USB HID devices.
2018-05-03 22:27 Question about connecting USB HID devices Andrew Fish
@ 2018-05-04 9:21 ` Zeng, Star
0 siblings, 0 replies; 2+ messages in thread
From: Zeng, Star @ 2018-05-04 9:21 UTC (permalink / raw)
To: Andrew Fish, edk2-devel; +Cc: Ni, Ruiyu, Zeng, Star
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-04 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-03 22:27 Question about connecting USB HID devices Andrew Fish
2018-05-04 9:21 ` Zeng, Star
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox