Date
1 - 1 of 1
回复: [edk2-discuss] How to use `refreshguid` in VFR?
gaoliming
RefreshGuid event is required to trig by hand.
You can see the example in MdeModulePkg\Universal\DriverSampleDxe questionid 0x1247. Its OPEN call back calls InternalStopMonitor() to register CTRL + 'c' to trig refresh guid event.
Thanks
Liming
toggle quoted message
Show quoted text
You can see the example in MdeModulePkg\Universal\DriverSampleDxe questionid 0x1247. Its OPEN call back calls InternalStopMonitor() to register CTRL + 'c' to trig refresh guid event.
Thanks
Liming
-----邮件原件-----
发件人: discuss@edk2.groups.io <discuss@edk2.groups.io> 代表
Konstantin Aladyshev
发送时间: 2022年10月4日 0:06
收件人: discuss <discuss@edk2.groups.io>
主题: [edk2-discuss] How to use `refreshguid` in VFR?
Hello!
Can someone explain to me how to use the `refreshguid` keyword?
Currently in the VFR I have a `numeric` element.
I want to change it via the "action" button. For that I've put to its
"config" field a configuration string that changes `numeric` value to
3:
```
action
questionid = 0x6666,
prompt = STRING_TOKEN(BTN_STANDARD_DEFAULT_PROMPT),
help = STRING_TOKEN(BTN_STANDARD_DEFAULT_HELP),
flags = INTERACTIVE,
config = STRING_TOKEN(STR_CONFIG),
endaction;
```
The change works fine, but I can only see it in the form browser if I
re-open the form or set `refresh interval = <...>` on the numeric
element.
Refreshing by interval looks redundant, so I want to use "refreshguid"
functionality.
As I understand it, I need to add this opcode to the "numeric" element
and signal appropriate event in the action button callback handler. Am
I right?
This is how I've added "refreshguid" to the "numeric":
```
numeric
name = NumericQuestion,
varid = FormData.NumericValue,
prompt = STRING_TOKEN(NUMERIC_PROMPT),
help = STRING_TOKEN(NUMERIC_HELP),
flags = NUMERIC_SIZE_2 | DISPLAY_UINT_HEX | INTERACTIVE,
minimum = 0,
maximum = 10,
step = 1,
default = 7, defaultstore = StandardDefault,
default = 8, defaultstore = ManufactureDefault,
refreshguid = REFRESH_EVENT_GUID,
endnumeric;
```
And this is the code that I've added to my driver:
```
EFI_EVENT mEvent;
EFI_GUID RefreshEventGuid = REFRESH_EVENT_GUID;
STATIC
EFI_STATUS
EFIAPI
Callback ( ...)
{
if (QuestionId == 0x6666)
gBS->SignalEvent (mEvent);
return EFI_SUCCESS;
}
EFI_STATUS EntryPoint()
{
...
gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
EfiEventEmptyFunction,
NULL,
&RefreshEventGuid,
&mEvent
);
}
EFI_STATUS Unload ()
{
...
gBS->CloseEvent (mEvent);
}
```
But for some reason element refresh doesn't happen.
What did I do wrong?
I've tried to debug the issue and it looks like the Form Browser
recreates events on each user interaction. And the Callback code is
run when browser events are freed, but not recreated:
-FreeRefreshEvent
(MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c)
-Callback (My driver)
-CreateRefreshEventForStatement
(MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c)
So I'm a little confused. Does this functionality work in the current
EDKII version?
Best regards,
Konstantin Aladyshev