From patchwork Fri Jul 3 03:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1322038 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bon5vATI; dkim-atps=neutral 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yg5m5X0Xz9sR4 for ; Fri, 3 Jul 2020 13:13:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9680B81BB3; Fri, 3 Jul 2020 05:12:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bon5vATI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4EE5581B97; Fri, 3 Jul 2020 05:12:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8E0C281B6E for ; Fri, 3 Jul 2020 05:12:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id a12so31110103ion.13 for ; Thu, 02 Jul 2020 20:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ppYlddpIkDvwhghM08cMrzdufwd0HP64gFWGnhai5dY=; b=bon5vATIsBaPoFmuYDba9ET6S9hy4Rilfml+Y0qjnKDRpJpPp+R/p04nwolNk5C/N0 DX9lodSiier1Rwb6tklDtBoXTAi5MEBjSTu7XiXdYB7WxH5x9gLyAnJwaM4L1PIwQzFI vvYP6Y0jU/Z9N4cK2P0XprrtCuvzfSmsEswOs= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ppYlddpIkDvwhghM08cMrzdufwd0HP64gFWGnhai5dY=; b=oYq8OfAcZWJTko5zE09tXus0A5FWnFkX3s6iAACLhrl8OFrcJFMC86UB7Y0HtkQwXU URUOXXhCojIQg2exd55BV9DbPHFGKPbnDcSiqG8m4Pg60Mn5H8do9ZGVlT1FNSskXqcs 0bwxJXIWE6addy/tPpevGEy4fWs5jmGMETUZd7DIMQubtIYBwN2NWmAG/Ki9eqEqDrBz eNyMmuta303Qd9y2mHXjiWxcdUSROr7qQIS2dCkQeZDGwarFH8PxbvbaAbb8vI6LDwDP hk78lHtRkuoUxCRxeQPaJDmmplkZmfkwymVqbX84kwGDmjVLsKhxsaJN0qCXSkzXleDS NwGw== X-Gm-Message-State: AOAM530dpuW2KhpXJMcktynkPuRZZWAVhTHpmZTcEZf1MRhLDrAB1+wQ PPHNPOXc/Zi22Oe6d8zkr13zAg== X-Google-Smtp-Source: ABdhPJxmXE9UEYJEdOLH4FlllnjzejnqmKvKyaWxVgGowVAfwY+0omkO+p5Lk8fAWhmHWFshJUQTCQ== X-Received: by 2002:a02:5e88:: with SMTP id h130mr38041876jab.116.1593745966358; Thu, 02 Jul 2020 20:12:46 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id c16sm5859654ilh.54.2020.07.02.20.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 20:12:46 -0700 (PDT) From: Simon Glass To: Bin Meng Cc: Simon Glass , Anatolij Gustschin , u-boot@lists.denx.de Subject: [RESEND PATCH v3 03/26] video: Show an error when a vidconsole function fails Date: Thu, 2 Jul 2020 21:12:14 -0600 Message-Id: <20200702211204.RESEND.v3.3.I8c38c21ef51885e25a6245fb7e4f6ac5567d9937@changeid> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog In-Reply-To: <20200703031237.1546362-1-sjg@chromium.org> References: <20200703031237.1546362-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present these functions fail silently even when debugging, which is not very helpful. Add a way to print a message to the serial output when an error is detected. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- (no changes since v1) drivers/video/vidconsole-uclass.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 3f20f70e9a..841cfdaf93 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -9,12 +9,13 @@ #include #include +#include #include -#include #include #include #include #include /* Bitmap font for code page 437 */ +#include /* * Structure to describe a console color @@ -556,16 +557,31 @@ int vidconsole_put_string(struct udevice *dev, const char *str) static void vidconsole_putc(struct stdio_dev *sdev, const char ch) { struct udevice *dev = sdev->priv; + int ret; - vidconsole_put_char(dev, ch); + ret = vidconsole_put_char(dev, ch); + if (ret) { +#ifdef DEBUG + console_puts_select_stderr(true, "[vc err: putc]"); +#endif + } video_sync(dev->parent, false); } static void vidconsole_puts(struct stdio_dev *sdev, const char *s) { struct udevice *dev = sdev->priv; + int ret; + + ret = vidconsole_put_string(dev, s); + if (ret) { +#ifdef DEBUG + char str[30]; - vidconsole_put_string(dev, s); + snprintf(str, sizeof(str), "[vc err: puts %d]", ret); + console_puts_select_stderr(true, str); +#endif + } video_sync(dev->parent, false); }