From nobody Mon Dec 23 18:08:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1516608643104473.83396897465684; Mon, 22 Jan 2018 00:10:43 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BBF6C2238B5A4; Mon, 22 Jan 2018 00:05:09 -0800 (PST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7D9A32238B598 for ; Mon, 22 Jan 2018 00:05:05 -0800 (PST) Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 00:10:31 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.19]) by fmsmga008.fm.intel.com with ESMTP; 22 Jan 2018 00:10:30 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,395,1511856000"; d="scan'208";a="12170515" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 22 Jan 2018 16:10:23 +0800 Message-Id: <20180122081024.283496-6-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.1.windows.2 In-Reply-To: <20180122081024.283496-1-ruiyu.ni@intel.com> References: <20180122081024.283496-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH 5/6] IntelFrameworkModule/Ps2Kb: ReadKeyStrokeEx always return key state X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Today's implementation only return key state when there is a key. But when user doesn't press any key, the key state cannot be returned. The patch changes the ReadKeyStrokeEx() to always return the key state even there is no key pressed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng Cc: Michael D Kinney --- .../Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 58 ++++++++++++++----= ---- .../Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c | 6 ++- .../Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 14 +++++- 3 files changed, 54 insertions(+), 24 deletions(-) diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c= b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c index b528b89ac4..48d8efd516 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c @@ -1,7 +1,7 @@ /** @file Routines that access 8042 keyboard controller =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -1140,6 +1140,38 @@ UpdateStatusLights ( return Status; } =20 +/** + Initialize the key state. + + @param ConsoleIn The KEYBOARD_CONSOLE_IN_DEV instance. + @param KeyState A pointer to receive the key state information. +**/ +VOID +InitializeKeyState ( + IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, + OUT EFI_KEY_STATE *KeyState + ) +{ + KeyState->KeyShiftState =3D EFI_SHIFT_STATE_VALID + | (ConsoleIn->LeftCtrl ? EFI_LEFT_CONTROL_PRE= SSED : 0) + | (ConsoleIn->RightCtrl ? EFI_RIGHT_CONTROL_PR= ESSED : 0) + | (ConsoleIn->LeftAlt ? EFI_LEFT_ALT_PRESSED= : 0) + | (ConsoleIn->RightAlt ? EFI_RIGHT_ALT_PRESSE= D : 0) + | (ConsoleIn->LeftShift ? EFI_LEFT_SHIFT_PRESS= ED : 0) + | (ConsoleIn->RightShift ? EFI_RIGHT_SHIFT_PRES= SED : 0) + | (ConsoleIn->LeftLogo ? EFI_LEFT_LOGO_PRESSE= D : 0) + | (ConsoleIn->RightLogo ? EFI_RIGHT_LOGO_PRESS= ED : 0) + | (ConsoleIn->Menu ? EFI_MENU_KEY_PRESSED= : 0) + | (ConsoleIn->SysReq ? EFI_SYS_REQ_PRESSED = : 0) + ; + KeyState->KeyToggleState =3D EFI_TOGGLE_STATE_VALID + | (ConsoleIn->CapsLock ? EFI_CAPS_LOCK_ACTIVE= : 0) + | (ConsoleIn->NumLock ? EFI_NUM_LOCK_ACTIVE = : 0) + | (ConsoleIn->ScrollLock ? EFI_SCROLL_LOCK_ACTI= VE : 0) + | (ConsoleIn->IsSupportPartialKey ? EFI_KEY_STA= TE_EXPOSED : 0) + ; +} + /** Get scancode from scancode buffer and translate into EFI-scancode and un= icode defined by EFI spec. =20 @@ -1352,27 +1384,9 @@ KeyGetchar ( // // Save the Shift/Toggle state // - KeyData.KeyState.KeyShiftState =3D (UINT32) (EFI_SHIFT_STATE_VALID - | (ConsoleIn->LeftCtrl ? EFI_LEFT_CONTR= OL_PRESSED : 0) - | (ConsoleIn->RightCtrl ? EFI_RIGHT_CONT= ROL_PRESSED : 0) - | (ConsoleIn->LeftAlt ? EFI_LEFT_ALT_P= RESSED : 0) - | (ConsoleIn->RightAlt ? EFI_RIGHT_ALT_= PRESSED : 0) - | (ConsoleIn->LeftShift ? EFI_LEFT_SHIFT= _PRESSED : 0) - | (ConsoleIn->RightShift ? EFI_RIGHT_SHIF= T_PRESSED : 0) - | (ConsoleIn->LeftLogo ? EFI_LEFT_LOGO_= PRESSED : 0) - | (ConsoleIn->RightLogo ? EFI_RIGHT_LOGO= _PRESSED : 0) - | (ConsoleIn->Menu ? EFI_MENU_KEY_P= RESSED : 0) - | (ConsoleIn->SysReq ? EFI_SYS_REQ_PR= ESSED : 0) - ); - KeyData.KeyState.KeyToggleState =3D (EFI_KEY_TOGGLE_STATE) (EFI_TOGGLE_S= TATE_VALID - | (ConsoleIn->CapsLock ? EFI_CAPS_LOCK= _ACTIVE : 0) - | (ConsoleIn->NumLock ? EFI_NUM_LOCK_= ACTIVE : 0) - | (ConsoleIn->ScrollLock ? EFI_SCROLL_LO= CK_ACTIVE : 0) - | (ConsoleIn->IsSupportPartialKey ? EFI_= KEY_STATE_EXPOSED : 0) - ); - - KeyData.Key.ScanCode =3D SCAN_NULL; - KeyData.Key.UnicodeChar =3D CHAR_NULL; + InitializeKeyState (ConsoleIn, &KeyData.KeyState); + KeyData.Key.ScanCode =3D SCAN_NULL; + KeyData.Key.UnicodeChar =3D CHAR_NULL; =20 // // Key Pad "/" shares the same scancode as that of "/" except Key Pad "/= " has E0 prefix diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c = b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c index 76779553cd..401b0e8c20 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c @@ -2,7 +2,7 @@ Routines implements SIMPLE_TEXT_IN protocol's interfaces based on 8042 i= nterfaces provided by Ps2KbdCtrller.c. =20 -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -165,6 +165,10 @@ KeyboardReadKeyStrokeWorker ( Status =3D EFI_DEVICE_ERROR; } else { Status =3D PopEfikeyBufHead (&ConsoleInDev->EfiKeyQueue, KeyData); + if (Status =3D=3D EFI_NOT_READY) { + ZeroMem (&KeyData->Key, sizeof (KeyData->Key)); + InitializeKeyState (ConsoleInDev, &KeyData->KeyState); + } } =20 gBS->RestoreTPL (OldTpl); diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h b= /IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h index 76fb498868..613f176401 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h @@ -1,7 +1,7 @@ /** @file PS/2 keyboard driver header file =20 -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -566,4 +566,16 @@ IsKeyRegistered ( IN EFI_KEY_DATA *InputData ); =20 +/** + Initialize the key state. + + @param ConsoleIn The KEYBOARD_CONSOLE_IN_DEV instance. + @param KeyState A pointer to receive the key state information. +**/ +VOID +InitializeKeyState ( + IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, + OUT EFI_KEY_STATE *KeyState + ); + #endif --=20 2.15.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel