[PATCH] do not feed keyboard device path in X devd backend

Robert Millan rmh at freebsd.org
Sat Feb 8 11:47:56 UTC 2014


On 03/02/2014 14:37, Robert Millan wrote:
> 
> 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).

Unfortunately this didn't completely fix the problem. Testing by Debian
developers revealed that attaching a second keyboard and then detaching
it disabled keyboard handling in X somehow:

https://lists.debian.org/debian-bsd/2014/02/msg00074.html

I investigated and found that HAL avoids this by ignoring keyboard events
completely. Instead, it generates a fake "AT Keyboard" event during
initialization (with empty device path too), which makes X load the kbd
driver just once.

Here's a patch that implements the same behaviour with devd. I've verified
that attaching/detaching a second keyboard no longer causes this ill effect.

-- 
Robert Millan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: devd_fake_kbd.diff
Type: text/x-patch
Size: 2051 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-x11/attachments/20140208/f3d484fd/attachment.bin>


More information about the freebsd-x11 mailing list