[edid-decode] [PATCH] extract_string: Replace `isalnum()` with `isprint()` to allow underscores

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Date: Mon, 29 Oct 2012 10:17:54 +0100

The EDID of the Philips 32PFL5404H contains the monitor name
`PHILIPS_FTV`. `isalnum()` returns false for the underscore, causing
`edid-decode` to not print the whole name and to complain that the
string is not properly terminated [1].

        Monitor name: PHILIPS
        Checksum: 0x1 (valid)
        EDID block does NOT conform to EDID 1.3!
        	Detailed block string not properly terminated

The X server writes the correct name to `/var/log/Xorg.0.log` [2].

        (II) intel(0): Monitor name: PHILIPS_FTV

Changing the check to `isprint()` also allows underscores and therefore
fixes the incorrect output and brings it in line with the X server.

        Monitor name: PHILIPS_FTV
        Checksum: 0x1 (valid)

[1] https://bugs.freedesktop.org/show_bug.cgi?id=26294#c27
[2] https://bugs.freedesktop.org/show_bug.cgi?id=26294#c3

Signed-off-by: Paul Menzel <paulepanter@xxxxxxxxxxxxxxxxxxxxx>
--
1. I do not know if the X server or the Intel DDX driver(?) writes the value to `Xorg.0.log`.
2. Also I did not check the EDID specification if underscores are actually allowed.
3. `isascii()` cannot be used as it returns true also for '\n'.
---
 edid-decode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edid-decode.c b/edid-decode.c
index 9840db6..191649c 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -145,7 +145,7 @@ extract_string(unsigned char *x, int *valid_termination, int len)
     memset(ret, 0, sizeof(ret));
 
     for (i = 0; i < len; i++) {
-	if (isalnum(x[i])) {
+	if (isprint(x[i])) {
 	    ret[i] = x[i];
 	} else if (!seen_newline) {
 	    if (x[i] == 0x0a) {
-- 
1.7.10.4

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux