Bug 89653 - startx preventing xf86-input-keyboard from working
Summary: startx preventing xf86-input-keyboard from working
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/Keyboard (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high blocker
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on: 89756
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-18 10:21 UTC by ib
Modified: 2015-03-26 23:12 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description ib 2015-03-18 10:21:40 UTC
Patch 44915d6953076849b69a017f6fc8234b0f254362 caused a regression.

When using xf86-input-keyboard for keyboard input without utilizing evdev, udev, hal, systemd-logind, X starts on the current tty, because the X server enables keeptty then (which is even forced with patch bd6cacdd36615e9b8136aeb86c3924a404785977 now).

This, however, prevents the linux kbd driver from working.

The solution is simple: Allow disabling the code introduced with patch 44915d6953076849b69a017f6fc8234b0f254362 by a configure option. If X starts on the next free tty (as it was before), xf86-input-keyboard's linux kdb driver works fine again.
Comment 1 Hans de Goede 2015-03-18 11:07:23 UTC
(In reply to ib from comment #0)
> Patch 44915d6953076849b69a017f6fc8234b0f254362 caused a regression.
> 
> When using xf86-input-keyboard for keyboard input without utilizing evdev,
> udev, hal, systemd-logind, X starts on the current tty, because the X server
> enables keeptty then (which is even forced with patch
> bd6cacdd36615e9b8136aeb86c3924a404785977 now).
> 
> This, however, prevents the linux kbd driver from working.

How exactly does this prevent the linux kbd driver from working? I don't see how keeptty would stop that from working ?
Comment 2 ib 2015-03-18 11:31:14 UTC
(In reply to Hans de Goede from comment #1)
> How exactly does this prevent the linux kbd driver from working? I don't see
> how keeptty would stop that from working ?

Well, I'm no expert for the linux kbd driver (Peter certainly is). What I experience is that pressing whatever key has no effect whatsoever, i.e. there seem to be either no key events or the events aren't captured. Preventing the server from detaching its initial controlling terminal doesn't seem to work with linux kbd and xf86-input-keyboard.
Comment 3 Peter Hutterer 2015-03-23 06:35:16 UTC
this is an xinit problem, not a startx problem. specfically, this line in  xinit.c:

          /*
           * prevent server from getting sighup from vhangup()
           * if client is xterm -L
           */
          setpgid(0,getpid());

just before the server is execvp'd. I can't find any reference to -L and vhangup() in the xterm sources, and this line dates back to the original import from xfree86.
Comment 4 Alan Coopersmith 2015-03-23 16:21:45 UTC
An archaeological dig in the ancient X Consortium history has found a little more:

That bit of xinit goes back as far as our source history does, to the initial
integration in 1988:
http://cgit.freedesktop.org/~alanc/xc-historical/commit/xc/programs/xinit/xinit.c?id=6904d79e8aeb08a602779bfa0715153cc3ed3bd2

The -L flag was removed from xterm in 1989, but apparently no one remembered
the hack in xinit to work around it:
http://cgit.freedesktop.org/~alanc/xc-historical/commit/xc/programs/xterm?id=46fc268c21d01cf0d664c84e5d03f785b2b2e5ce
Comment 5 ib 2015-03-23 20:17:22 UTC
(In reply to Peter Hutterer from comment #3)
> this is an xinit problem, not a startx problem. specfically, this line in 
> xinit.c:

I don't mind a fix in xinit.c either, if I only get a working keyboard again.
Comment 6 Peter Hutterer 2015-03-24 04:51:20 UTC
ok, I spent most of the day trying to bisect this but there are too many moving targets and between rebooting and handling fs errors I gave up. Patch is on he list, it seems to make things work again but I don't understand why.

http://patchwork.freedesktop.org/patch/45505/
Comment 7 Hans de Goede 2015-03-24 10:33:48 UTC
Hi,

(In reply to Peter Hutterer from comment #6)
> ok, I spent most of the day trying to bisect this but there are too many
> moving targets and between rebooting and handling fs errors I gave up. Patch
> is on he list, it seems to make things work again but I don't understand why.
> 
> http://patchwork.freedesktop.org/patch/45505/

I'm afraid that this causes a regression, with this patch the Xserver no
longer cleanly exits when the last client disconnects.

Test-case:

-Fully up2date 64 bit Fedora-22 system
-xinit rpm package build with this patch
-do: "startx /usr/bin/xterm -title foo"
-exit the shell in the xterm
-now Xorg hangs using aprox 100% cpu, strace shows that it
 sits in a select() loop

Regards,

Hans
Comment 8 Peter Hutterer 2015-03-26 23:12:29 UTC
commit 65739ef047233567e6053fc57464a42ffe69e989
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Mar 25 13:37:09 2015 +1000

    linux: bring our process group to the foreground (#89653)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.