aboutsummaryrefslogtreecommitdiffstats
path: root/edid-decode.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-08-31 11:37:14 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-08-31 11:37:14 +0200
commitf4dee1ac14cedd0f9d9395f9e083b6bf28fb7344 (patch)
treedf892e4849f66e7c0789bf3373e1a628ba1d3178 /edid-decode.cpp
parent52c3fde4c244e995da46420e54b583e97da2cc40 (diff)
edid-decode: check and report for odd number of hex digits
Most formats require an even number of hex digits. Check this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'edid-decode.cpp')
-rw-r--r--edid-decode.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/edid-decode.cpp b/edid-decode.cpp
index bcd1090..ba78245 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -21,6 +21,7 @@
static edid_state state;
static unsigned char edid[EDID_PAGE_SIZE * EDID_MAX_BLOCKS];
+static bool odd_hex_digits;
enum output_format {
OUT_FMT_DEFAULT,
@@ -595,8 +596,10 @@ static bool extract_edid_hex(const char *s, bool require_two_digits = true)
break;
return false;
}
- if (require_two_digits && !isxdigit(s[1]))
+ if (require_two_digits && !isxdigit(s[1])) {
+ odd_hex_digits = true;
return false;
+ }
if (!edid_add_byte(s, isxdigit(s[1])))
return false;
if (isxdigit(s[1]))
@@ -900,8 +903,13 @@ static int edid_from_file(const char *from_file, FILE *error)
return -1;
}
+ odd_hex_digits = false;
if (!extract_edid(fd, error)) {
- fprintf(error, "EDID extract of '%s' failed (unknown format)\n", from_file);
+ fprintf(error, "EDID extract of '%s' failed ", from_file);
+ if (odd_hex_digits)
+ fprintf(error, "(odd number of hexadecimal digits)\n");
+ else
+ fprintf(error, "(unknown format)\n");
return -1;
}
if (state.edid_size % EDID_PAGE_SIZE) {

Privacy Policy