提交 196cdb27 编写于 作者: N nms42

Platform/OpenUsbKbDxe/EfiKey: cherry pick from edk2 Fix endpoint selection

commit f9c2c71ed69ca1d92687a55d3ef947cfb4413b3e
Author: Matt DeVillier <matt.devillier@gmail.com>
Date:   Mon Jan 6 12:12:05 2020 +0800

    MdeModulePkg/Usb/EfiKey: Fix endpoint selection

    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: NMatt DeVillier <matt.devillier@gmail.com>
Reviewed-by: NGuoMinJ <newexplorerj@gmail.com>
Reviewed-by: NHao A Wu <hao.a.wu@intel.com>
上级 03666a61
......@@ -248,7 +248,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++) {
......@@ -259,7 +259,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
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册