Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812147/?format=api
{ "id": 812147, "url": "http://patchwork.ozlabs.org/api/patches/812147/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170910132236.14318-11-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": "<20170910132236.14318-11-robdclark@gmail.com>", "list_archive_url": null, "date": "2017-09-10T13:22:31", "name": "[U-Boot,v1,10/12] dm: video: Add basic ANSI escape sequence support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "015237af4662a5f5b37ab3226f80f17e80c12691", "submitter": { "id": 18760, "url": "http://patchwork.ozlabs.org/api/people/18760/?format=api", "name": "Rob Clark", "email": "robdclark@gmail.com" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170910132236.14318-11-robdclark@gmail.com/mbox/", "series": [ { "id": 2401, "url": "http://patchwork.ozlabs.org/api/series/2401/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2401", "date": "2017-09-10T13:22:21", "name": "efi_loader+video: support for Shell.efi", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2401/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812147/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812147/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=\"NWutoXP7\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xqsMj15rpz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 23:28:49 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid DE653C21F56; Sun, 10 Sep 2017 13:25:41 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id AEB75C21F75;\n\tSun, 10 Sep 2017 13:23:49 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 3C266C21E74; Sun, 10 Sep 2017 13:23:26 +0000 (UTC)", "from mail-qk0-f196.google.com (mail-qk0-f196.google.com\n\t[209.85.220.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 3B71DC21F45\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 13:23:17 +0000 (UTC)", "by mail-qk0-f196.google.com with SMTP id o77so4071278qke.2\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 06:23:17 -0700 (PDT)", "from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\tm29sm3490521qtk.58.2017.09.10.06.23.14\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 10 Sep 2017 06:23:14 -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=GnCbt6wDutOp1Its48Jw1KJBVrf0O/Td7i8nyOgJjQA=;\n\tb=NWutoXP7nSlXD8QxNZdmrtDGHRiHdZfY9FLDuaZxAgDWMSCKX7TOkR1JjjzaXyR7h0\n\tV7aOvWBLK4DPVxG6zIbE/kpoNlcrUt1KYQBJpxRBcVpyi4Uj3PMYCLwrx8oPw9nFVucH\n\t27xwbuwX6cocULjucyswWlXjZGXUL9E01CkRhijghzNejUqrKcVtxlyfLvyNkeCfda3P\n\tyIF1SWYe1Z3atUL+dy7+MUscdMr7Devm+LxOpURuY63oYpBpZAyKnm1t5LNOdS90efgq\n\th06zDMqW9UgTLNs78skyMwM0HKdfnvi4BTVIOy2Dam4ce2vCp/8MHWJM9VFGVZKH+UVE\n\tVMEw==", "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=GnCbt6wDutOp1Its48Jw1KJBVrf0O/Td7i8nyOgJjQA=;\n\tb=t4W2cOwn1b+HaCEvJiogH/j2xOJgrqRhv1LtZAuC7dmBHMZRZXSkzit6QDl0LFiYki\n\t+Df98uAU4eVSynQsVIYdU1qzPx9ik/bc5lM49456uwHujLcbXxo1lNxQGcsXr3T3Umwc\n\t8QmbiE+Kgol+eHgJ2iQxxPcidQyvsfK9pZLScMcjUHUID0VX6ZH5CtvkTPlq1TNC71zJ\n\tf3sD6rYkJnO6F1Y0Gmzxrb64ppNYb/wD+2C1DWbx5MjSSek/+oaI+p260T84FooowrJX\n\tJPh9yysHVP8fBO+/HSQuYF4/EaXjqDcT3Ivmq7KhfWtmGeEmFOhVhvi9tswSzPYCGEA8\n\t8wAg==", "X-Gm-Message-State": "AHPjjUjX8HPX2PH8fGW01cxLs8JemiACHNyoFFd96cW5wfzYoqAp5BqN\n\tIvpdgCL3G3BcCzourVI=", "X-Google-Smtp-Source": "AOwi7QB+WYqj917GWZexMVZQh2rGQJdNuJD3shb3AlahdiaVzhEDNdMZtZ0ihgUbjqPjAGMWq5c4Zg==", "X-Received": "by 10.233.244.72 with SMTP id z8mr11594013qkl.186.1505049795877; \n\tSun, 10 Sep 2017 06:23:15 -0700 (PDT)", "From": "Rob Clark <robdclark@gmail.com>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Sun, 10 Sep 2017 09:22:31 -0400", "Message-Id": "<20170910132236.14318-11-robdclark@gmail.com>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170910132236.14318-1-robdclark@gmail.com>", "References": "<20170910132236.14318-1-robdclark@gmail.com>", "Cc": "Heinrich Schuchardt <xypron.glpk@gmx.de>,\n\tLeif Lindholm <leif.lindholm@linaro.org>", "Subject": "[U-Boot] [PATCH v1 10/12] 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/vidconsole-uclass.c | 112 ++++++++++++++++++++++++++++++++++++++\n drivers/video/video-uclass.c | 4 +-\n include/video.h | 7 +++\n include/video_console.h | 11 ++++\n 4 files changed, 131 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c\nindex e081d5a0ee..7998b4cf5f 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,123 @@ static void vidconsole_newline(struct udevice *dev)\n \tvideo_sync(dev->parent);\n }\n \n+/*\n+ * Parse a number from string that ends in a non-numeric character..\n+ * sscanf() would be nice. This is just enough for parsing ANSI escape\n+ * sequences.\n+ */\n+static char *parsenum(char *s, int *num)\n+{\n+\tint n = 0;\n+\n+\twhile (isdigit(*s)) {\n+\t\tn = (10 * n) + (*s - '0');\n+\t\ts++;\n+\t}\n+\n+\t*num = n;\n+\treturn s;\n+}\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+\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", "v1", "10/12" ] }