mirror of https://github.com/acidanthera/audk.git
Add sample code to show how to register Browser HotKey by BrowserEx protocol.
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
This commit is contained in:
parent
7bbc624a7d
commit
2b826e217e
|
@ -2,7 +2,7 @@
|
||||||
This is an example of how a driver might export data to the HII protocol to be
|
This is an example of how a driver might export data to the HII protocol to be
|
||||||
later utilized by the Setup Protocol
|
later utilized by the Setup Protocol
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -1795,6 +1795,8 @@ DriverSampleInit (
|
||||||
BOOLEAN ActionFlag;
|
BOOLEAN ActionFlag;
|
||||||
EFI_STRING ConfigRequestHdr;
|
EFI_STRING ConfigRequestHdr;
|
||||||
MY_EFI_VARSTORE_DATA *VarStoreConfig;
|
MY_EFI_VARSTORE_DATA *VarStoreConfig;
|
||||||
|
EFI_INPUT_KEY HotKey;
|
||||||
|
EFI_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the local variables.
|
// Initialize the local variables.
|
||||||
|
@ -2032,6 +2034,34 @@ DriverSampleInit (
|
||||||
&mEvent
|
&mEvent
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Example of how to use BrowserEx protocol to register HotKey.
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (&gEfiFormBrowserExProtocolGuid, NULL, (VOID **) &FormBrowserEx);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// First unregister the default hot key F9 and F10.
|
||||||
|
//
|
||||||
|
HotKey.UnicodeChar = CHAR_NULL;
|
||||||
|
HotKey.ScanCode = SCAN_F9;
|
||||||
|
FormBrowserEx->RegisterHotKey (&HotKey, 0, 0, NULL);
|
||||||
|
HotKey.ScanCode = SCAN_F10;
|
||||||
|
FormBrowserEx->RegisterHotKey (&HotKey, 0, 0, NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register the default HotKey F9 and F10 again.
|
||||||
|
//
|
||||||
|
HotKey.ScanCode = SCAN_F10;
|
||||||
|
NewString = HiiGetString (PrivateData->HiiHandle[0], STRING_TOKEN (FUNCTION_TEN_STRING), NULL);
|
||||||
|
ASSERT (NewString != NULL);
|
||||||
|
FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_SUBMIT, 0, NewString);
|
||||||
|
HotKey.ScanCode = SCAN_F9;
|
||||||
|
NewString = HiiGetString (PrivateData->HiiHandle[0], STRING_TOKEN (FUNCTION_NINE_STRING), NULL);
|
||||||
|
ASSERT (NewString != NULL);
|
||||||
|
FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD, NewString);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// In default, this driver is built into Flash device image,
|
// In default, this driver is built into Flash device image,
|
||||||
// the following code doesn't run.
|
// the following code doesn't run.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -31,6 +31,7 @@ Revision History
|
||||||
#include <Protocol/HiiConfigAccess.h>
|
#include <Protocol/HiiConfigAccess.h>
|
||||||
#include <Protocol/HiiDatabase.h>
|
#include <Protocol/HiiDatabase.h>
|
||||||
#include <Protocol/HiiString.h>
|
#include <Protocol/HiiString.h>
|
||||||
|
#include <Protocol/FormBrowserEx.h>
|
||||||
|
|
||||||
#include <Guid/MdeModuleHii.h>
|
#include <Guid/MdeModuleHii.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# This is a sample driver which show how HII protocol, VFR and UNI files are used to
|
# This is a sample driver which show how HII protocol, VFR and UNI files are used to
|
||||||
# create a driver which can be dipslayed and configured by a UEFI HII Form Browser.
|
# create a driver which can be dipslayed and configured by a UEFI HII Form Browser.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
gEfiFormBrowser2ProtocolGuid ## CONSUMES
|
gEfiFormBrowser2ProtocolGuid ## CONSUMES
|
||||||
gEfiHiiDatabaseProtocolGuid ## CONSUMES
|
gEfiHiiDatabaseProtocolGuid ## CONSUMES
|
||||||
gEfiSimpleTextInputExProtocolGuid ## CONSUMES
|
gEfiSimpleTextInputExProtocolGuid ## CONSUMES
|
||||||
|
gEfiFormBrowserExProtocolGuid ## CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
|
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue