mirror of https://github.com/acidanthera/audk.git
Old driver sample code does not return an EFI_UNSUPPORTED status code if a callback occurs for something which is unrecognized.
Now any call back type except:EFI_BROWSER_ACTION_FORM_OPEN, EFI_BROWSER_ACTION_FORM_CLOSE, EFI_BROWSER_ACTION_FROM_RETRIEVE and EFI_BROWSER_ACTION_FORM_CHANGING, all return EFI_UNSUPPORTED. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11518 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
411a3c3929
commit
4a22b9bc6a
|
@ -841,7 +841,18 @@ DriverCallback (
|
|||
DRIVER_SAMPLE_CONFIGURATION *Configuration;
|
||||
UINTN MyVarSize;
|
||||
|
||||
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
|
||||
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||
|
||||
(ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
|
||||
switch (Action) {
|
||||
case EFI_BROWSER_ACTION_FORM_OPEN:
|
||||
{
|
||||
if (QuestionId == 0x1234) {
|
||||
//
|
||||
// Sample CallBack for UEFI FORM_OPEN action:
|
||||
|
@ -882,10 +893,11 @@ DriverCallback (
|
|||
|
||||
HiiFreeOpCodeHandle (StartOpCodeHandle);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
|
||||
case EFI_BROWSER_ACTION_FORM_CLOSE:
|
||||
{
|
||||
if (QuestionId == 0x5678) {
|
||||
//
|
||||
// Sample CallBack for UEFI FORM_CLOSE action:
|
||||
|
@ -903,17 +915,32 @@ DriverCallback (
|
|||
);
|
||||
} while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
case EFI_BROWSER_ACTION_RETRIEVE:
|
||||
{
|
||||
if (QuestionId == 0x1111) {
|
||||
//
|
||||
// EfiVarstore question takes sample action (print value as debug information)
|
||||
// after read/write question.
|
||||
//
|
||||
MyVarSize = 1;
|
||||
Status = gRT->GetVariable(
|
||||
L"MyVar",
|
||||
&mFormSetGuid,
|
||||
NULL,
|
||||
&MyVarSize,
|
||||
&MyVar
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
DEBUG ((DEBUG_INFO, "EfiVarstore question: Tall value is %d with value width %d\n", MyVar, MyVarSize));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
|
||||
case EFI_BROWSER_ACTION_CHANGING:
|
||||
{
|
||||
switch (QuestionId) {
|
||||
case 0x1234:
|
||||
//
|
||||
|
@ -1214,6 +1241,13 @@ DriverCallback (
|
|||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = EFI_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue