From nobody Fri May 17 09:18:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+86964+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86964+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1645702707; cv=none; d=zohomail.com; s=zohoarc; b=RnW3omoioTPRYYzjviIfw3ticebDxvdYbpV+muQR6pMW1bZxKYDfrlvkrshJSQy0+Jw+2XQfMhgyZgYOV2XgtkrFufM1IdhsZXlHd/ecTsPpMppzouOHG+ALbcrG89ksbfnia8BtCSWbFng2dtDCmMC5bQCn6rCnnQte75Bn42g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645702707; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=i61hfu4TKQ0OhmOZL2k/+lOiAUIhU52oZfazEzyy9dc=; b=jJ92uEaLe6MDmqLvXpYoxWlNkSuyBYIC678yMOoJQ/u25dcwu78d9k40sNNpk0puRquP98qZ8eQ3DLXGul0xJwxyKsLnHTZItRF+0vOl4XWzG7cFlDCCf4uRXw9Gi6HZb8igFVDzfum6j7JuXkG/fjWB5Zi0P2v0ZOSTmq9XYGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86964+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1645702707311763.325719882585; Thu, 24 Feb 2022 03:38:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id j6VDYY1788612xleXsU56Ehr; Thu, 24 Feb 2022 03:38:27 -0800 X-Received: from smarthost01b.ixn.mail.zen.net.uk (smarthost01b.ixn.mail.zen.net.uk [212.23.1.21]) by mx.groups.io with SMTP id smtpd.web08.9191.1645702704572188896 for ; Thu, 24 Feb 2022 03:38:25 -0800 X-Received: from [217.155.46.38] (helo=sean-StarBook.lan) by smarthost01b.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nNCRw-0002Vb-Iy; Thu, 24 Feb 2022 11:38:20 +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: [edk2-devel] [PATCH] MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting Date: Thu, 24 Feb 2022 11:38:18 +0000 Message-Id: <96aee2ccd71e956372fa85cfafbf4fa03da3ae1f.1645702698.git.sean@starlabs.systems> MIME-Version: 1.0 X-Originating-smarthost01b-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sean@starlabs.systems X-Gm-Message-State: BiUKQNur32NJ61ptfyXdEOPBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1645702707; bh=z//RS7z6O6JVd2WER0lrBl9r0jdsg6YLc82utnNa1b0=; h=Cc:Date:From:Reply-To:Subject:To; b=iGo72f1xQLArfVja5XX/PF8E+ZMupRH9o6zRy7F9Adz2K8nN0OH87Ql4qrSInrpM3tn VtVh+5agLysQGi1SPrvgfMee1lUaqAl33j4UkUvskb9ZhGO47VAn1xUe2ai1Y3cRXyahP MDHbRSO3w6MUWXKv7viKiabvSIL39ifawRs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1645702709141100001 Content-Type: text/plain; charset="utf-8" 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/Us= b/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; =20 @@ -854,22 +853,15 @@ InitUSBKeyboard ( } } =20 - UsbGetProtocolRequest ( - UsbKeyboardDevice->UsbIo, - UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber, - &Protocol - ); // // Set boot protocol for the USB Keyboard. // This driver only supports boot protocol. // - if (Protocol !=3D BOOT_PROTOCOL) { - UsbSetProtocolRequest ( - UsbKeyboardDevice->UsbIo, - UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber, - BOOT_PROTOCOL - ); - } + UsbSetProtocolRequest ( + UsbKeyboardDevice->UsbIo, + UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber, + BOOT_PROTOCOL + ); =20 UsbKeyboardDevice->CtrlOn =3D FALSE; UsbKeyboardDevice->AltOn =3D FALSE; --=20 2.32.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86964): https://edk2.groups.io/g/devel/message/86964 Mute This Topic: https://groups.io/mt/89228276/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-