Finally returning to this: On Tue, 13 Dec 2016 16:51:07 +0100, walter harms wrote: > > >> Am 10.12.2016 20:44, schrieb Mark Ferry: > >>> + printf("Checksum: 0x%hx", x[len -1]); > >>> + > >>> + for (i = 0; i < len; i++) > >>> + sum += x[i]; > >>> + > >>> + if (sum) { > >>> + printf(" (should be 0x%hx)", (unsigned char)(x[len-1] - sum)); > >>> + } else printf(" (valid)"); > >>> + > >>> printf("\n"); > >> > > But your are printing (x[len-1] - sum), where x[len-1]== checksum > perhaps you wanted to print -sum ? (I assume the "checksum" is just > the diff to 0). > > INHO the code should be like this: > > exp_chk= x[len -1]; // expected sum > > for (i = 0; i < len-1; i++) sum += x[i]; // real sum, notice len-1 > > if (exp_chk+sum != 0 ) > printf("expected %02x found 0x02x\"n, 255-exp_chk, sum); > >
Your way is clearer. v2 patch (following) incorporates this. I also appreciate the rule-of-silence in your printfs but I prefer to keep the format of the output unchanged. I think modifications to output ought to be part of a more general cleanup patch with an obvious version bump. Also I'll post the binary EDID patch for testing this feature separately. -- Cognomen Ltd http://cognomen.co.uk +44 7855 790184
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