From patchwork Tue Jul 3 06:34:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 938403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41KZDP5hnGz9s2R for ; Tue, 3 Jul 2018 16:37:25 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="fD9zDlJr"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41KZDP1ztrzF1PD for ; Tue, 3 Jul 2018 16:37:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="fD9zDlJr"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41KZDG4SGlzF1LS for ; Tue, 3 Jul 2018 16:37:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="fD9zDlJr"; dkim-atps=neutral Received: by ozlabs.org (Postfix, from userid 1023) id 41KZDG2xt5z9s47; Tue, 3 Jul 2018 16:37:17 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1530599838; bh=h3MvKlaApuirAo3b6YdowqnilU10850yaZRdfjF7YG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fD9zDlJr9eggbAxeYir10M7jr8gkc62I04uHHkIIjwap3lxSLFLyWqzDK4AyWmTgX WdoGH+mrr6oSawSTZVVTlslNQQw5kCp4qN9DiFULc6NWJRqMlQ/BkvVv6f1imfOZN5 4avJIsGVcTS4bZcsUO+3BqaoV88NQb85Oe5Oe3nzKa8jQBDdjQIQKmdxWeMaWOIJo5 mu1bTZ3m+c7mH/FIIkqtrqyIAa57WM5xp81mgDuX5m3w62ZthU4fOg5VuO0x35Hzt/ 8Kjq+2AFzcYp3an/K5JzKq44NTQ6YnkLWzL5R71jLiBMVXXThtEItXTI4IvMo04oOX F1QLPLG0cr+fg== From: Jeremy Kerr To: petitboot@lists.ozlabs.org Subject: [PATCH 4/5] ui/ncurses: Implement non-boot-cancelling keys Date: Tue, 3 Jul 2018 16:34:46 +1000 Message-Id: <20180703063447.8338-5-jk@ozlabs.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180703063447.8338-1-jk@ozlabs.org> References: <20180703063447.8338-1-jk@ozlabs.org> X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yewei@inspur.com MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Allow some keys to not cancel the default-boot process. For the moment, this is just the screen refresh (ctrl+L). Signed-off-by: Jeremy Kerr --- ui/ncurses/nc-cui.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 8a3f97d..87540ca 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -527,6 +527,14 @@ struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr) return old; } +static bool key_cancels_boot(int key) +{ + if (key == 0xc) + return false; + + return true; +} + static bool process_global_keys(struct cui *cui, int key) { switch (key) { @@ -582,7 +590,7 @@ static int cui_process_key(void *arg) } } - if (!cui->has_input) { + if (!cui->has_input && key_cancels_boot(c)) { cui->has_input = true; if (cui->client) { pb_log("UI input received (key = %d), aborting "