[PATCH] MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting


Sean Rhodes
 

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@...>
Cc: Ray Ni <ray.ni@...>
Signed-off-by: Matt DeVillier <matt.devillier@...>
Signed-off-by: Patrick Rudolph <patrick.rudolph@...>
Signed-off-by: Sean Rhodes <sean@...>
---
MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 17 +++++------------
.../Library/BrotliCustomDecompressLib/brotli | 2 +-
2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Us=
b/UsbKbDxe/KeyBoard.c
index 5a94a4dda7..73b5df2b64 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -854,22 +854,15 @@ InitUSBKeyboard (
}=0D
}=0D
=0D
- UsbGetProtocolRequest (=0D
- UsbKeyboardDevice->UsbIo,=0D
- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,=0D
- &Protocol=0D
- );=0D
//=0D
// Set boot protocol for the USB Keyboard.=0D
// This driver only supports boot protocol.=0D
//=0D
- if (Protocol !=3D BOOT_PROTOCOL) {=0D
- UsbSetProtocolRequest (=0D
- UsbKeyboardDevice->UsbIo,=0D
- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,=0D
- BOOT_PROTOCOL=0D
- );=0D
- }=0D
+ UsbSetProtocolRequest (=0D
+ UsbKeyboardDevice->UsbIo,=0D
+ UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,=0D
+ BOOT_PROTOCOL=0D
+ );=0D
=0D
UsbKeyboardDevice->CtrlOn =3D FALSE;=0D
UsbKeyboardDevice->AltOn =3D FALSE;=0D
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli b/MdeMod=
ulePkg/Library/BrotliCustomDecompressLib/brotli
index f4153a09f8..666c3280cc 160000
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
@@ -1 +1 @@
-Subproject commit f4153a09f87cbb9c826d8fc12c74642bb2d879ea
+Subproject commit 666c3280cc11dc433c303d79a83d4ffbdd12cc8d
--=20
2.32.0

Join devel@edk2.groups.io to automatically receive all group messages.