diff mbox

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

Message ID 1351503665.5799.6.camel@mattotaupa (mailing list archive)
State New, archived
Headers show

Commit Message

Paul Menzel Oct. 29, 2012, 9:41 a.m. UTC
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@users.sourceforge.net>
--
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 mbox

Patch

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) {