Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Feb 2014 14:37:29 +0000
From:      Robert Millan <rmh@freebsd.org>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        freebsd-x11@freebsd.org
Subject:   [PATCH] do not feed keyboard device path in X devd backend
Message-ID:  <52EFA9A9.2040901@freebsd.org>

next in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52EFA9A9.2040901>