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.2131.1578288695833333017 for ; Sun, 05 Jan 2020 21:31:35 -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 fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jan 2020 21:31:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,401,1571727600"; d="scan'208";a="422021201" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 05 Jan 2020 21:31:35 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 5 Jan 2020 21:31:34 -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:33 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "matt.devillier@gmail.com" Subject: Re: [edk2-devel] [PATCH v3 1/3] MdeModulePkg/Usb/EfiKey: Fix endpoint selection Thread-Topic: [edk2-devel] [PATCH v3 1/3] MdeModulePkg/Usb/EfiKey: Fix endpoint selection Thread-Index: AQHVxEmTjISO/MjxV0av5kvUuQgewqfdHHVQ Date: Mon, 6 Jan 2020 05:31:32 +0000 Message-ID: References: <20200106041207.29728-1-matt.devillier@gmail.com> <20200106041207.29728-2-matt.devillier@gmail.com> In-Reply-To: <20200106041207.29728-2-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 > -----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 1/3] MdeModulePkg/Usb/EfiKey: 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 > Test: detachable keyboard on Google Pixel Slate now works. >=20 > Signed-off-by: Matt DeVillier > --- > MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > 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 =3D UsbKeyboardDevice- > >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++) { > @@ -226,7 +226,8 @@ USBKeyboardDriverBindingStart ( > &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 Since there is only coding style change compared with V1 series, I will ke= ep the R-b tag by GuoMinJ as well. Best Regards, Hao Wu > // > // We only care interrupt endpoint here > // > -- > 2.20.1 >=20 >=20 >=20