<div>From e7648a8c3efae0540586ad497a5366ffd0c87fb7 Mon Sep 17 00:00:00 2001</div>
<div>From: Matt DeVillier <matt.devillier@gmail.com></div>
<div>Date: Thu, 12 Dec 2019 12:46:47 -0600</div>
<div>Subject: [PATCH 1/2] MdeModulePkg/Usb/EfiKey: Fix endpoint selection</div>
<div> </div>
<div>The endpoint selected by the driver needs to not</div>
<div>only be an interrupt type, but have direction IN</div>
<div>as required to set up an asynchronous interrupt transfer.</div>
<div> </div>
<div>Currently, the driver assumes that the first INT endpoint</div>
<div>will be of type IN, but that is not true of all devices,</div>
<div>and will silently fail on devices which have the OUT endpoint</div>
<div>before the IN. Adjust the endpoint selection loop to explictly</div>
<div>check for direction IN.</div>
<div> </div>
<div>Test: detachable keyboard on Google Pixel Slate now works.</div>
<div> </div>
<div>Signed-off-by: Matt DeVillier <matt.devillier@gmail.com></div>
<div>---</div>
<div> MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c | 5 +++--</div>
<div> 1 file changed, 3 insertions(+), 2 deletions(-)</div>
<div> </div>
<div>diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c</div>
<div>index 40f8399942..f0544269de 100644</div>
<div>--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c</div>
<div>+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c</div>
<div>@@ -221,7 +221,7 @@ USBKeyboardDriverBindingStart (</div>
<div>   EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;</div>
<div> </div>
<div>   //</div>
<div>-  // Traverse endpoints to find interrupt endpoint</div>
<div>+  // Traverse endpoints to find interrupt endpoint IN</div>
<div>   //</div>
<div>   Found = FALSE;</div>
<div>   for (Index = 0; Index < EndpointNumber; Index++) {</div>
<div>@@ -232,7 +232,8 @@ USBKeyboardDriverBindingStart (</div>
<div>              &EndpointDescriptor</div>
<div>              );</div>
<div> </div>
<div>-    if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {</div>
<div>+    if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT &&</div>
<div>+          (EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) ) {</div>
<div>       //</div>
<div>       // We only care interrupt endpoint here</div>
<div>       //</div>
<div>-- </div>
<div>2.20.1</div>
<div> </div>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>

You receive all messages sent to this group.


<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/52175">View/Reply Online (#52175)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/68284872/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>