Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 2014 10:48:20 -0700
From:      Kevin Oberman <rkoberman@gmail.com>
To:        Jukka Ukkonen <jau789@gmail.com>
Cc:        "freebsd-x11@freebsd.org" <x11@freebsd.org>
Subject:   Re: Xorg 7.7 suddenly lost the keyboard
Message-ID:  <CAN6yY1uW5JD1ipEkq=1k4iubVxJk2hshjsdT0d5CbuoUGB=ZsQ@mail.gmail.com>
In-Reply-To: <53A41B08.1080304@gmail.com>
References:  <53A03A3F.9000503@gmail.com> <53A15FD1.6040206@gmail.com> <CAN6yY1sYuGZRAYcz7tioJ62690umptjfwfxHWfqi1uOTes7YvQ@mail.gmail.com> <53A4013A.2090904@gmail.com> <53A41B08.1080304@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 20, 2014 at 4:29 AM, Jukka Ukkonen <jau789@gmail.com> wrote:

>  On 2014-06-20 12:39, Jukka Ukkonen wrote:
>
> On 2014-06-19 23:26, Kevin Oberman wrote:
>
> On Wed, Jun 18, 2014 at 2:45 AM, Jukka Ukkonen <jau789@gmail.com> wrote:
>
>>
>> Hi all,
>> I sent the following issue to questions@freebsd.org, but it seems there
>> are no ideas available there.
>> So, in the hope that someone on the list x11@freebsd.org might have some
>> idea what has happened,
>> I send the same issue to this mailing list as well.
>> It would be really nice to get my keyboard working with x11/xorg again.
>>
>> --jau
>>
>>
>>
>> -------- Original Message --------
>> Subject:        Re: Xorg 7.7 suddenly lost the keyboard
>> Date:   Tue, 17 Jun 2014 15:53:19 +0300
>> From:   Jukka Ukkonen <jau789@gmail.com>
>> To:     questions@freebsd.org
>>
>>
>>
>> After digging a bit deeper in the issue the most revealing symptom is
>> this error in /var/log/Xorg.0.log...
>>
>> [   585.774] (II) Using input driver 'kbd' for 'Keyboard0'
>> [   585.774] (**) Option "CoreKeyboard"
>> [   585.774] (**) Keyboard0: always reports core events
>> [   585.774] (**) Keyboard0: always reports core events
>> [   585.774] (**) Option "Protocol" "standard"
>> [   585.774] (**) Option "Device" "/dev/kbdmux0"
>> [   585.774] (EE) Keyboard0: cannot open "/dev/kbdmux0"
>> [   585.774] (EE) PreInit returned 8 for "Keyboard0"
>> [   585.774] (II) UnloadModule: "kbd"
>>
>> That "PreInit" is apparently kbdPreInit() and the returned code 8 stands
>> for BadMatch.
>>
>> What should I make of this?
>>
>> --jau
>>
>>
>> On 2014-06-15 17:32, Jukka Ukkonen wrote:
>>
>>>
>>> Hello everybody,
>>>
>>> I recently had a very peculiar experience with Xorg 7.7 on an amd64
>>> system running FreeBSD 10-stable.
>>> Suddenly any and all X11 applications lost the keyboard. When using
>>> vanilla vt only the same keyboard
>>> works just fine.
>>> I guess this happened after I had updated the ports tree using svn and
>>> run "portupgrade --batch -y -a".
>>> Does anyone have any idea what might be the root cause and how to get
>>> around this.
>>> Previously I have been using HAL configured devices with Xorg. Now
>>> even explicitly forcing the automatic
>>> device detection off did not bring the keyboard back. Rebuilding
>>> xorg-server to use devd instead of HAL
>>> did not help either. So, I am confused. Any ideas what to try?
>>>
>>> Cheers,
>>> --jau
>>>
>>>
> Just a few shots in the dark...
> Does /dev/kbdmux exist? Did it get dropped from your kernel? Did you fail
> to load it? Did your /boot/loader.conf file change?
>
>  How did you change Xorg.conf? Looks like it is trying the right thing
> and jut not finding the device.
>  --
> R. Kevin Oberman, Network Engineer, Retired
> E-mail: rkoberman@gmail.com
>
>
> Indeed it looks like X fails to open the device.
> The device entries are there as expected, though.
>
> crw-------  1 root  wheel  0x3d Jun 20 11:07 /dev/atkbd0
> lrwxr-xr-x  1 root  wheel     6 Jun 20 11:07 /dev/kbd0 -> atkbd0
> lrwxr-xr-x  1 root  wheel     7 Jun 20 11:07 /dev/kbd1 -> kbdmux0
> lrwxr-xr-x  1 root  wheel     5 Jun 20 11:07 /dev/kbd2 -> ukbd0
> crw-------  1 root  wheel  0x1b Jun 20 11:07 /dev/kbdmux0
> crw-------  1 root  wheel  0x75 Jun 20 11:07 /dev/ukbd0
>
> The only thing I have changed in xorg.conf has been AutoAddDevices
> on and off, and even that only when the keyboard was already lost in
> an attempt to test whether hald was somehow out of its mind.
> Otherwise xorg.conf is as it was before the keyboard was lost.
>
> It seems that BadMatch could only be triggered inside OpenKeyboard() in
>
> x11-drivers/xf86-input-keyboard/work/xf86-input-keyboard-1.8.0/src/bsd_kbd.c
>
> Apparently the message "cannot open ..." originates from this
> code snippet...
>
>     424         pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
>     425         if (pInfo->fd == -1) {
>     426            xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n",
> pInfo->name, s);
>     427            free(s);
>     428            return FALSE;
>     429         }
>
> It would be useful to have those xf86Msg() calls also report
> something like strerror(errno) when something goes wrong.
> Without any further info one can only guess what might be
> the true reason for failures. At the moment I can only imagine
> there might be another program like hald holding the keyboard
> device open still when X tries to open it.
>
> --jau
>
>
> Wow... When I then changed the code snippet above to this...
>
>
>         pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
>         if (pInfo->fd == -1) {
>            xf86Msg(X_ERROR, "%s: cannot open \"%s\" (%s)\n", pInfo->name,
> s,
>                    strerror (errno));
>            free(s);
>            return FALSE;
>         }
>
> what did I find in the Xorg.0.log...
>
> [  1708.047] (II) Using input driver 'kbd' for 'Keyboard0'
> [  1708.047] (**) Option "CoreKeyboard"
> [  1708.047] (**) Keyboard0: always reports core events
> [  1708.047] (**) Keyboard0: always reports core events
> [  1708.047] (**) Option "Protocol" "standard"
> [  1708.047] (**) Option "Device" "/dev/kbdmux0"
> [  1708.047] (EE) Keyboard0: cannot open "/dev/kbdmux0" (*Device busy*)
> [  1708.047] (EE) PreInit returned 8 for "Keyboard0"
> [  1708.047] (II) UnloadModule: "kbd"
>
> After terminating the X session and returning to plain vt command
> line I tried running lsof to figure out whether some program was
> holding any kbd devices open. Nope!
>
> This is obviously some sort of timing issue / race condition such
> that something else opens /dev/kbdmux0 slightly before X tries to
> open it and while holding the handle open for a while manages to
> block X from opening kbdmux.
> At the moment I already know that neither hald nor dbus are likely
> culprits because disabling them did not make the keyboard available
> to X.
> Could gnome-settings-daemon try to do something to the keyboard?
>

Gnome-settings-daemon is certainly a possibility.

Can you log in remotely while X is running and use lsof or fstat to check
on the device?
-- 
R. Kevin Oberman, Network Engineer, Retired
E-mail: rkoberman@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN6yY1uW5JD1ipEkq=1k4iubVxJk2hshjsdT0d5CbuoUGB=ZsQ>