[PATCH 21/27] edid-decode: improve the hex dump parser to be more generic
Hans Verkuil
hverkuil at xs4all.nl
Thu Aug 31 11:41:14 UTC 2017
From: Hans Verkuil <hansverk at cisco.com>
Allow for spaces and '0x' prefixes.
Signed-off-by: Hans Verkuil <hansverk at cisco.com>
---
edid-decode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/edid-decode.c b/edid-decode.c
index 58dc1c13..d38d2a3d 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -1976,7 +1976,7 @@ extract_edid(int fd)
}
/* Is the EDID provided in hex? */
- for (i = 0; i < 32 && isxdigit(ret[i]); i++);
+ for (i = 0; i < 32 && (isspace(ret[i]) || tolower(ret[i]) == 'x' || isxdigit(ret[i])); i++);
if (i == 32) {
out = malloc(size >> 1);
if (out == NULL) {
@@ -1987,7 +1987,7 @@ extract_edid(int fd)
for (c=ret; *c; c++) {
char buf[3];
- if (*c == '\n')
+ if (!isxdigit(*c) || (*c == '0' && tolower(c[1]) == 'x'))
continue;
/* Read a %02x from the log */
--
2.14.1
More information about the xorg-devel
mailing list