From patchwork Fri Feb 11 17:11:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1591741 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=gKVBKb5Y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JwKs72lvrz9s5B for ; Sat, 12 Feb 2022 04:11:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 64D9C83BD2; Fri, 11 Feb 2022 18:11:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="gKVBKb5Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 49C5C83BB4; Fri, 11 Feb 2022 18:11:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 99E3083A37 for ; Fri, 11 Feb 2022 18:11:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-144-107.um26.pools.vodafone-ip.de [88.152.144.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 5F74D40000; Fri, 11 Feb 2022 17:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1644599473; bh=bmHGS49dUqXySoBEZfFxaxhHuEyXh7y3+zzdB05zlbg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gKVBKb5YtpqPxlWLu07L3k1cBDRfdGYarzFGlBKq2sYg65FLOs6iiA2uw3wZqDozu bD/NRdGPWgiFDlno+HnF38b1tLqNW/5g7Dff2f9Lk+Wvs10krN0IwFBbKK2JSGf7tq jci2tjq2T85R16KIgYqx6oYCZj6Xxph0bS41CxgqtU56EyvF5TNYuEHiTjY7vT/Eho 98gs9CCD+k3Fzar/SMxaZbczEswjS85ppZgxDRAhZVGKtQdZZdjVO9gjJtI07zg/Hq 2Gx898sAjTM2+XxtZNOCAjG0m65qQLMTktadUJx+DRFb5sNMA6jnvSbTrmrRX8kcJ5 3W5U2aT+HmSEw== From: Heinrich Schuchardt To: Tom Rini Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v2 1/1] cmd: add serial console support for the cls command Date: Fri, 11 Feb 2022 18:11:05 +0100 Message-Id: <20220211171105.26189-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Currently the cls command does not support the serial console The screen can be cleared in the video uclass, the colored frame buffer console, and the serial console by sending the same escape sequence. This reduces the cls command to a single printf() statement on most boards. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- v2: support cls with CONFIG_DM_VIDEO=y and CONFIG_VIDEO_ANSI=n --- cmd/cls.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/cls.c b/cmd/cls.c index eab4e6993b..b411fc1eb1 100644 --- a/cmd/cls.c +++ b/cmd/cls.c @@ -11,12 +11,16 @@ #include #include +#define CSI "\x1b[" + static int do_video_clear(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { -#if defined(CONFIG_DM_VIDEO) - struct udevice *dev; + __maybe_unused struct udevice *dev; + /* Send clear screen and home */ + printf(CSI "2J" CSI "1;1H"); +#if defined(CONFIG_DM_VIDEO) && !defined(CONFIG_VIDEO_ANSI) if (uclass_first_device_err(UCLASS_VIDEO, &dev)) return CMD_RET_FAILURE;