From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01c.ixn.mail.zen.net.uk (smarthost01c.ixn.mail.zen.net.uk [212.23.1.22]) by mx.groups.io with SMTP id smtpd.web09.7846.1645689879306351395 for ; Thu, 24 Feb 2022 00:04:39 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.22, mailfrom: sean@starlabs.systems) Received: from [217.155.46.38] (helo=sean-StarBook.lan) by smarthost01c.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nN977-00051d-Lt; Thu, 24 Feb 2022 08:04:37 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: guo.dong@intel.com, Sean Rhodes , Hao A Wu , Ray Ni , Matt DeVillier , Patrick Rudolph Subject: [PATCH] MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting Date: Thu, 24 Feb 2022 08:04:36 +0000 Message-Id: <9f7463fb78c98d9dce4a45490b1d4e3770216e33.1645689875.git.sean@starlabs.systems> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Originating-smarthost01c-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Content-Transfer-Encoding: quoted-printable 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 --- MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 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 --=20 2.32.0