]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add sample code to show how to register Browser HotKey by BrowserEx protocol.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 29 Feb 2012 04:56:26 +0000 (04:56 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 29 Feb 2012 04:56:26 +0000 (04:56 +0000)
Signed-off-by: lgao4
Reviewed-by: ydong10
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13068 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni

index e7c1202ecfd7eacc68b2ce22a9627c356e428c2b..a76c86791a0fe3c98b9537cad47b5800c0691747 100644 (file)
@@ -2,7 +2,7 @@
 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 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, 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
@@ -1795,6 +1795,8 @@ DriverSampleInit (
   BOOLEAN                         ActionFlag;\r
   EFI_STRING                      ConfigRequestHdr;\r
   MY_EFI_VARSTORE_DATA            *VarStoreConfig;\r
+  EFI_INPUT_KEY                   HotKey;\r
+  EFI_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;\r
 \r
   //\r
   // Initialize the local variables.\r
@@ -2032,6 +2034,34 @@ DriverSampleInit (
         &mEvent\r
         );\r
   ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Example of how to use BrowserEx protocol to register HotKey.\r
+  // \r
+  Status = gBS->LocateProtocol (&gEfiFormBrowserExProtocolGuid, NULL, (VOID **) &FormBrowserEx);\r
+  if (!EFI_ERROR (Status)) {\r
+    //\r
+    // First unregister the default hot key F9 and F10.\r
+    //\r
+    HotKey.UnicodeChar = CHAR_NULL;\r
+    HotKey.ScanCode    = SCAN_F9;\r
+    FormBrowserEx->RegisterHotKey (&HotKey, 0, 0, NULL);\r
+    HotKey.ScanCode    = SCAN_F10;\r
+    FormBrowserEx->RegisterHotKey (&HotKey, 0, 0, NULL);\r
+    \r
+    //\r
+    // Register the default HotKey F9 and F10 again.\r
+    //\r
+    HotKey.ScanCode   = SCAN_F10;\r
+    NewString         = HiiGetString (PrivateData->HiiHandle[0], STRING_TOKEN (FUNCTION_TEN_STRING), NULL);\r
+    ASSERT (NewString != NULL);\r
+    FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_SUBMIT, 0, NewString);\r
+    HotKey.ScanCode   = SCAN_F9;\r
+    NewString         = HiiGetString (PrivateData->HiiHandle[0], STRING_TOKEN (FUNCTION_NINE_STRING), NULL);\r
+    ASSERT (NewString != NULL);\r
+    FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD, NewString);\r
+  }\r
+\r
   //\r
   // In default, this driver is built into Flash device image,\r
   // the following code doesn't run.\r
index 29f4611893ba99270f72a62fe4ba9291aaf4a4b4..07ace64852b6b64707d3937ee1169134ac4d9c26 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2012, 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
@@ -31,6 +31,7 @@ Revision History
 #include <Protocol/HiiConfigAccess.h>\r
 #include <Protocol/HiiDatabase.h>\r
 #include <Protocol/HiiString.h>\r
+#include <Protocol/FormBrowserEx.h>\r
 \r
 #include <Guid/MdeModuleHii.h>\r
 #include <Library/DebugLib.h>\r
index cffd2f351cafebbd7009190f507cec03bbbad364..bcc157442e97639ce11d0ce606a5064575e9496d 100644 (file)
@@ -2,7 +2,7 @@
 # This is a sample driver which show how HII protocol, VFR and UNI files are used to\r
 # create a driver which can be dipslayed and configured by a UEFI HII Form Browser.\r
 #\r
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2012, 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
@@ -69,7 +69,7 @@
   gEfiFormBrowser2ProtocolGuid                  ## CONSUMES\r
   gEfiHiiDatabaseProtocolGuid                   ## CONSUMES\r
   gEfiSimpleTextInputExProtocolGuid             ## CONSUMES\r
-\r
+  gEfiFormBrowserExProtocolGuid                 ## CONSUMES\r
 \r
 [Depex]\r
   gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid\r
index 98764d2408cb3ab6756e65d6e752864b0bfa2391..6693a9ec76263bb80ec63da4cacc7aa97551a072 100644 (file)
Binary files a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni and b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni differ