From nobody Fri Dec 27 04:32:11 2024 Delivered-To: importer@patchew.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; 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 1503304414345716.5431812880521; Mon, 21 Aug 2017 01:33:34 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1B63021E2DA7B; Mon, 21 Aug 2017 01:31:01 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 745812095B9C7 for ; Mon, 21 Aug 2017 01:30:59 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 21 Aug 2017 01:33:30 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga004.jf.intel.com with ESMTP; 21 Aug 2017 01:33:30 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,408,1498546800"; d="scan'208";a="121071564" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 21 Aug 2017 16:33:13 +0800 Message-Id: <1503304393-304300-4-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1503304393-304300-1-git-send-email-dandan.bi@intel.com> References: <1503304393-304300-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [PATCH V3 3/3] MdeModulePkg/DriverSample: Add sample case for popup protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao 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" Add one sample case about how to use HiiPopup protocol to draw message box. Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- .../Universal/DriverSampleDxe/DriverSample.c | 29 ++++++++++++++++++= ++++ .../Universal/DriverSampleDxe/DriverSample.h | 4 ++- .../Universal/DriverSampleDxe/DriverSampleDxe.inf | 3 ++- MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr | 10 ++++++-- .../Universal/DriverSampleDxe/VfrStrings.uni | 8 +++++- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeMod= ulePkg/Universal/DriverSampleDxe/DriverSample.c index f103b9c..bbd9713 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -1098,10 +1098,13 @@ DriverCallback ( EFI_STRING Results; UINT32 ProgressErr; CHAR16 *TmpStr; UINTN Index; UINT64 BufferValue; + EFI_HII_POPUP_SELECTION UserSelection; + + UserSelection =3D 0xFF; =20 if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) &= & (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE))|| (ActionRequest =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } @@ -1617,10 +1620,26 @@ DriverCallback ( Status =3D EFI_SUCCESS; break; } break; =20 + case 0x1330: + Status =3D mPrivateData->HiiPopup->CreatePopup ( + mPrivateData->HiiPopup, + EfiHiiPopupStyleInfo, + EfiHiiPopupTypeYesNo, + mPrivateData->HiiHandle[0], + STRING_TOKEN (STR_POPUP_STRING), + &UserSelection + ); + if (!EFI_ERROR (Status)) { + if (UserSelection =3D=3D EfiHiiPopupSelectionYes) { + *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_EXIT; + } + } + break; + default: break; } break; =20 @@ -1676,10 +1695,11 @@ DriverSampleInit ( EFI_HII_DATABASE_PROTOCOL *HiiDatabase; EFI_HII_STRING_PROTOCOL *HiiString; EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler; + EFI_HII_POPUP_PROTOCOL *PopupHandler; CHAR16 *NewString; UINTN BufferSize; DRIVER_SAMPLE_CONFIGURATION *Configuration; BOOLEAN ActionFlag; EFI_STRING ConfigRequestHdr; @@ -1761,10 +1781,19 @@ DriverSampleInit ( if (EFI_ERROR (Status)) { return Status; } mPrivateData->HiiKeywordHandler =3D HiiKeywordHandler; =20 + // + // Locate HiiPopup protocol + // + Status =3D gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid, NULL, (VOID *= *) &PopupHandler); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiPopup =3D PopupHandler; + Status =3D gBS->InstallMultipleProtocolInterfaces ( &DriverHandle[0], &gEfiDevicePathProtocolGuid, &mHiiVendorDevicePath0, &gEfiHiiConfigAccessProtocolGuid, diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h b/MdeMod= ulePkg/Universal/DriverSampleDxe/DriverSample.h index 6c97239..507cff6 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h @@ -1,8 +1,8 @@ /** @file =20 -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, 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 http://opensource.org/licenses/bsd-license.php =20 @@ -31,10 +31,11 @@ Revision History #include #include #include #include #include +#include =20 #include #include #include #include @@ -96,10 +97,11 @@ typedef struct { // EFI_HII_DATABASE_PROTOCOL *HiiDatabase; EFI_HII_STRING_PROTOCOL *HiiString; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler; + EFI_HII_POPUP_PROTOCOL *HiiPopup; =20 EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2; =20 // // Produced protocol diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf b/M= deModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf index 4233e63..bfd7484 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf @@ -2,11 +2,11 @@ # This is a sample HII driver.=20 # # This driver shows how HII protocol, VFR and UNI files are used to create= a HII=20 # driver which can be dipslayed and configured by a UEFI HII Form Browser. # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License # which accompanies this distribution. The full text of the license may b= e found at # http://opensource.org/licenses/bsd-license.php @@ -91,10 +91,11 @@ gEfiFormBrowser2ProtocolGuid ## CONSUMES gEfiHiiDatabaseProtocolGuid ## CONSUMES gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES gEdkiiFormBrowserExProtocolGuid ## CONSUMES gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES + gEfiHiiPopupProtocolGuid ## CONSUMES =20 [Depex] gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVa= riableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid =20 [UserExtensions.TianoCore."ExtraFiles"] diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/= Universal/DriverSampleDxe/Vfr.vfr index 4bdaf76..d547ec8 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr +++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr @@ -1,10 +1,10 @@ ///** @file // // Sample Setup formset. // -// Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+// Copyright (c) 2004 - 2017, 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 // http://opensource.org/licenses/bsd-license.php // @@ -474,11 +474,17 @@ formset flags =3D INTERACTIVE, minimum =3D 0, maximum =3D 255, default =3D 18, endnumeric; - =20 + + text + help =3D STRING_TOKEN(STR_POPUP_TEST_HELP), + text =3D STRING_TOKEN(STR_POPUP_TEST_PROMPT), + flags =3D INTERACTIVE, + key =3D 0x1330; + goto 2, prompt =3D STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this = too has no end-op and basically it's a jump to a form ONLY help =3D STRING_TOKEN(STR_GOTO_HELP); =20 goto 3, diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeMod= ulePkg/Universal/DriverSampleDxe/VfrStrings.uni index 8d24a47..6a268d1 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni +++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni @@ -1,8 +1,8 @@ // *++ // -// Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+// Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
// This program and the accompanying materials =20 // are licensed and made available under the terms and conditions of the B= SD License =20 // which accompanies this distribution. The full text of the license may = be found at =20 // http://opensource.org/licenses/bsd-license.php = =20 // = =20 @@ -265,10 +265,16 @@ #language fr-FR "" = = =20 #string STR_SUBMITTED_CALLBACK_TEST_PROMPT #language en-US "Subm= itted callback test" #language fr-FR "Subm= itted callback test" #string STR_SUBMITTED_CALLBACK_TEST_HELP #language en-US "Chan= ge the value and press F10 to submmit will pop up a dialogue to show SUBMIT= TED Callback has been triggered" #language fr-FR "Chan= ge the value and press F10 to submmit will pop up a dialogue to show SUBMIT= TED Callback has been triggered" +#string STR_POPUP_TEST_PROMPT #language en-US "Sele= ct it to invoke Hii Popup Protocol" + #language fr-FR "Sele= ct it to invoke Hii Popup Protocol" +#string STR_POPUP_TEST_HELP #language en-US "Sele= ct this question will pop up a message box, then user can decide whether ex= it curret form or not" + #language fr-FR "Sele= ct this question will pop up a message box, then user can decide whether ex= it curret form or not" +#string STR_POPUP_STRING #language en-US "Are = you sure to exit current form?" + #language fr-FR "Are = you sure to exit current form?" // Boot Order #string STR_BOOT_TITLE #language en-US "Boot" #string STR_BOOT_OPTIONS #language en-US "Boot Order" #string STR_BOOT_OPTION1 #language en-US "IDE HDD" #string STR_BOOT_OPTION2 #language en-US "ATAPI CD" --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel