[PATCH edid-decode] Fix manufacture/model week/year parsing

Tormod Volden lists.tormod at gmail.com
Sat Dec 17 13:00:19 PST 2011


From: Tormod Volden <debian.tormod at gmail.com>

For instance, the handling of week=0xff or week=0 was not working,
as could be seen from by the data/sharp-* examples.

Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
---
 edid-decode.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/edid-decode.c b/edid-decode.c
index ab4bde8..fe1f4f5 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -953,18 +953,16 @@ int main(int argc, char **argv)
 
     time(&the_time);
     ptm = localtime(&the_time);
-    if (edid[0x10] < 55 || edid[0x10] == 0xff) {
+    if (edid[0x10] < 0x37 || edid[0x10] == 0xff)
 	has_valid_week = 1;
-	if (edid[0x11] > 0x0f) {
-	    if (edid[0x10] == 0xff) {
-		has_valid_year = 1;
-		printf("Made week %hd of model year %hd\n", edid[0x10],
-		       edid[0x11]);
-	    } else if (edid[0x11] + 90 <= ptm->tm_year) {
-		has_valid_year = 1;
-		printf("Made week %hd of %hd\n", edid[0x10], edid[0x11] + 1990);
-	    }
-	}
+    if (edid[0x11] > 0x0f && edid[0x11] + 90 <= ptm->tm_year) {
+	has_valid_year = 1;
+	if (edid[0x10] == 0xff)
+	    printf("Model year %hd\n", edid[0x11] + 1990);
+	else if (edid[0x10] == 0)
+	    printf("Manufactured year %hd\n", edid[0x11] + 1990);
+	else
+	    printf("Manufactured week %hd of %hd\n", edid[0x10], edid[0x11] + 1990);
     }
 
     printf("EDID version: %hd.%hd\n", edid[0x12], edid[0x13]);
-- 
1.7.5.4



More information about the xorg-devel mailing list