summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c')
-rw-r--r--MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
index 40f9a5633a..9636d4f2bc 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -802,7 +802,7 @@ InitUSBKeyboard (
IN OUT USB_KB_DEV *UsbKeyboardDevice
)
{
- UINT8 ConfigValue;
+ UINT16 ConfigValue;
UINT8 Protocol;
UINT8 ReportId;
UINT8 Duration;
@@ -818,12 +818,24 @@ InitUSBKeyboard (
InitUSBKeyBuffer (&(UsbKeyboardDevice->KeyboardBuffer));
//
- // Uses default configuration to configure the USB keyboard device.
+ // Use the config out of the descriptor
+ // Assumed the first config is the correct one and this is not always the case
+ //
+ Status = UsbGetConfiguration (
+ UsbKeyboardDevice->UsbIo,
+ &ConfigValue,
+ &TransferResult
+ );
+ if (EFI_ERROR (Status)) {
+ ConfigValue = 0x01;
+ }
+
+ //
+ // Uses default configuration to configure the USB Keyboard device.
//
- ConfigValue = 0x01;
Status = UsbSetConfiguration (
UsbKeyboardDevice->UsbIo,
- (UINT16) ConfigValue,
+ ConfigValue,
&TransferResult
);
if (EFI_ERROR (Status)) {