From owner-freebsd-x11@FreeBSD.ORG Mon Feb 3 14:37:31 2014 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CF24FB54; Mon, 3 Feb 2014 14:37:31 +0000 (UTC) Received: from master.debian.org (master.debian.org [IPv6:2001:41b8:202:deb:216:36ff:fe40:4001]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9248F1E1D; Mon, 3 Feb 2014 14:37:31 +0000 (UTC) Received: from localhost ([::1]) by master.debian.org with esmtp (Exim 4.80) (envelope-from ) id 1WAKeQ-00023P-0c; Mon, 03 Feb 2014 14:37:30 +0000 Message-ID: <52EFA9A9.2040901@freebsd.org> Date: Mon, 03 Feb 2014 14:37:29 +0000 From: Robert Millan User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Baptiste Daroussin Subject: [PATCH] do not feed keyboard device path in X devd backend X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------070008010608080109000107" Cc: freebsd-x11@freebsd.org X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2014 14:37:31 -0000 This is a multi-part message in MIME format. --------------070008010608080109000107 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit When feeding the keyboard device path (e.g. /dev/ukbd0) to X server, it will attempt to open it. This is incorrect because X doesn't want _all_ the input from keyboard but rather just the one typed in its VT (usually /dev/ttyv7). Plus, attempting to open /dev/ukbd0 usually fails with EBUSY as the keyboard is already being used by syscons. This patch adjusts devd.c to follow the same approach as HAL: detect the keyboard but feed it a zero-length device path. The result is that X detects the presence of a keyboard, and therefore loads the kbd_drv module, but doesn't attempt to open it directly (which is unnecessary since /dev/ttyv7 is already open). -- Robert Millan --------------070008010608080109000107 Content-Type: text/x-patch; name="devd_no_kbd.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="devd_no_kbd.diff" === modified file 'devd.c' --- devd.c 2014-02-03 14:28:22 +0000 +++ devd.c 2014-02-03 14:28:02 +0000 @@ -224,7 +224,15 @@ device_added(char *line) return; } #endif - if (asprintf(&path, "/dev/%s", line) == -1) + + if (attrs.flags & ATTR_KEYBOARD) + /* For keyboards, we don't want to open the actual device, because + we only need input from the VT that X is running on (see + xf86OpenConsole() in bsd_init.c). However, we still want + kbd_drv to be loaded, so rather than skipping keyboards we + register them with a zero-length device path. */ + path = xstrdup(""); + else if (asprintf(&path, "/dev/%s", line) == -1) return; #if XORG_VERSION_CURRENT < 10800000 --------------070008010608080109000107--