Re: [edk2] Question about connecting USB HID devices.

2018-05-04 Thread 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-boun...@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, );
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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Question about connecting USB HID devices.

2018-05-03 Thread Andrew Fish
I was looking at this code: 
https://github.com/tianocore/edk2/blob/master/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c#L405
 


Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, );
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