From nobody Tue May 7 01:29:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1518708992645883.9240586479339; Thu, 15 Feb 2018 07:36:32 -0800 (PST) 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) 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) 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) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.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 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) 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/Li= brary/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); } =20 +STATIC +UINTN +PlatformFindBootOptionByDescription ( + IN CHAR16 *Description + ) +{ + UINTN BootOptionCount; + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; + UINTN Index; + UINTN OptionIndex; + + OptionIndex =3D LoadOptionNumberUnassigned; + BootOptions =3D EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOpti= onTypeBoot); + + for (Index =3D 0; Index < BootOptionCount; Index++) { + if (StrnCmp (Description, BootOptions[Index].Description, StrLen (Boot= Options[Index].Description)) =3D=3D 0) { + OptionIndex =3D BootOptions[Index].OptionNumber; + break; + } + } + + EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); + return OptionIndex; +} + =20 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; =20 // // Register ENTER as CONTINUE key @@ -427,6 +454,19 @@ PlatformRegisterOptionsAndKeys ( NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL ); ASSERT (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_ALREADY_STARTED); + + // + // Map F to "Android Fastboot App" + // + KeyF.ScanCode =3D SCAN_NULL; + KeyF.UnicodeChar =3D 'f'; + OptionNumber =3D PlatformFindBootOptionByDescription (L"Android Fastboot= "); + if (OptionNumber !=3D LoadOptionNumberUnassigned) { + Status =3D EfiBootManagerAddKeyOptionVariable ( + NULL, (UINT16) OptionNumber, 0, &KeyF, NULL + ); + ASSERT (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_ALREADY_STARTED= ); + } } =20 =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel