From nobody Sun Nov 24 14:00:29 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+86958+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+86958+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1645689881; cv=none; d=zohomail.com; s=zohoarc; b=nAXN5lSw5mifjand572fIxXnHMObuyeOV5cvFIQCtT0zOS1knjPtg6TeXfPtw8Z3jZqi+m1NeDlY6jkBRxSWTgZf/uyTbJNCGozLzoDocoBiFSjOFt05gyQWhBMnVpTXmtCB0zjFcy8FHlFU6n8rJNUOKF8UxcmihyytPUhPlCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645689881; 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=Y/55Fvg/ZbYNxWTyOj37S5Z32hdVxEDmrAXBD/0YwJU=; b=Lcd+6aruaRenxd5+PtZQHjQ6k5KZD4PBit3sTmG9KSDiHdoVfUqIe7ta3PcnXSlKmuYlM5wnYFqSQRD0DKi6MAouuhJEY9weG+098DVvgHBsPuexRLCKInlzKjEDeGN84dW4CUagxgxugpXS3D2X2c8NXAUiIWIhXGmouRnv+xQ= 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+86958+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1645689881349732.2961443302054; Thu, 24 Feb 2022 00:04:41 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id O5pNYY1788612xM8FJjjkiHH; Thu, 24 Feb 2022 00:04:41 -0800 X-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 X-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: [edk2-devel] [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> MIME-Version: 1.0 X-Originating-smarthost01c-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: Zg2DabhDdt0p5fjty47bvwXnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1645689881; bh=mIdHWp0jBiWIGMn11vU4IK7KxE7gR2oxhbsoGBauEu4=; h=Cc:Date:From:Reply-To:Subject:To; b=qBbk4kiUII4yL6WFRB3cMvFzL7asN7T9p9oNa6aCf/vFuCpgDz6JwR1zKiQEGibY95r eZ5yw/mm0dbTlF+3BW+uINA64HDBG2cEiaWOjfc/SaypYb3NZFdSa1Djww1XHae/XQyzA +Hq8Pit/PzeFSdyApHejmXNVrT2vewOoEv8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1645689883576100001 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 --- 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 ( } } =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 (#86958): https://edk2.groups.io/g/devel/message/86958 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-