From 589d51df260465e2561979b8a988e77b0f32a6e8 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 24 Feb 2022 19:38:18 +0800 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 Cc: Ray Ni Signed-off-by: Matt DeVillier Signed-off-by: Patrick Rudolph Signed-off-by: Sean Rhodes Reviewed-by: Hao A Wu --- 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;