]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting
authorSean Rhodes <sean@starlabs.systems>
Thu, 24 Feb 2022 11:38:18 +0000 (19:38 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 3 Mar 2022 06:25:50 +0000 (06:25 +0000)
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>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c

index 5a94a4dda71d1f05ebbafc92e63fb8b727a02866..b5a6459a35d250fd55016a22e40801efc514f0ce 100644 (file)
@@ -805,7 +805,6 @@ InitUSBKeyboard (
   )\r
 {\r
   UINT16      ConfigValue;\r
-  UINT8       Protocol;\r
   EFI_STATUS  Status;\r
   UINT32      TransferResult;\r
 \r
@@ -854,22 +853,15 @@ InitUSBKeyboard (
     }\r
   }\r
 \r
-  UsbGetProtocolRequest (\r
-    UsbKeyboardDevice->UsbIo,\r
-    UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,\r
-    &Protocol\r
-    );\r
   //\r
   // Set boot protocol for the USB Keyboard.\r
   // This driver only supports boot protocol.\r
   //\r
-  if (Protocol != BOOT_PROTOCOL) {\r
-    UsbSetProtocolRequest (\r
-      UsbKeyboardDevice->UsbIo,\r
-      UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,\r
-      BOOT_PROTOCOL\r
-      );\r
-  }\r
+  UsbSetProtocolRequest (\r
+    UsbKeyboardDevice->UsbIo,\r
+    UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,\r
+    BOOT_PROTOCOL\r
+    );\r
 \r
   UsbKeyboardDevice->CtrlOn    = FALSE;\r
   UsbKeyboardDevice->AltOn     = FALSE;\r