From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web11.1478.1637723786546169689 for ; Tue, 23 Nov 2021 19:16:27 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaojie@byosoft.com.cn) Received: from localhost.localdomain ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 24 Nov 2021 11:16:16 +0800 X-WM-Sender: gaojie@byosoft.com.cn From: "Gao Jie" To: devel@edk2.groups.io Cc: Edhaya.Chandran@arm.com, Carolyn.Gjertsen@amd.com, Samer.El-Haj-Mahmoud@arm.com, eric.jin@intel.com, arvinx.chen@intel.com, Supreeth.Venkatesh@amd.com Subject: [PATCH] uefi-sct/SctPkg:Enhance BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1() Date: Wed, 24 Nov 2021 11:15:37 +0800 Message-Id: <40f426fe26ce900c75da32412d51d858fa051b04.1637723578.git.gaojie@byosoft.com.cn> X-Mailer: git-send-email 2.31.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2386 Enhance BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1() to handle ReadKeyStrokeEx implementation which returns EFI_NOT_READY but without touching KeyToggleState. Signed-off-by: Barton Gao --- .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 11 ++++++++++- .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c index 0398bc26..c1669959 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c @@ -1160,6 +1160,12 @@ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( ValidState[5] = EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE; ValidState[6] = EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE; + // + // Set all bits to one (invalid values) for both KeyShiftState and KeyToggleState + // + Key.KeyState.KeyShiftState = 0xFFFFFFFF; + Key.KeyState.KeyToggleState = 0xFF; + // //Read next keystroke from the input device // @@ -1171,7 +1177,10 @@ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( return Status; } - if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) { + if (((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) || (Key.KeyState.KeyShiftState == 0xFFFFFFFF) || (Key.KeyState.KeyToggleState == 0xFF)) { + // + // Log the error here and return key states are not supported when high order bit of KeyToggleState is 0 or KeyState not touched + // return EFI_UNSUPPORTED; } diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c index adbf3dcf..e20ed345 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c @@ -1160,6 +1160,12 @@ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( ValidState[5] = EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE; ValidState[6] = EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE; + // + // Set all bits to one (invalid values) for both KeyShiftState and KeyToggleState + // + Key.KeyState.KeyShiftState = 0xFFFFFFFF; + Key.KeyState.KeyToggleState = 0xFF; + // //Read next keystroke from the input device // @@ -1171,7 +1177,10 @@ BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( return Status; } - if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) { + if (((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) || (Key.KeyState.KeyShiftState == 0xFFFFFFFF) || (Key.KeyState.KeyToggleState == 0xFF)) { + // + // Log the error here and return key states are not supported when high order bit of KeyToggleState is 0 or KeyState not touched + // return EFI_UNSUPPORTED; } -- 2.31.0.windows.1