From patchwork Tue Jul 11 05:19:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 786475 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x69YB6Tpzz9s4q for ; Tue, 11 Jul 2017 15:26:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="bZxt4mAi"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="sSE4UcLY"; 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 3x69YB5LJ7zDqgD for ; Tue, 11 Jul 2017 15:26:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="bZxt4mAi"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="sSE4UcLY"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org X-Greylist: delayed 414 seconds by postgrey-1.36 at bilbo; Tue, 11 Jul 2017 15:26:14 AEST Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="bZxt4mAi"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="sSE4UcLY"; dkim-atps=neutral Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3x69Y22hdvzDqb4 for ; Tue, 11 Jul 2017 15:26:14 +1000 (AEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 3C3A419FE; Tue, 11 Jul 2017 01:19:14 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Tue, 11 Jul 2017 01:19:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=147x4j +P+cGHjYl+Rv6Uuj1KUU5yWbB8//55rbkBshE=; b=bZxt4mAiMeoyR1kKABsp7T Q4I3vaEAF2h4xU2cLO5yFebbtgchuc5aMrcdCDzCL+PVgdrZzYxb7TFbRK4cwQZD 38ajNPEg+9VczvEhY8bxRttq5DbVM4F8B0sdAzmxGvh8NpnpvHBcUgytLrjM4Kkx OvLQUReDmTrYaX7g0sB4E1i0cnwe4mgMjNIzEfFprvO8hufzJMY1RdY+N9WH2sm9 6sW6IMya2tAdGL6NmQLH4StKVRWXf36AlunakUuupA0qIrcKB7qVlwd83n6qU8Ox fJLoeleVylBTJbwjDuRrBptZygboFkgIu9AJsAKn85Mha40Yvt+WXQEDH1pgXZXQ == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=147x4j +P+cGHjYl+Rv6Uuj1KUU5yWbB8//55rbkBshE=; b=sSE4UcLYqj0RFvF+70ll05 QwsQzGzWfw5Hye7ZdlVrwwtHdR1fPLIbHkjmLGLDvY5J7bKq+j1jX1OAIhw4kJdZ y7+9Hi3zkM0pOOax6WzKFdDpc11NQW/YDv6SbiOnYmeHUt4VsJXBIL8TWp5jOGzH Hr8xr9fEQtLZWHe9fijW3KWryf+FTM63Mr27exrxv+ILbSlhYiSwlHJyFt8IZB0D nDZlishuo1ifzUAFThl+Ddnr+rJcIkOjB/LRpYJc5R9j14oqKd6ScjPwXfmk6WXf EKrgL6z3u654eUH0bvZ77FPCaS4xFxS5rpASCAOMScjz+ihYdf5oF51XqSiAPc0A == X-ME-Sender: X-Sasl-enc: ZlPW9RPBBFUrjh10fJWWmpK76QMBjYN0MOEZNSO82v8M 1499750353 Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id D38097E6A3; Tue, 11 Jul 2017 01:19:12 -0400 (EDT) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH] ui/ncurses: Periodically refresh display Date: Tue, 11 Jul 2017 15:19:08 +1000 Message-Id: <20170711051908.19301-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.13.2 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" When connecting to IPMI or serial consoles quite often the user must hit a key or exit and restart petitboot-nc to cause it to appear. This occurs when the user connects after petitboot-nc has drawn the current screen. This can be a little confusing to users, especially in text screens where keys such as 'Enter' won't have an affect. To add some user friendliness create a timer callback that every five seconds re-draws the current screen automatically. Signed-off-by: Samuel Mendoza-Jonas Acked-by: Stewart Smith --- ui/ncurses/nc-cui.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index fbc02b9..6332585 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -499,6 +499,25 @@ static int cui_process_js(void *arg) return 0; } +/* + * Refresh the current screen. This helps in cases where the user connects to a + * serial interface after the screen has already been drawn. + * Five seconds is a nice compromise between not having the user wait too long + * and over-stressing certain OEM's terrible IPMI implementations. + */ +static int cui_refresh_timeout(void *arg) +{ + struct cui *cui = cui_from_arg(arg); + + nc_scr_unpost(cui->current); + nc_scr_post(cui->current); + redrawwin(cui->current->main_ncw); + + waiter_register_timeout(cui->waitset, 5000, cui_refresh_timeout, cui); + + return 0; +} + /** * cui_handle_resize - Handle the term resize. */ @@ -1104,6 +1123,8 @@ retry_start: waiter_register_io(cui->waitset, STDIN_FILENO, WAIT_IN, cui_process_key, cui); + waiter_register_timeout(cui->waitset, 5000, cui_refresh_timeout, cui); + if (js_map) { cui->pjs = pjs_init(cui, js_map);