From patchwork Thu Feb 15 15:15:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 128478 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1857838ljc; Thu, 15 Feb 2018 07:15:46 -0800 (PST) X-Google-Smtp-Source: AH8x224+Cj+zXBJpMvXj0x3YIcrppgMBwmoyx23UREbSaNO/q2RjWP806yqQI6ZZVXidLRxStWhK X-Received: by 2002:a17:902:f:: with SMTP id 15-v6mr2792640pla.419.1518707746562; Thu, 15 Feb 2018 07:15:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518707746; cv=none; d=google.com; s=arc-20160816; b=g1jNc9h7GRfvng/Gnu2wgEjCjDooYFIEmn/8g5MxoJCirZaidMPm5iOWiOT8jTm2uY 3hrOBk7NA3oUWpaetfJIm/S8NRQ4DOxJ8AxGojV03QgPyicRmnHTiS8F5Tr91NJjWxr2 lPZylEG62G2xoTsjbKSeFkEt1QcPIQvtAp8bKh2pMNMnsqz6S+kgx/FZCOTFhO+EPARs S9X7auHGbtPnIKIYVtTuGAiKFIMHJwv/zqsmqLOa9UVX+niriYSDHY1fCFjO0ER3wkvR 5cbITD21qzN0KBW6TtmY32FBbQ10JWh+T3IGocM53oqmU1RSQmrkuUcO67EwULZ5TSRy dMaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=vYJx97yRyEWiPGMs+uYYGpb9Mb+rf9OueVX/c7KwP4Q=; b=yi20PQ/GZWnuLzTNepzzF+yQoCXhA9XD4O5uvvXTaQb90nWHjf2yprFX8FKldAnGvY 4E3nmHEd3TRi9LcqQICPd78binMU4aKcxKRgZMpJDdMemmLKLicct/5osozJuamTVz2q QyZfucRGsd+EqiVPAcrdK337c9WYG4ekAekBsT1AY8BOyrjsi293VoRNK2a9jVhGbkzN VcZNBm+aldTi3uxcRx3O/fMtL5SuHLTlCvL0Zt0jvlbEuTV0EzxD/7d+e0EiqvnwIl+Z tLWOJ5qZLEuf1eKWjtQJBDrcURB4OKO44FlhYWvsWLMAJFS1+nSPThYsYeF6UJZmIrWj KY4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cNI0yRDY; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id e89-v6si3230141plb.461.2018.02.15.07.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 07:15:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cNI0yRDY; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1A9DD220F33E4; Thu, 15 Feb 2018 07:09:53 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: Haojian Zhuang MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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); + } }