From patchwork Mon May 25 01:48:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1297043 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=85.214.62.61; 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=Lj2Yesi3; dkim-atps=neutral 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Vg5Q4F4Rz9sPF for ; Mon, 25 May 2020 11:50:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0EDE8812E7; Mon, 25 May 2020 03:49: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=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="Lj2Yesi3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1299C812FE; Mon, 25 May 2020 03:49:21 +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-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (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 E8DD580679 for ; Mon, 25 May 2020 03:49:11 +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-il1-x144.google.com with SMTP id 17so16085986ilj.3 for ; Sun, 24 May 2020 18:49:11 -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=7V8gl3ucDvGwg4qRKqpPI0OOlQw85TygLUaH5HqujXk=; b=Lj2Yesi3V6jkVLxa4ihXPGrAWAyINWvhACaOjd+YIyfSzDHixLSuIx0+VMSa/tWKuO jaD340MWS+rsYNF/627fsdrPUyi3ydg7mM1UzDSwwi9qG5BogTgBoyRA0m7A6TsFXDkn kcRWn84wMNECqWZpGdQNiqMUFb57E39/YtXxw= 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=7V8gl3ucDvGwg4qRKqpPI0OOlQw85TygLUaH5HqujXk=; b=HYw/xQ8HVKIYOCyhwY0qn3AaQ3J8wJl70Hh8mmo0SxD98Scxx0Z/XzuNOMmQb/N3Ox lazdkWSnCo6HhryOJ841Vg1dmCGUdaTL9CjKt8s7yTNr+2B5T+rmxDOL3CVtrAJFHM8M aTPjzd/66zsG54Vfzv/aCeqPZ8KzPrkig3ZBnpP0hJiXmqkrzHzKA3+N7GRd//xSDYBv G082AllfIXXaVw0xZIkptMEKUMuFF6zpVHQxAYyoF0Fc6QLa5rhebw3yUhRoaz7DaJNe QjOCxyNnP+61RwjCnoLg4TbT31Pn90AOD4OZ3L5kJEYENAT6+DIoM7BGqakzSZPBvyX5 RcWw== X-Gm-Message-State: AOAM531rq06Y/l2HKDGjSymsothbtRAp51AFxmJee+EPMvawO5yWAQSQ 1FJYGlQxHAztvJBYXNXoBoBJ5bBkDCiZdQ== X-Google-Smtp-Source: ABdhPJwO46KpoEMuAC+VVKidn0i2RCw3T258GM48o1wCOqGnzoMXFeFT/hWZMQUYdjRTLGIOn91KbQ== X-Received: by 2002:a92:c948:: with SMTP id i8mr23188344ilq.258.1590371350626; Sun, 24 May 2020 18:49:10 -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 s7sm6822965ioc.37.2020.05.24.18.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 18:49:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Anatolij Gustschin Subject: [PATCH v2 03/26] video: Show an error when a vidconsole function fails Date: Sun, 24 May 2020 19:48:40 -0600 Message-Id: <20200524194852.v2.3.I8c38c21ef51885e25a6245fb7e4f6ac5567d9937@changeid> X-Mailer: git-send-email 2.27.0.rc0.183.gde8f92d652-goog In-Reply-To: <20200525014904.115621-1-sjg@chromium.org> References: <20200525014904.115621-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- Changes in v2: None 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 d30e6db6f6..e06912cf36 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); }