Hi:
To get current user configuration, FormBrowser2 BrowserCallback() can be used
for it. No other way can be used to get it unless user configuration has been
saved.
For your logic, Callback() logic will be trigged when numeric question value
is changed. Here, the question value has not saved into variable. GetVariable
still gets original value. After Callback(), you return FORM_APPLY action, then
Browser will save value into EFI variable. You don't need to call Init() to set
its value.
Thanks
Liming
From: Валерий Бицоев [mailto:valne...@gmail.com]
Sent: Monday, July 22, 2013 8:06 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] Issue with getting data from HII form
Hello.
I'am trying to use HII forms to get configuration from the users.
Unfortunately, in my UEFI function EFI_FORM_BROWSER2_PROTOCOL::BrowserCallback
isn't realized, so i using EFI varstore. But after setting variables values in
the form doesn't change (I read it throught gRT->GetVariable). In what could be
the problem?
vfr file:
<..>
efivarstore UINT8,
varid = VARSTORE_ID,
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS| EFI_VARIABLE_RUNTIME_ACCESS ,
name = testvar,
guid = FORMSET_GUID;
numeric varid = testvar,
prompt = STRING_TOKEN(0x01),
help = STRING_TOKEN(0x02),
flags = INTERACTIVE,
key = MASK_ACT,
minimum = 0,
maximum = 0xf0,
step = 0,
default = 21,
endnumeric;
<..>
Callback function:
EFI_STATUS Status = EFI_SUCCESS;
switch (Action)
{
case EFI_BROWSER_ACTION_CHANGED:
switch (QuestionId)
{
case MASK_ACT:
UINTN size = sizeof(UINT8);
integer = 0;
EFI_STATUS s = gRT->GetVariable((CHAR16*) L"testvar",
(EFI_GUID*)&driverHiiPackageGuid, 0, (UINTN*)&size ,&integer);
if (!EFI_ERROR(s))
{
printf("Success\n");
printf("Int: %d", integer);
}
else
{
printf("Fail: %ld\n", (long int) s) ;
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
default:
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
break;
}
break;
case EFI_BROWSER_ACTION_FORM_CLOSE:
case EFI_BROWSER_ACTION_CHANGING:
case EFI_BROWSER_ACTION_FORM_OPEN:
case EFI_BROWSER_ACTION_RETRIEVE:
case EFI_BROWSER_ACTION_DEFAULT_STANDARD:
case EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING:
case EFI_BROWSER_ACTION_DEFAULT_SAFE:
case EFI_BROWSER_ACTION_DEFAULT_PLATFORM:
case EFI_BROWSER_ACTION_DEFAULT_HARDWARE:
case EFI_BROWSER_ACTION_DEFAULT_FIRMWARE:
default:
Status = EFI_UNSUPPORTED;
break;
}
return Status;
Init fuction:
<..>
UINT8 integer = 8;
gRT->SetVariable((CHAR16*) L"testvar", (EFI_GUID*)&driverHiiPackageGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS |EFI_VARIABLE_RUNTIME_ACCESS , sizeof(UINT8) ,
&integer);
<..>
--
Thanks,
Valery
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel