public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Patrick Rudolph" <patrick.rudolph@9elements.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Wang, Jian J" <jian.j.wang@intel.com>,
	 "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting
Date: Thu, 28 Jan 2021 08:31:00 +0100	[thread overview]
Message-ID: <CALNFmy2SOaDf0vgj2uLVUjAExeD_bdr8SOnQGhNYzSoK_eQWtw@mail.gmail.com> (raw)
In-Reply-To: <BN8PR11MB3666F4D8F0E4A494BD0559D8CABA9@BN8PR11MB3666.namprd11.prod.outlook.com>

Hello,
Until now no regressions have been observed.
I'll provide a full test description using a wide variety of platforms soon.

Kind Regards,
Patrick Rudolph

On Thu, Jan 28, 2021 at 3:14 AM Wu, Hao A <hao.a.wu@intel.com> wrote:
>
> > -----Original Message-----
> > From: Patrick Rudolph <patrick.rudolph@9elements.com>
> > Sent: Wednesday, January 20, 2021 11:59 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> > Ni, Ray <ray.ni@intel.com>
> > Subject: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request
> > protocol before setting
> >
> > From: Matt DeVillier <matt.devillier@gmail.com>
> >
> > 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'.
>
>
> I am okay with the code change.
>
> But since the current logic is here for a long time, I am not sure whether
> other USB keyboard device will have functional/performance impact for this
> change.
>
> Besides the above mentioned Aspeed BMC HID keyboard device (which has a
> performance issue for the Get_Protocol request that the patch is going to
> drop), could you at least try one USB keyboard device that works fine with
> the origin code logic to see if there is any side effect for this patch?
>
> Thanks in advance.
>
> Best Regards,
> Hao Wu
>
>
> >
> > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > ---
> >  MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 28 ++++++++++++-------
> > -
> >  1 file changed, 17 insertions(+), 11 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > index 77e20b203f..5914174b4d 100644
> > --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
> > @@ -801,7 +801,6 @@ InitUSBKeyboard (
> >    IN OUT USB_KB_DEV   *UsbKeyboardDevice   ) {-  UINT8               Protocol;
> > EFI_STATUS          Status;    REPORT_STATUS_CODE_WITH_DEVICE_PATH (@@
> > -814,21 +813,28 @@ InitUSBKeyboard (
> >    InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
> > InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof
> > (EFI_KEY_DATA)); -  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+  Status = UsbSetProtocolRequest (+
> > UsbKeyboardDevice->UsbIo,+             UsbKeyboardDevice-
> > >InterfaceDescriptor.InterfaceNumber,+             BOOT_PROTOCOL+             );+
> > if (EFI_ERROR (Status)) {+    //+    // If protocol could not be set here, it
> > means+    // the keyboard interface has some errors and could+    // not be
> > initialized+    //+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (+
> > EFI_ERROR_CODE | EFI_ERROR_MINOR,+      (EFI_PERIPHERAL_KEYBOARD |
> > EFI_P_EC_INTERFACE_ERROR),+      UsbKeyboardDevice->DevicePath       );++
> > return EFI_DEVICE_ERROR;   }    UsbKeyboardDevice->CtrlOn     = FALSE;--
> > 2.26.2
>

  reply	other threads:[~2021-01-28  7:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 15:58 [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls Patrick Rudolph
2021-01-20 15:59 ` [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting Patrick Rudolph
2021-01-28  2:14   ` Wu, Hao A
2021-01-28  7:31     ` Patrick Rudolph [this message]
2021-01-22  1:17 ` [edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls Wu, Hao A
2021-01-28  2:14   ` 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=CALNFmy2SOaDf0vgj2uLVUjAExeD_bdr8SOnQGhNYzSoK_eQWtw@mail.gmail.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