* [PATCH] ArmPkg/PlatformBootManagerLib: add hotkey to fastboot
@ 2018-02-15 15:15 Haojian Zhuang
0 siblings, 0 replies; only message in thread
From: Haojian Zhuang @ 2018-02-15 15:15 UTC (permalink / raw)
To: edk2-devel, leif.lindholm, ard.biesheuvel, linaro-uefi; +Cc: Haojian Zhuang
It checkes whether AndroidFastbootApp exists in boot menu.
If it exists, add hotkey 'F' to AndroidFastbootApp.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 61ab61c..54c297c 100644
--- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -389,6 +389,31 @@ PlatformRegisterFvBootOption (
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
}
+STATIC
+UINTN
+PlatformFindBootOptionByDescription (
+ IN CHAR16 *Description
+ )
+{
+ UINTN BootOptionCount;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN Index;
+ UINTN OptionIndex;
+
+ OptionIndex = LoadOptionNumberUnassigned;
+ BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
+
+ for (Index = 0; Index < BootOptionCount; Index++) {
+ if (StrnCmp (Description, BootOptions[Index].Description, StrLen (BootOptions[Index].Description)) == 0) {
+ OptionIndex = BootOptions[Index].OptionNumber;
+ break;
+ }
+ }
+
+ EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
+ return OptionIndex;
+}
+
STATIC
VOID
@@ -400,7 +425,9 @@ PlatformRegisterOptionsAndKeys (
EFI_INPUT_KEY Enter;
EFI_INPUT_KEY F2;
EFI_INPUT_KEY Esc;
+ EFI_INPUT_KEY KeyF;
EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
+ UINTN OptionNumber;
//
// Register ENTER as CONTINUE key
@@ -427,6 +454,19 @@ PlatformRegisterOptionsAndKeys (
NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
);
ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
+
+ //
+ // Map F to "Android Fastboot App"
+ //
+ KeyF.ScanCode = SCAN_NULL;
+ KeyF.UnicodeChar = 'f';
+ OptionNumber = PlatformFindBootOptionByDescription (L"Android Fastboot");
+ if (OptionNumber != LoadOptionNumberUnassigned) {
+ Status = EfiBootManagerAddKeyOptionVariable (
+ NULL, (UINT16) OptionNumber, 0, &KeyF, NULL
+ );
+ ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
+ }
}
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-15 15:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15 15:15 [PATCH] ArmPkg/PlatformBootManagerLib: add hotkey to fastboot Haojian Zhuang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox