This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: v4l2-ctl: support edid-decode output as --set-edid input Author: Hans Verkuil <[email protected]> Date: Wed Dec 15 10:33:58 2021 +0100 v4l2-ctl can now read EDID output from edid-decode as a file format with --set-edid file=<edid-file>. Signed-off-by: Hans Verkuil <[email protected]> utils/v4l2-ctl/v4l2-ctl-edid.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=6c905930e8e9bdf485f857ea8aadcaffbfd0943d diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp index 96659377853f..c9f827dcb456 100644 --- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp @@ -246,7 +246,9 @@ static void edid_add_block(struct v4l2_edid *e) static void read_edid_file(FILE *f, struct v4l2_edid *e) { + static const char *ignore_chars = ",:;"; char value[3] = { 0 }; + char buf[256]; unsigned i = 0; int c; @@ -254,6 +256,19 @@ static void read_edid_file(FILE *f, struct v4l2_edid *e) e->edid = nullptr; e->blocks = 0; + /* + * Skip the first line if it matches the edid-decode output. + * After that first line the hex dump starts, and that's what we + * want to use here. + * + * This makes it possible to use the edid-decode output as EDID + * file. + */ + if (fgets(buf, sizeof(buf), f) && + !strstr(buf, "EDID (hex):") && + !strstr(buf, "edid-decode (hex):")) + fseek(f, SEEK_SET, 0); + while ((c = fgetc(f)) != EOF) { if (sformat == RAW) { if (i % 256 == 0) @@ -265,8 +280,10 @@ static void read_edid_file(FILE *f, struct v4l2_edid *e) /* Handle '0x' prefix */ if ((i & 1) && value[0] == '0' && (c == 'x' || c == 'X')) i--; - if (!isxdigit(c)) + if (isspace(c) || strchr(ignore_chars, c)) continue; + if (!isxdigit(c)) + break; if (i & 0x01) { value[1] = c; if (i % 256 == 1) _______________________________________________ linuxtv-commits mailing list [email protected] https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
