From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 381A8220F33CF for ; Thu, 15 Feb 2018 07:09:51 -0800 (PST) Received: by mail-pl0-x241.google.com with SMTP id k8so10549929pli.8 for ; Thu, 15 Feb 2018 07:15:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=sLOc139MVPn4vSmlawE0y/pumAaCHD6TnFttgTCrO7o=; b=cNI0yRDY9PNqQedWgq5WMjNez4N7RwOW68TZd6uLh7aChZ39oWAgSLGxTeuEJQiLdO KQExrCqn0Kh1T9N3jY8vHx5odG14CbuHmClN4RgYEmjWjtU4y9JsiVapByBlHQhSClHs k+1ZLbWAJ/OxztI7gdSk87IxkRicV5gAfphQc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sLOc139MVPn4vSmlawE0y/pumAaCHD6TnFttgTCrO7o=; b=cNUGoA8GxDoJjoJrV5uL4GEMASlhsVO8w51yIvTPK9BQsGMS4QlYr+DqEPpJtH3OfW si4AHg8fSqL5KC8zucHF94zITWcIzIq9AENrNE36gJvAq6VewLAjuVLpzQDF19QgHEk3 6TdPk95ICotBE/Q2uQ7saaticw0YpmWxP79bo5XMKpjXFt5pvc5bM5v+hFtP+1g1elqv fU999TzJW843uIEPcETca6IO4t3v95SeFt8Xm/Bprx1sGyHJeAxD1qwVd3FhoZh82yWW 3Mdjsxcoz5z1ZYunt5yYMZivHC63fUEbY15hgda30cU/TXdFd71VD8+FzAnDfhI2gt/1 3RYw== X-Gm-Message-State: APf1xPBV8Rinbkj3HZee2AwUSSsdHomDV/f1hBV9GUObGBqZ44VCTq0d Q5L3ZfprJTuC23MGa+Pmd/Atr0HBcyA= X-Google-Smtp-Source: AH8x225ZhAtsSidIHXdjiMduVw9kw/NM8FAp6BPSjn8m1hVTXcXH98Ztr0v/tW9cF0yfi6qfy7IDnw== X-Received: by 2002:a17:902:5305:: with SMTP id b5-v6mr2792709pli.61.1518707743630; Thu, 15 Feb 2018 07:15:43 -0800 (PST) Received: from localhost.localdomain ([64.64.108.76]) by smtp.gmail.com with ESMTPSA id a87sm41612849pfj.13.2018.02.15.07.15.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 07:15:42 -0800 (PST) From: Haojian Zhuang To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, linaro-uefi@lists.linaro.org Cc: Haojian Zhuang Date: Thu, 15 Feb 2018 23:15:33 +0800 Message-Id: <1518707733-17012-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [PATCH] ArmPkg/PlatformBootManagerLib: add hotkey to fastboot X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 15:09:51 -0000 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 --- 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