From 9bbae45f212ef39066030fc659f983673ea78096 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sat, 1 Feb 2020 15:06:46 +0300 Subject: [PATCH] OcBootManagementLib: Implement TakeoffDelay support --- Include/Library/OcBootManagementLib.h | 4 ++++ Include/Library/OcConfigurationLib.h | 1 + Library/OcBootManagementLib/BootEntryInfo.c | 3 ++- Library/OcBootManagementLib/HotKeySupport.c | 4 ++++ Library/OcConfigurationLib/OcConfigurationLib.c | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Include/Library/OcBootManagementLib.h b/Include/Library/OcBootManagementLib.h index 05eada66..6b4d90cd 100755 --- a/Include/Library/OcBootManagementLib.h +++ b/Include/Library/OcBootManagementLib.h @@ -369,6 +369,10 @@ typedef struct { // UINT32 TimeoutSeconds; // + // Default delay prior to handling hotkeys (pass 0 to ignore). + // + UINT32 TakeoffDelay; + // // Define picker behaviour. // For example, show boot menu or just boot the default option. // diff --git a/Include/Library/OcConfigurationLib.h b/Include/Library/OcConfigurationLib.h index 7c300ace..716209a8 100644 --- a/Include/Library/OcConfigurationLib.h +++ b/Include/Library/OcConfigurationLib.h @@ -270,6 +270,7 @@ _(BOOLEAN , PollAppleHotKeys , , FALSE , ()) \ _(BOOLEAN , ShowPicker , , FALSE , ()) \ _(BOOLEAN , UsePicker , , FALSE , ()) \ + _(UINT32 , TakeoffDelay , , 0 , ()) \ _(UINT32 , Timeout , , 0 , ()) \ _(OC_STRING , HibernateMode , , OC_STRING_CONSTR ("None", _, __), OC_DESTR (OC_STRING)) \ _(OC_STRING , Resolution , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \ diff --git a/Library/OcBootManagementLib/BootEntryInfo.c b/Library/OcBootManagementLib/BootEntryInfo.c index 9aa74d24..d574aa9d 100644 --- a/Library/OcBootManagementLib/BootEntryInfo.c +++ b/Library/OcBootManagementLib/BootEntryInfo.c @@ -576,7 +576,8 @@ InternalFillValidBootEntries ( DEBUG (( DEBUG_BULK_INFO, - "OCB: Adding entry %u recovery (%s) - %r\n", + "OCB: Adding entry %u, external - %u, recovery (%s) - %r\n", + (UINT32) EntryIndex, DevPathScanInfo->IsExternal, RecoveryPath != NULL ? RecoveryPath : L"", Status diff --git a/Library/OcBootManagementLib/HotKeySupport.c b/Library/OcBootManagementLib/HotKeySupport.c index 411b00e4..b3de2e0a 100644 --- a/Library/OcBootManagementLib/HotKeySupport.c +++ b/Library/OcBootManagementLib/HotKeySupport.c @@ -45,6 +45,10 @@ OcLoadPickerHotKeys ( BOOLEAN HasKeyR; BOOLEAN HasKeyX; + if (Context->TakeoffDelay > 0) { + gBS->Stall (Context->TakeoffDelay); + } + Status = gBS->LocateProtocol ( &gAppleKeyMapAggregatorProtocolGuid, NULL, diff --git a/Library/OcConfigurationLib/OcConfigurationLib.c b/Library/OcConfigurationLib/OcConfigurationLib.c index 3a8e4adc..02a7c6a7 100644 --- a/Library/OcConfigurationLib/OcConfigurationLib.c +++ b/Library/OcConfigurationLib/OcConfigurationLib.c @@ -323,6 +323,7 @@ mMiscConfigurationBootSchema[] = { OC_SCHEMA_BOOLEAN_IN ("PollAppleHotKeys", OC_GLOBAL_CONFIG, Misc.Boot.PollAppleHotKeys), OC_SCHEMA_STRING_IN ("Resolution", OC_GLOBAL_CONFIG, Misc.Boot.Resolution), OC_SCHEMA_BOOLEAN_IN ("ShowPicker", OC_GLOBAL_CONFIG, Misc.Boot.ShowPicker), + OC_SCHEMA_INTEGER_IN ("TakeoffDelay", OC_GLOBAL_CONFIG, Misc.Boot.TakeoffDelay), OC_SCHEMA_INTEGER_IN ("Timeout", OC_GLOBAL_CONFIG, Misc.Boot.Timeout), OC_SCHEMA_BOOLEAN_IN ("UsePicker", OC_GLOBAL_CONFIG, Misc.Boot.UsePicker), };