public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Rhodes, Sean" <sean@starlabs.systems>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Guo" <guo.dong@intel.com>,
	"Rhodes, Sean" <sean@starlabs.systems>,
	"Ni, Ray" <ray.ni@intel.com>,
	Matt DeVillier <matt.devillier@gmail.com>,
	Patrick Rudolph <patrick.rudolph@9elements.com>
Subject: Re: [PATCH] MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting
Date: Wed, 2 Mar 2022 02:10:25 +0000	[thread overview]
Message-ID: <DM6PR11MB402536D441AF3F0D526B2232CA039@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <96aee2ccd71e956372fa85cfafbf4fa03da3ae1f.1645702698.git.sean@starlabs.systems>

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

Best Regards,
Hao Wu

> -----Original Message-----
> From: Sean Rhodes <sean@starlabs.systems>
> Sent: Thursday, February 24, 2022 7:38 PM
> To: devel@edk2.groups.io
> Cc: Dong, Guo <guo.dong@intel.com>; Rhodes, Sean
> <sean@starlabs.systems>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Matt DeVillier <matt.devillier@gmail.com>; Patrick
> Rudolph <patrick.rudolph@9elements.com>
> Subject: [PATCH] MdeModulePkg/Usb/Keyboard.c: Don't request protocol
> before setting
> 
> No need to check the interface protocol then conditionally setting,
> just set it to BOOT_PROTOCOL and check for error.
> 
> This is what Linux does for HID devices as some don't follow the USB spec.
> One example is the Aspeed BMC HID keyboard device, which adds a massive
> boot delay without this patch as it doesn't respond to 'GetProtocolRequest'.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
>  MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> index 5a94a4dda7..b5a6459a35 100644
> --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> @@ -805,7 +805,6 @@ InitUSBKeyboard (
>    )
> 
>  {
> 
>    UINT16      ConfigValue;
> 
> -  UINT8       Protocol;
> 
>    EFI_STATUS  Status;
> 
>    UINT32      TransferResult;
> 
> 
> 
> @@ -854,22 +853,15 @@ InitUSBKeyboard (
>      }
> 
>    }
> 
> 
> 
> -  UsbGetProtocolRequest (
> 
> -    UsbKeyboardDevice->UsbIo,
> 
> -    UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
> 
> -    &Protocol
> 
> -    );
> 
>    //
> 
>    // Set boot protocol for the USB Keyboard.
> 
>    // This driver only supports boot protocol.
> 
>    //
> 
> -  if (Protocol != BOOT_PROTOCOL) {
> 
> -    UsbSetProtocolRequest (
> 
> -      UsbKeyboardDevice->UsbIo,
> 
> -      UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
> 
> -      BOOT_PROTOCOL
> 
> -      );
> 
> -  }
> 
> +  UsbSetProtocolRequest (
> 
> +    UsbKeyboardDevice->UsbIo,
> 
> +    UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
> 
> +    BOOT_PROTOCOL
> 
> +    );
> 
> 
> 
>    UsbKeyboardDevice->CtrlOn    = FALSE;
> 
>    UsbKeyboardDevice->AltOn     = FALSE;
> 
> --
> 2.32.0


  reply	other threads:[~2022-03-02  2:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 11:38 [PATCH] MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting Sean Rhodes
2022-03-02  2:10 ` Wu, Hao A [this message]
2022-03-03  6:27   ` [edk2-devel] " Wu, Hao A
  -- strict thread matches above, loose matches on Subject: below --
2022-02-24  8:04 Sean Rhodes
2022-02-18  7:29 Sean Rhodes
2022-02-24  2:44 ` 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=DM6PR11MB402536D441AF3F0D526B2232CA039@DM6PR11MB4025.namprd11.prod.outlook.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