aboutsummaryrefslogtreecommitdiffstats
path: root/edid-decode.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-03-24 13:12:41 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-03-24 13:12:41 +0100
commit72953f2eb6f9dfad930c99c92553189182a8af20 (patch)
treedd4807be0b4bbaf94c8bbfa4945a70cf255d9e4a /edid-decode.cpp
parente524b475974b5962c7ef86044ae8c084700481cf (diff)
edid-decode: give better message when the EDID is empty
If the EDID file is 0 bytes, then say so instead of saying 'unknown format'. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'edid-decode.cpp')
-rw-r--r--edid-decode.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/edid-decode.cpp b/edid-decode.cpp
index 1f8c32e..e28a3a3 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -873,8 +873,10 @@ static bool extract_edid(int fd, FILE *error)
edid_data.insert(edid_data.end(), buf, buf + i);
}
- if (edid_data.empty())
+ if (edid_data.empty()) {
+ state.edid_size = 0;
return false;
+ }
const char *data = &edid_data[0];
const char *start;
@@ -1066,6 +1068,10 @@ static int edid_from_file(const char *from_file, FILE *error)
odd_hex_digits = false;
if (!extract_edid(fd, error)) {
+ if (!state.edid_size) {
+ fprintf(error, "EDID of '%s' was empty.\n", from_file);
+ return -1;
+ }
fprintf(error, "EDID extract of '%s' failed: ", from_file);
if (odd_hex_digits)
fprintf(error, "odd number of hexadecimal digits.\n");

Privacy Policy