public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection
@ 2020-01-03  3:43 MrChromebox
  2020-01-03  3:43 ` [PATCH v2 1/1] " MrChromebox
  2020-01-03  5:26 ` [edk2-devel] [PATCH v2 0/1] " Wu, Hao A
  0 siblings, 2 replies; 3+ messages in thread
From: MrChromebox @ 2020-01-03  3:43 UTC (permalink / raw)
  To: devel; +Cc: Matt DeVillier

USB keyboard initialization fails if the OUT interrupt
endpoint precedes the IN endpoint. Fix that.

Matt DeVillier (1):
  MdeModulePkg/Usb/EfiKey: Fix endpoint selection

 MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection
  2020-01-03  3:43 [PATCH v2 0/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection MrChromebox
@ 2020-01-03  3:43 ` MrChromebox
  2020-01-03  5:26 ` [edk2-devel] [PATCH v2 0/1] " Wu, Hao A
  1 sibling, 0 replies; 3+ messages in thread
From: MrChromebox @ 2020-01-03  3:43 UTC (permalink / raw)
  To: devel; +Cc: Matt DeVillier

The endpoint selected by the driver needs to not
only be an interrupt type, but have direction IN
as required to set up an asynchronous interrupt transfer.

Currently, the driver assumes that the first INT endpoint
will be of type IN, but that is not true of all devices,
and will silently fail on devices which have the OUT endpoint
before the IN. Adjust the endpoint selection loop to explictly
check for direction IN.

Test: detachable keyboard on Google Pixel Slate now works.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
---
 MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
index 27685995c2..ccb389067a 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
@@ -215,7 +215,7 @@ USBKeyboardDriverBindingStart (
   EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;
 
   //
-  // Traverse endpoints to find interrupt endpoint
+  // Traverse endpoints to find interrupt endpoint IN
   //
   Found = FALSE;
   for (Index = 0; Index < EndpointNumber; Index++) {
@@ -226,7 +226,8 @@ USBKeyboardDriverBindingStart (
              &EndpointDescriptor
              );
 
-    if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {
+    if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) &&
+        ((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != 0)) {
       //
       // We only care interrupt endpoint here
       //
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2 0/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection
  2020-01-03  3:43 [PATCH v2 0/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection MrChromebox
  2020-01-03  3:43 ` [PATCH v2 1/1] " MrChromebox
@ 2020-01-03  5:26 ` Wu, Hao A
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2020-01-03  5:26 UTC (permalink / raw)
  To: devel@edk2.groups.io, matt.devillier@gmail.com

I found that besides the UsbKbDxe & UsbMouseDxe drivers, UsbMouseAbsolutePointerDxe
has a similar issue. Could you help to address it as well?

Really sorry about this, I should have caught this earlier.

Best Regards,
Hao Wu


> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> MrChromebox
> Sent: Friday, January 03, 2020 11:43 AM
> To: devel@edk2.groups.io
> Cc: Matt DeVillier
> Subject: [edk2-devel] [PATCH v2 0/1] MdeModulePkg/Usb/EfiKey: Fix
> endpoint selection
> 
> USB keyboard initialization fails if the OUT interrupt
> endpoint precedes the IN endpoint. Fix that.
> 
> Matt DeVillier (1):
>   MdeModulePkg/Usb/EfiKey: Fix endpoint selection
> 
>  MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --
> 2.20.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-03  5:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-03  3:43 [PATCH v2 0/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection MrChromebox
2020-01-03  3:43 ` [PATCH v2 1/1] " MrChromebox
2020-01-03  5:26 ` [edk2-devel] [PATCH v2 0/1] " Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox