public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"matt.devillier@gmail.com" <matt.devillier@gmail.com>
Subject: Re: [edk2-devel] [PATCH v3 2/3] MdeModulePkg/Usb/UsbMouse: Fix endpoint selection
Date: Mon, 6 Jan 2020 05:31:44 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C99006B@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200106041207.29728-3-matt.devillier@gmail.com>

> -----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 2/3] MdeModulePkg/Usb/UsbMouse: 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>
> ---
>  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
> b/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
> index 677815a8ad..143ff15eb0 100644
> --- a/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
> +++ b/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
> @@ -203,7 +203,7 @@ USBMouseDriverBindingStart (
>    EndpointNumber = UsbMouseDevice->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 @@ USBMouseDriverBindingStart (
>               &EndpointDescriptor
>               );
> 
> -    if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) ==
> USB_ENDPOINT_INTERRUPT) {
> +    if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) ==
> USB_ENDPOINT_INTERRUPT) &&
> +        ((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != 0))
> {


Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Since there is only coding style change compared with V1 series, I will keep
the R-b tag by GuoMinJ <newexplorerj@gmail.com> as well.

Best Regards,
Hao Wu


>        //
>        // We only care interrupt endpoint here
>        //
> --
> 2.20.1
> 
> 
> 


  reply	other threads:[~2020-01-06  5:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200106041207.29728-1-matt.devillier@gmail.com>
2020-01-06  4:12 ` [PATCH v3 1/3] MdeModulePkg/Usb/EfiKey: Fix endpoint selection MrChromebox
2020-01-06  5:31   ` [edk2-devel] " Wu, Hao A
2020-01-06  6:52   ` Wu, Hao A
2020-01-06  4:12 ` [PATCH v3 2/3] MdeModulePkg/Usb/UsbMouse: " MrChromebox
2020-01-06  5:31   ` Wu, Hao A [this message]
2020-01-06  4:12 ` [PATCH v3 3/3] MdeModulePkg/UsbMouseAbsolutePointer: " MrChromebox
2020-01-06  5:31   ` [edk2-devel] " Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A093C99006B@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox