---
 edid-decode.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/edid-decode.c b/edid-decode.c
index 15660dc..95e9c96 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;
@@ -1289,7 +1291,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;
 }
@@ -1380,7 +1382,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) {
@@ -2048,7 +2054,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--) {
@@ -2142,6 +2148,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)
-- 
Cognomen Ltd
http://cognomen.co.uk
+44 7855 790184

Attachment: signature.asc
Description: Digital signature

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to