diff options
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/ddc/edid.c')
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/ddc/edid.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/edid.c b/xc/programs/Xserver/hw/xfree86/ddc/edid.c index 6b2a909e1..7a878abb5 100644 --- a/xc/programs/Xserver/hw/xfree86/ddc/edid.c +++ b/xc/programs/Xserver/hw/xfree86/ddc/edid.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.c,v 1.2 1999/01/14 13:04:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.c,v 1.3 2000/11/03 18:46:08 eich Exp $ */ /* edid.c: retrieve EDID record from raw DDC1 data stream: data * is contained in an array of unsigned int each unsigned int @@ -52,11 +52,21 @@ int checksum(unsigned char *block, int len) { int i, result = 0; - for (i=0;i<len;i++) + int not_null = 0; + + for (i=0;i<len;i++) { + not_null |= block[i]; result += block[i]; + } + #ifdef DEBUG if (result & 0xFF) ErrorF("DDC checksum not correct\n"); + if (!not_null) ErrorF("DDC read all Null\n"); #endif + + /* catch the trivial case where all bytes are 0 */ + if (!not_null) return 1; + return (result&0xFF); } |