From patchwork Mon Oct 29 09:41:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Menzel X-Patchwork-Id: 1662591 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 0D4D5DFB7A for ; Mon, 29 Oct 2012 09:41:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C62339F4FF for ; Mon, 29 Oct 2012 02:41:37 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.gw90.de (mail.gw90.de [188.40.100.199]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B0909E95A for ; Mon, 29 Oct 2012 02:41:26 -0700 (PDT) Received: from f053042219.adsl.alicedsl.de ([78.53.42.219] helo=[192.168.178.20]) by mail.gw90.de with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1TSlqW-0000RP-GL; Mon, 29 Oct 2012 09:41:24 +0000 Message-ID: <1351503665.5799.6.camel@mattotaupa> Subject: [edid-decode] [PATCH] extract_string: Replace `isalnum()` with `isprint()` to allow underscores From: Paul Menzel To: dri-devel@lists.freedesktop.org Date: Mon, 29 Oct 2012 10:41:05 +0100 X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 --- 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) {