Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813649/?format=api
{ "id": 813649, "url": "http://patchwork.ozlabs.org/api/patches/813649/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170913221227.21091-3-robdclark@gmail.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170913221227.21091-3-robdclark@gmail.com>", "list_archive_url": null, "date": "2017-09-13T22:12:21", "name": "[U-Boot,2/3] dm: video: Add basic ANSI escape sequence support", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f8ac9f34a68cdaa65135abddf35620a30443cf80", "submitter": { "id": 18760, "url": "http://patchwork.ozlabs.org/api/people/18760/?format=api", "name": "Rob Clark", "email": "robdclark@gmail.com" }, "delegate": { "id": 1700, "url": "http://patchwork.ozlabs.org/api/users/1700/?format=api", "username": "ag", "first_name": "Anatolij", "last_name": "Gustschin", "email": "agust@denx.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170913221227.21091-3-robdclark@gmail.com/mbox/", "series": [ { "id": 2992, "url": "http://patchwork.ozlabs.org/api/series/2992/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2992", "date": "2017-09-13T22:12:21", "name": "dm: video: enhancements for Shell.efi", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2992/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813649/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813649/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ao1dqhBU\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xswxl4fL4z9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 08:16:59 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 64493C22734; Wed, 13 Sep 2017 22:15:42 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 4194DC226F1;\n\tWed, 13 Sep 2017 22:15:39 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid CF74EC226EC; Wed, 13 Sep 2017 22:12:45 +0000 (UTC)", "from mail-qt0-f196.google.com (mail-qt0-f196.google.com\n\t[209.85.216.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 581AAC225FA\n\tfor <u-boot@lists.denx.de>; Wed, 13 Sep 2017 22:12:39 +0000 (UTC)", "by mail-qt0-f196.google.com with SMTP id q8so956225qtb.1\n\tfor <u-boot@lists.denx.de>; Wed, 13 Sep 2017 15:12:39 -0700 (PDT)", "from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\tm126sm9872979qkd.52.2017.09.13.15.12.36\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 13 Sep 2017 15:12:36 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=6aYzn8t2pRojHu/tD/wxkbPdEm4nfbOHbDAbS+PeC9k=;\n\tb=ao1dqhBUBznzz3W3//116f6tv+B0+cZ9vRIIYolWS9U8RVQHqNsYpnR+GK5DPbOSHP\n\t2iteKrII0xP/cwqJsi272zNSNn4A7/XCvmrNmXfWdNKrJgZMIiCFARbgyeX+B6F4Abmf\n\t81fHxRKC54v1A64SQHNrvR+0NsR4AFLX67W/WE6VU3eI3Hw+XxGMzZiG8fJM3hyb/753\n\t9jb7ODUX3FmMJWzhbQIG1kxI2X7v/oRkfPj5iChJv2PMb/zHYi1L/0tacaB6P9Xc8/Mi\n\tEO1mrv3KOtF4mpGGpLZJyXm4r9sea/rSl7cuqNAmZw36bS0sWoyuMDSvwcxXpwPn/nq3\n\tkAvw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=6aYzn8t2pRojHu/tD/wxkbPdEm4nfbOHbDAbS+PeC9k=;\n\tb=JkRq2X4ROmgKV99TeZZzUnC1i3SlR5qT5Vd1cY0lMQQ7X3EL58dYTZf4pOMOz4WHrd\n\tk+UiNPUE8HjJ8lphlu62g2jfBjJgoT1UTPXIy0IU57dv0CHXxNW3K0D4S04oU4kiYCkN\n\tvAU60ZQe1k1DHRGusKjpHUtE4KNg0wbmqf8SJP2NdOffXxQogjvVVPYYPKKgP5lDZDiu\n\tG+U7kKVprQhIj3fzUJn+eH5uRd5jL8655nbUQvGxkXoBhkzsyZhIUnOrfiU1YcOr21NO\n\tNUTj+oSelNYJ4QdlBUTV0tbg3eMhS/Rs9J1k8ipDZdUCXEe/flqGcWJXr011mD9h9tg1\n\t1row==", "X-Gm-Message-State": "AHPjjUhkcojSuR/Dmjv96524x0+2VPuDOARJrEq311jdowhrayhYMWsL\n\tmiydbhC7Q6LpRE8+C1g=", "X-Google-Smtp-Source": "AOwi7QB9tX0BKzGhTroyeEPaWvjS0I48tMmNDGdVcsCtPG5HkzY44gQRDuxiOZ3xNxfH8oi0sz9qcg==", "X-Received": "by 10.237.33.188 with SMTP id l57mr14103257qtc.270.1505340757964;\n\tWed, 13 Sep 2017 15:12:37 -0700 (PDT)", "From": "Rob Clark <robdclark@gmail.com>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Wed, 13 Sep 2017 18:12:21 -0400", "Message-Id": "<20170913221227.21091-3-robdclark@gmail.com>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170913221227.21091-1-robdclark@gmail.com>", "References": "<20170913221227.21091-1-robdclark@gmail.com>", "Subject": "[U-Boot] [PATCH 2/3] dm: video: Add basic ANSI escape sequence\n\tsupport", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "Really just the subset that is needed by efi_console. Perhaps more will\nbe added later, for example color support would be useful to implement\nefi_cout_set_attribute().\n\nSigned-off-by: Rob Clark <robdclark@gmail.com>\n---\n drivers/video/Kconfig | 8 +++\n drivers/video/vidconsole-uclass.c | 109 ++++++++++++++++++++++++++++++++++++++\n drivers/video/video-uclass.c | 4 +-\n include/video.h | 7 +++\n include/video_console.h | 11 ++++\n 5 files changed, 136 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig\nindex 082cc4a528..add156cb70 100644\n--- a/drivers/video/Kconfig\n+++ b/drivers/video/Kconfig\n@@ -44,6 +44,14 @@ config VIDEO_BPP32\n \t this option, such displays will not be supported and console output\n \t will be empty.\n \n+config VIDEO_ANSI\n+\tbool \"Support ANSI escape sequences in video console\"\n+\tdepends on DM_VIDEO\n+\tdefault y if DM_VIDEO\n+\thelp\n+\t Enable ANSI escape sequence decoding for a more fully functional\n+\t console.\n+\n config CONSOLE_NORMAL\n \tbool \"Support a simple text console\"\n \tdepends on DM_VIDEO\ndiff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c\nindex e081d5a0ee..0a88cc0a42 100644\n--- a/drivers/video/vidconsole-uclass.c\n+++ b/drivers/video/vidconsole-uclass.c\n@@ -9,6 +9,7 @@\n */\n \n #include <common.h>\n+#include <linux/ctype.h>\n #include <dm.h>\n #include <video.h>\n #include <video_console.h>\n@@ -107,12 +108,120 @@ static void vidconsole_newline(struct udevice *dev)\n \tvideo_sync(dev->parent);\n }\n \n+static char *parsenum(char *s, int *num)\n+{\n+\tchar *end;\n+\t*num = simple_strtol(s, &end, 10);\n+\treturn end;\n+}\n+\n+/*\n+ * Process a character while accumulating an escape string. Chars are\n+ * accumulated into escape_buf until the end of escape sequence is\n+ * found, at which point the sequence is parsed and processed.\n+ */\n+static void vidconsole_escape_char(struct udevice *dev, char ch)\n+{\n+\tstruct vidconsole_priv *priv = dev_get_uclass_priv(dev);\n+\n+\tif (!IS_ENABLED(CONFIG_VIDEO_ANSI))\n+\t\tgoto error;\n+\n+\t/* Sanity checking for bogus ESC sequences: */\n+\tif (priv->escape_len >= sizeof(priv->escape_buf))\n+\t\tgoto error;\n+\tif (priv->escape_len == 0 && ch != '[')\n+\t\tgoto error;\n+\n+\tpriv->escape_buf[priv->escape_len++] = ch;\n+\n+\t/*\n+\t * Escape sequences are terminated by a letter, so keep\n+\t * accumulating until we get one:\n+\t */\n+\tif (!isalpha(ch))\n+\t\treturn;\n+\n+\t/*\n+\t * clear escape mode first, otherwise things will get highly\n+\t * surprising if you hit any debug prints that come back to\n+\t * this console.\n+\t */\n+\tpriv->escape = 0;\n+\n+\tswitch (ch) {\n+\tcase 'H':\n+\tcase 'f': {\n+\t\tint row, col;\n+\t\tchar *s = priv->escape_buf;\n+\n+\t\t/*\n+\t\t * Set cursor position: [%d;%df or [%d;%dH\n+\t\t */\n+\t\ts++; /* [ */\n+\t\ts = parsenum(s, &row);\n+\t\ts++; /* ; */\n+\t\ts = parsenum(s, &col);\n+\n+\t\tpriv->ycur = row * priv->y_charsize;\n+\t\tpriv->xcur_frac = priv->xstart_frac +\n+\t\t\tVID_TO_POS(col * priv->x_charsize);\n+\n+\t\tbreak;\n+\t}\n+\tcase 'J': {\n+\t\tint mode;\n+\n+\t\t/*\n+\t\t * Clear part/all screen:\n+\t\t * [J or [0J - clear screen from cursor down\n+\t\t * [1J - clear screen from cursor up\n+\t\t * [2J - clear entire screen\n+\t\t *\n+\t\t * TODO we really only handle entire-screen case, others\n+\t\t * probably require some additions to video-uclass (and\n+\t\t * are not really needed yet by efi_console)\n+\t\t */\n+\t\tparsenum(priv->escape_buf + 1, &mode);\n+\n+\t\tif (mode == 2) {\n+\t\t\tvideo_clear(dev->parent);\n+\t\t\tvideo_sync(dev->parent);\n+\t\t\tpriv->ycur = 0;\n+\t\t\tpriv->xcur_frac = priv->xstart_frac;\n+\t\t} else {\n+\t\t\tdebug(\"unsupported clear mode: %d\\n\", mode);\n+\t\t}\n+\t\tbreak;\n+\t}\n+\tdefault:\n+\t\tdebug(\"unrecognized escape sequence: %*s\\n\",\n+\t\t priv->escape_len, priv->escape_buf);\n+\t}\n+\n+\treturn;\n+\n+error:\n+\t/* something went wrong, just revert to normal mode: */\n+\tpriv->escape = 0;\n+\treturn;\n+}\n+\n int vidconsole_put_char(struct udevice *dev, char ch)\n {\n \tstruct vidconsole_priv *priv = dev_get_uclass_priv(dev);\n \tint ret;\n \n+\tif (priv->escape) {\n+\t\tvidconsole_escape_char(dev, ch);\n+\t\treturn 0;\n+\t}\n+\n \tswitch (ch) {\n+\tcase '\\x1b':\n+\t\tpriv->escape_len = 0;\n+\t\tpriv->escape = 1;\n+\t\tbreak;\n \tcase '\\a':\n \t\t/* beep */\n \t\tbreak;\ndiff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c\nindex 3036e3a1f2..0163039821 100644\n--- a/drivers/video/video-uclass.c\n+++ b/drivers/video/video-uclass.c\n@@ -87,7 +87,7 @@ int video_reserve(ulong *addrp)\n \treturn 0;\n }\n \n-static int video_clear(struct udevice *dev)\n+void video_clear(struct udevice *dev)\n {\n \tstruct video_priv *priv = dev_get_uclass_priv(dev);\n \n@@ -100,8 +100,6 @@ static int video_clear(struct udevice *dev)\n \t} else {\n \t\tmemset(priv->fb, priv->colour_bg, priv->fb_size);\n \t}\n-\n-\treturn 0;\n }\n \n /* Flush video activity to the caches */\ndiff --git a/include/video.h b/include/video.h\nindex 5b4e78b182..61ff653121 100644\n--- a/include/video.h\n+++ b/include/video.h\n@@ -115,6 +115,13 @@ struct video_ops {\n int video_reserve(ulong *addrp);\n \n /**\n+ * video_clear() - Clear a device's frame buffer to background color.\n+ *\n+ * @dev:\tDevice to clear\n+ */\n+void video_clear(struct udevice *dev);\n+\n+/**\n * video_sync() - Sync a device's frame buffer with its hardware\n *\n * Some frame buffers are cached or have a secondary frame buffer. This\ndiff --git a/include/video_console.h b/include/video_console.h\nindex 26047934da..9dce234bd9 100644\n--- a/include/video_console.h\n+++ b/include/video_console.h\n@@ -29,6 +29,9 @@\n * @xsize_frac:\tWidth of the display in fractional units\n * @xstart_frac:\tLeft margin for the text console in fractional units\n * @last_ch:\tLast character written to the text console on this line\n+ * @escape:\tTRUE if currently accumulating an ANSI escape sequence\n+ * @escape_len:\tLength of accumulated escape sequence so far\n+ * @escape_buf:\tBuffer to accumulate escape sequence\n */\n struct vidconsole_priv {\n \tstruct stdio_dev sdev;\n@@ -42,6 +45,14 @@ struct vidconsole_priv {\n \tint xsize_frac;\n \tint xstart_frac;\n \tint last_ch;\n+\t/*\n+\t * ANSI escape sequences are accumulated character by character,\n+\t * starting after the ESC char (0x1b) until the entire sequence\n+\t * is consumed at which point it is acted upon.\n+\t */\n+\tint escape;\n+\tint escape_len;\n+\tchar escape_buf[32];\n };\n \n /**\n", "prefixes": [ "U-Boot", "2/3" ] }