REF: UEFI_Spec_2_10_Aug29.pdf page 1695.

In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack():
If the callback function returns with the ActionRequest set to
_QUESTION_APPLY, then the Forms Browser will write the current modified
question value on the selected form to storage.

Update the DriverSampleDxe, add a new question "Question apply test".

Signed-off-by: Ming Tan <ming....@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Dandan Bi <dandan...@intel.com>
---
 .../Universal/DriverSampleDxe/DriverSample.c        | 13 +++++++++++++
 .../Universal/DriverSampleDxe/NVDataStruc.h         |  1 +
 MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr      | 10 ++++++++++
 .../Universal/DriverSampleDxe/VfrStrings.uni        |  4 ++++
 4 files changed, 28 insertions(+)

diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c 
b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 62ba52e940..003cb499b5 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -858,6 +858,7 @@ ExtractConfig (
   @retval EFI_INVALID_PARAMETER  Configuration is NULL.
   @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this
                                  driver.
+  @retval EFI_DEVICE_ERROR       If value is 44, return error for testing.
 
 **/
 EFI_STATUS
@@ -1065,6 +1066,11 @@ RouteConfig (
     return Status;
   }
 
+  if (PrivateData->Configuration.QuestionApply == 44) {
+    // Return error for verify the error handling of caller.
+    return EFI_DEVICE_ERROR;
+  }
+
   //
   // Store Buffer Storage back to EFI variable
   //
@@ -1599,6 +1605,13 @@ DriverCallback (
           *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
           break;
 
+        case 0x1253:
+          //
+          // User change the value of "Question apply test".
+          //
+          *ActionRequest = EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY;
+          break;
+
         case 0x1231:
           //
           // 1. Check to see whether system support keyword.
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h 
b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
index 489d7bcbf3..3f5388946d 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
+++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
@@ -95,6 +95,7 @@ typedef struct {
   MY_EFI_UNION_DATA    MyUnionData;
   UINT8                QuestionXUefiKeywordRestStyle;
   UINT8                QuestionNonXUefiKeywordRestStyle;
+  UINT8                QuestionApply;
 } DRIVER_SAMPLE_CONFIGURATION;
 
 //
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr 
b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index 5323e2b411..0c376fe9b7 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -513,6 +513,16 @@ formset
             default = 18,
     endnumeric;
 
+    numeric varid   = MyIfrNVData.QuestionApply,
+            questionid = 0x1253,
+            prompt  = STRING_TOKEN(STR_QUESTION_APPLY_TEST_PROMPT),
+            help    = STRING_TOKEN(STR_QUESTION_APPLY_TEST_HELP),
+            flags   = INTERACTIVE,
+            minimum = 0,
+            maximum = 255,
+            default = 19,
+    endnumeric;
+
     text
       help  = STRING_TOKEN(STR_POPUP_TEST_HELP),
       text  = STRING_TOKEN(STR_POPUP_TEST_PROMPT),
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni 
b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
index 8a3e286bec..ed906045fd 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
+++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
@@ -269,6 +269,10 @@
                                                      #language fr-FR 
"Submitted callback test"
 #string STR_SUBMITTED_CALLBACK_TEST_HELP             #language en-US "Change 
the value and press F10 to submit will pop up a dialogue to show SUBMITTED 
Callback has been triggered"
                                                      #language fr-FR "Change 
the value and press F10 to submit will pop up a dialogue to show SUBMITTED 
Callback has been triggered"
+#string STR_QUESTION_APPLY_TEST_PROMPT               #language en-US "Question 
apply test"
+                                                     #language fr-FR "Question 
apply test"
+#string STR_QUESTION_APPLY_TEST_HELP                 #language en-US "Change 
the value and it will be applied automaticlly. If set to 44, then return 
failed."
+                                                     #language fr-FR "Change 
the value and it will be applied automaticlly. If set to 44, then return 
failed."
 #string STR_POPUP_TEST_PROMPT                        #language en-US "Select 
it to invoke Hii Popup Protocol"
                                                      #language fr-FR "Select 
it to invoke Hii Popup Protocol"
 #string STR_POPUP_TEST_HELP                          #language en-US "Select 
this question will pop up a message box, then user can decide whether exit 
current form or not"
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113036): https://edk2.groups.io/g/devel/message/113036
Mute This Topic: https://groups.io/mt/103482807/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to