From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.2134.1578288718086343360 for ; Sun, 05 Jan 2020 21:31:58 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jan 2020 21:31:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,401,1571727600"; d="scan'208";a="420599110" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 05 Jan 2020 21:31:57 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 5 Jan 2020 21:31:57 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.197]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.139]) with mapi id 14.03.0439.000; Mon, 6 Jan 2020 13:31:56 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "matt.devillier@gmail.com" Subject: Re: [edk2-devel] [PATCH v3 3/3] MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection Thread-Topic: [edk2-devel] [PATCH v3 3/3] MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection Thread-Index: AQHVxEkjBvojEX9NxkOjfIwNP9qo6KfdHJwg Date: Mon, 6 Jan 2020 05:31:56 +0000 Message-ID: References: <20200106041207.29728-1-matt.devillier@gmail.com> <20200106041207.29728-4-matt.devillier@gmail.com> In-Reply-To: <20200106041207.29728-4-matt.devillier@gmail.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > MrChromebox > Sent: Monday, January 06, 2020 12:12 PM > To: devel@edk2.groups.io > Cc: Matt DeVillier > Subject: [edk2-devel] [PATCH v3 3/3] > MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Matt DeVillier > --- >=20 > MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolu > tePointer.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git > a/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbs > olutePointer.c > b/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbs > olutePointer.c > index 8953e7031c..9cd0e4cd53 100644 > --- > a/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbs > olutePointer.c > +++ > b/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbs > olutePointer.c > @@ -203,7 +203,7 @@ USBMouseAbsolutePointerDriverBindingStart ( > EndpointNumber =3D UsbMouseAbsolutePointerDevice- > >InterfaceDescriptor.NumEndpoints; >=20 > // > - // Traverse endpoints to find interrupt endpoint > + // Traverse endpoints to find interrupt endpoint IN > // > Found =3D FALSE; > for (Index =3D 0; Index < EndpointNumber; Index++) { > @@ -213,7 +213,8 @@ USBMouseAbsolutePointerDriverBindingStart ( > &EndpointDescriptor > ); >=20 > - if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) =3D=3D > USB_ENDPOINT_INTERRUPT) { > + if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) =3D=3D > USB_ENDPOINT_INTERRUPT) && > + ((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != =3D 0)) > { Reviewed-by: Hao A Wu Best Regards, Hao Wu > // > // We only care interrupt endpoint here > // > -- > 2.20.1 >=20 >=20 >=20