MdeModulePkg/UsbMouseAbsolutePointer: 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.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
MrChromebox 2020-01-06 12:12:07 +08:00 committed by mergify[bot]
parent d0d38ce20e
commit 6cfb6da951
1 changed files with 3 additions and 2 deletions

View File

@ -203,7 +203,7 @@ USBMouseAbsolutePointerDriverBindingStart (
EndpointNumber = UsbMouseAbsolutePointerDevice->InterfaceDescriptor.NumEndpoints;
//
// Traverse endpoints to find interrupt endpoint
// Traverse endpoints to find interrupt endpoint IN
//
Found = FALSE;
for (Index = 0; Index < EndpointNumber; Index++) {
@ -213,7 +213,8 @@ USBMouseAbsolutePointerDriverBindingStart (
&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
//