public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Li, Walon" <walon.li@hpe.com>
To: devel@edk2.groups.io
Cc: walon.li@hpe.com, dandan.bi@intel.com, nickle.wang@hpe.com,
	abner.chang@hpe.com, sunnywang@hpe.com
Subject: [PATCH] MdeModulePkg/SetupBrowserDxe: Do not reconnect driver with form-update
Date: Wed, 20 May 2020 12:24:47 +0800	[thread overview]
Message-ID: <20200520042447.1017-1-walon.li@hpe.com> (raw)

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2701

Recording to the spec, the reconnect is activated upon exiting of the
formset or the browser. Exiting is by user but form-browser internal
logic. That means the reconnection is only happened when user press
ESC or _EXIT action to exit form.
Driver callback may update HII form dynamically so form-browser needs
to refresh its internal data. It's not exiting formset for user
exactly and they didn't know what happened. So use a flag to record
that and do not reconnect driver if updated by callback.

Signed-off-by: Walon Li <walon.li@hpe.com>
---
 MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c | 2 ++
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c        | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index bafee4c612..7f85873730 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -19,6 +19,7 @@ LIST_ENTRY         mRefreshEventList = INITIALIZE_LIST_HEAD_VARIABLE (mRefreshEv
 UINT16             mCurFakeQestId;
 FORM_DISPLAY_ENGINE_FORM gDisplayFormData;
 BOOLEAN            mFinishRetrieveCall = FALSE;
+BOOLEAN            mDynamicFormUpdated = FALSE;
 
 /**
   Check whether the ConfigAccess protocol is available.
@@ -1762,6 +1763,7 @@ FormUpdateNotify (
   )
 {
   mHiiPackageListUpdated = TRUE;
+  mDynamicFormUpdated = TRUE;
 
   return EFI_SUCCESS;
 }
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 82067b541c..f936a4b8e8 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -68,6 +68,7 @@ extern EFI_GUID        mCurrentFormSetGuid;
 extern EFI_HII_HANDLE  mCurrentHiiHandle;
 extern UINT16          mCurrentFormId;
 extern FORM_DISPLAY_ENGINE_FORM gDisplayFormData;
+extern BOOLEAN         mDynamicFormUpdated;
 
 /**
   Create a menu with specified formset GUID and form ID, and add it as a child
@@ -536,6 +537,7 @@ SendForm (
       }
       Selection->FormSet = FormSet;
       mSystemLevelFormSet = FormSet;
+      mDynamicFormUpdated = FALSE;
 
       //
       // Display this formset
@@ -547,7 +549,11 @@ SendForm (
       gCurrentSelection = NULL;
       mSystemLevelFormSet = NULL;
 
-      if (gFlagReconnect || gCallbackReconnect) {
+      //
+      // If callback update form dynamically, it's not exiting of the formset for user so system do not reconnect driver hanlde
+      // this time.
+      //
+      if (!mDynamicFormUpdated && (gFlagReconnect || gCallbackReconnect)) {
         RetVal = ReconnectController (FormSet->DriverHandle);
         if (!RetVal) {
           PopupErrorMessage(BROWSER_RECONNECT_FAIL, NULL, NULL, NULL);
-- 
2.23.0.windows.1


             reply	other threads:[~2020-05-20  4:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  4:24 Li, Walon [this message]
2020-05-24  7:17 ` [PATCH] MdeModulePkg/SetupBrowserDxe: Do not reconnect driver with form-update Dandan Bi
2020-06-03 10:55   ` Li, Walon
2020-06-08  7:16     ` Dandan Bi
2020-06-10  5:32       ` Dandan Bi
2020-06-10  5:49         ` Abner Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200520042447.1017-1-walon.li@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox