Subject: Re: One keyboard problem solved, one new one
To: port-hpcsh list <port-hpcsh@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-hpcsh
Date: 03/15/2006 06:52:57
(Better late than never... ;)

On Thu, Sep 01, 2005 at 21:41:42 -0400, Michael Wileman wrote:

> Now I have a new problem. Running X with fvwm2 window manager (as a 
> non-root user), if I quit using the Quit in the fvwm menu, the server 
> shuts down but again the keyboard doesn't respond. This worked with my 
> previous setup, so I am not sure what changed.
> 
> If I kill -TERM the X server (as root), things shut down normally, and 
> I get the keyboard back in console mode. Nothing I can do as a 
> non-root user seems to get me back to console with working keyboard.
> 
> Hmmm, after a bit more experimentation, it seems the X server is 
> trying to start back up, so it seems it is not getting completely 
> killed by the fvwm. I'm wondering if it's a permission problem, since 
> the server is running as route, but fvwm2 as a non-root user. Anyway, 
> doesn't appear to be a keyboard issue after all.

The issue is that Xserver default behaviour is to restart after the
last client disconnects.  Apparenlty there's a race between xinit
detecting that xinitrc exited and killing the server and the server
detecting last client (xinit!) disconnecting and initiating reset.

When xinit finally kills the server the server has already reopened
the keyboard in raw mode.  I haven't investigated why the server
doesn't handle the signal gracefully.

A workaround is to arrange for the server to start with either
-terminate or -noreset flag to avoid the race.  E.g.

    $ startx -- -terminate


SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen