Skip to contentSkip to conversation

extract_string: Replace `isalnum()` with `isprint()` to allow underscores

PATCH New Paul Menzel 1 participant 1 message Oct 29, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extract_string: Replace `isalnum()` with `isprint()` to allow underscores

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

--
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(-)
edid-decode.c +1 -1
index 9840db6..191649c 100644
@@ -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) {
Signature · 1 line
1.7.10.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel