diff options
author | Mark Ferry <mark@cognomen.co.uk> | 2017-02-06 13:51:59 +0000 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-03-28 13:17:17 -0400 |
commit | 24ebe5169012415a8ebf4f40bba218bc1db2997a (patch) | |
tree | 2441a93d29d516ea84834e41dd17695c188815ec | |
parent | 04ba66840c5b634a9064cd85bcb769d1b84615f4 (diff) |
Report broken CEA and DisplayID checksums.
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | edid-decode.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/edid-decode.c b/edid-decode.c index 275a66a..b5f2006 100644 --- a/edid-decode.c +++ b/edid-decode.c @@ -50,6 +50,8 @@ static int name_descriptor_terminated = 0; static int has_range_descriptor = 0; static int has_preferred_timing = 0; static int has_valid_checksum = 1; +static int has_valid_cea_checksum = 1; +static int has_valid_displayid_checksum = 1; static int has_valid_cvt = 1; static int has_valid_dummy_block = 1; static int has_valid_week = 0; @@ -1291,7 +1293,7 @@ parse_cea(unsigned char *x) detailed_block(detailed, 1); } while (0); - do_checksum(x, EDID_PAGE_SIZE); + has_valid_cea_checksum = do_checksum(x, EDID_PAGE_SIZE); return ret; } @@ -1382,7 +1384,11 @@ parse_displayid(unsigned char *x) int i; printf("Length %d, version %d, extension count %d\n", length, version, ext_count); - do_checksum(x+1, length + 5); + /* DisplayID length field is number of following bytes + * but checksum is calculated over the entire structure + * (excluding DisplayID-in-EDID magic byte) + */ + has_valid_displayid_checksum = do_checksum(x+1, length + 5); int offset = 5; while (length > 0) { @@ -2050,7 +2056,7 @@ int main(int argc, char **argv) has_valid_extension_count = 1; } - do_checksum(edid, EDID_PAGE_SIZE); + has_valid_checksum = do_checksum(edid, EDID_PAGE_SIZE); x = edid; for (edid_lines /= 8; edid_lines > 1; edid_lines--) { @@ -2144,6 +2150,15 @@ int main(int argc, char **argv) printf("\tEDID 1.4 block does not set max dotclock\n"); } + if (!has_valid_cea_checksum) { + printf("CEA extension block does not conform\n"); + printf("\tBlock has broken checksum\n"); + } + if (!has_valid_displayid_checksum) { + printf("DisplayID extension block does not conform\n"); + printf("\tBlock has broken checksum\n"); + } + if (warning_excessive_dotclock_correction) printf("Warning: CVT block corrects dotclock by more than 9.75MHz\n"); if (warning_zero_preferred_refresh) |