From patchwork Sat Jan 29 20:31:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1586258 X-Patchwork-Delegate: sjg@chromium.org 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=v1Omv/Mj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JmQx04tWhz9t3b for ; Sun, 30 Jan 2022 07:32:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B3FC88129B; Sat, 29 Jan 2022 21:32:11 +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="v1Omv/Mj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9617D8169D; Sat, 29 Jan 2022 21:32:09 +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.3 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-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) (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 2850F811B3 for ; Sat, 29 Jan 2022 21:32:07 +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-1.canonical.com (Postfix) with ESMTPSA id 0D44E41E2C; Sat, 29 Jan 2022 20:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1643488321; bh=oHJcGB2any/rPapWNR+ivbpzvLb0ry2XZbK5ewB6i5M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=v1Omv/Mj4T9YmrJrg9gZkVpPp9vaRMMPiXX1An/SPmBDF2wm6HCFqtf1ndRDcj57I 2vzOr1EDP3kvsiy60LwfyKUuQbnr10HCBqdb2wQxU3XKLL2Vvuy/AjExLVHcK7zvIv tRng/02F7CpEEWu15UDOCybvlrwfXSdW8ve1+dG9RFjpsA32AbI9RAb5nnuG/SKsaR 2K5yh+tm4NKwTZlFM7HDV1xxZIQqKbrb5skEXyRh/DNRYpIWYBTmbY+BfVzpME9eDO xTzIsXi58GQ1cxd7dGOw62KIy5IMNhJx18jCwE/5oKwrsrpxx/A7JY5dVHea+iR+vl oiDMMWK8mumUQ== From: Heinrich Schuchardt To: Tom Rini Cc: Simon Glass , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] cmd: add serial console support for the cls command Date: Sat, 29 Jan 2022 21:31:57 +0100 Message-Id: <20220129203157.301375-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.33.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. The cls command only needs a single printf() statement in most cases. This patch drops support for clearing the DM video without CONFIG_VIDEO_ANSI=y (which is enabled by default). Signed-off-by: Heinrich Schuchardt --- cmd/cls.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/cmd/cls.c b/cmd/cls.c index eab4e6993b..d58b0facbe 100644 --- a/cmd/cls.c +++ b/cmd/cls.c @@ -11,23 +11,18 @@ #include #include +#define ESC "\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; - - if (uclass_first_device_err(UCLASS_VIDEO, &dev)) - return CMD_RET_FAILURE; - - if (video_clear(dev)) - return CMD_RET_FAILURE; -#elif defined(CONFIG_CFB_CONSOLE) - video_clear(); -#elif defined(CONFIG_LCD) - lcd_clear(); -#else - return CMD_RET_FAILURE; + /* Send clear screen and home */ + printf(ESC "[2J" ESC "[1;1H"); +#if !defined(CONFIG_DM_VIDEO) && !defined(CONFIG_CFB_CONSOLE_ANSI) + if (CONFIG_IS_ENABLED(CFB_CONSOLE)) + video_clear(); + else if (CONFIG_IS_ENABLED(LCD) + lcd_clear(); #endif return CMD_RET_SUCCESS; }