This is an example of how a driver might export data to the HII protocol to be\r
later utilized by the Setup Protocol\r
\r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
DRIVER_SAMPLE_CONFIGURATION *Configuration;\r
MY_EFI_VARSTORE_DATA *EfiData;\r
EFI_FORM_ID FormId;\r
+ EFI_STRING Progress;\r
+ EFI_STRING Results;\r
+ UINT32 ProgressErr;\r
+ CHAR16 *TmpStr;\r
\r
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||\r
(ActionRequest == NULL)) {\r
\r
\r
FormId = 0;\r
+ ProgressErr = 0;\r
Status = EFI_SUCCESS;\r
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);\r
\r
//\r
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;\r
break;\r
+\r
+ case 0x1231:\r
+ //\r
+ // 1. Check to see whether system support keyword.\r
+ //\r
+ Status = PrivateData->HiiKeywordHandler->GetData (PrivateData->HiiKeywordHandler,\r
+ L"NAMESPACE=x-UEFI-ns",\r
+ L"KEYWORD=iSCSIBootEnable",\r
+ &Progress,\r
+ &ProgressErr,\r
+ &Results\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ do {\r
+ CreatePopUp (\r
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+ &Key,\r
+ L"",\r
+ L"This system not support this keyword!",\r
+ L"Press ENTER to continue ...",\r
+ L"",\r
+ NULL\r
+ );\r
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+\r
+ Status = EFI_SUCCESS;\r
+ break;\r
+ }\r
+\r
+ //\r
+ // 2. If system support this keyword, just try to change value.\r
+ //\r
\r
+ //\r
+ // Change value from '0' to '1' or from '1' to '0'\r
+ //\r
+ TmpStr = StrStr (Results, L"&VALUE=");\r
+ ASSERT (TmpStr != NULL);\r
+ TmpStr += StrLen (L"&VALUE=");\r
+ TmpStr++;\r
+ if (*TmpStr == L'0') {\r
+ *TmpStr = L'1';\r
+ } else {\r
+ *TmpStr = L'0';\r
+ }\r
+\r
+ //\r
+ // 3. Call the keyword handler protocol to change the value.\r
+ //\r
+ Status = PrivateData->HiiKeywordHandler->SetData (PrivateData->HiiKeywordHandler,\r
+ Results,\r
+ &Progress,\r
+ &ProgressErr\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ do {\r
+ CreatePopUp (\r
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+ &Key,\r
+ L"",\r
+ L"Set keyword to the system failed!",\r
+ L"Press ENTER to continue ...",\r
+ L"",\r
+ NULL\r
+ );\r
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+\r
+ Status = EFI_SUCCESS;\r
+ break;\r
+ }\r
+ break;\r
+\r
default:\r
break;\r
}\r
EFI_HII_STRING_PROTOCOL *HiiString;\r
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
+ EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;\r
CHAR16 *NewString;\r
UINTN BufferSize;\r
DRIVER_SAMPLE_CONFIGURATION *Configuration;\r
}\r
PrivateData->HiiConfigRouting = HiiConfigRouting;\r
\r
+ //\r
+ // Locate keyword handler protocol\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiConfigKeywordHandlerProtocolGuid, NULL, (VOID **) &HiiKeywordHandler);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ PrivateData->HiiKeywordHandler = HiiKeywordHandler;\r
+\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
&DriverHandle[0],\r
&gEfiDevicePathProtocolGuid,\r
&DriverHandle[1],\r
&gEfiDevicePathProtocolGuid,\r
&mHiiVendorDevicePath1,\r
+ &gEfiHiiConfigAccessProtocolGuid,\r
+ &PrivateData->ConfigAccess,\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
/** @file\r
\r
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <Protocol/HiiDatabase.h>\r
#include <Protocol/HiiString.h>\r
#include <Protocol/FormBrowserEx.h>\r
+#include <Protocol/HiiConfigKeyword.h>\r
\r
#include <Guid/MdeModuleHii.h>\r
#include <Library/DebugLib.h>\r
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;\r
EFI_HII_STRING_PROTOCOL *HiiString;\r
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
+ EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;\r
+\r
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
\r
//\r
# This driver shows how HII protocol, VFR and UNI files are used to create a HII \r
# driver which can be dipslayed and configured by a UEFI HII Form Browser.\r
#\r
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
gEfiHiiDatabaseProtocolGuid ## CONSUMES\r
gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES\r
gEfiFormBrowserExProtocolGuid ## CONSUMES\r
+ gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES\r
\r
[Depex]\r
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid\r
//\r
// Sample Setup formset.\r
//\r
-// Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
endoneof;\r
\r
oneof varid = MyIfrNVData.QuestionAboutTreeHugging,\r
- prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),\r
+ prompt = STRING_TOKEN(STR_ONE_OF_PROMPT_KEYWORD),\r
help = STRING_TOKEN(STR_ONE_OF_HELP),\r
flags = RESET_REQUIRED,\r
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = 0;\r