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'. Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
This commit is contained in:
committed by
Tim Crawford
parent
bbab5b95b4
commit
9f528fb4c0
@@ -801,7 +801,6 @@ InitUSBKeyboard (
|
|||||||
IN OUT USB_KB_DEV *UsbKeyboardDevice
|
IN OUT USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Protocol;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
||||||
@@ -814,21 +813,28 @@ InitUSBKeyboard (
|
|||||||
InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
|
InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));
|
||||||
InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, 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.
|
// Set boot protocol for the USB Keyboard.
|
||||||
// This driver only supports boot protocol.
|
// This driver only supports boot protocol.
|
||||||
//
|
//
|
||||||
if (Protocol != BOOT_PROTOCOL) {
|
Status = UsbSetProtocolRequest (
|
||||||
UsbSetProtocolRequest (
|
UsbKeyboardDevice->UsbIo,
|
||||||
UsbKeyboardDevice->UsbIo,
|
UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
|
||||||
UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
|
BOOT_PROTOCOL
|
||||||
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;
|
UsbKeyboardDevice->CtrlOn = FALSE;
|
||||||
|
Reference in New Issue
Block a user