[PATCH keyboard] linux: bring our process group to the foreground (#89653)

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 24 21:21:07 PDT 2015


Required to make the driver receive keyboard events from the console.

X.Org Bug  <http://bugs.freedesktop.org/show_bug.cgi?id=89653>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Mark was right, this seems to do the trick. I don't know why this is needed
now though when it wasn't in the past. When I tried bisecting this
yesterday I started before all the systemd-logind patches and it still had
the same behaviour. A 3.18rc4 kernel that I still had around
also required the patch. So something somewhere has broken this, I just
don't know what.

Either way, this fixes it, with no side-effects that I found so far.
I was contemplating of putting this in the server but it's really only the
keyboard driver that needs this.

 src/lnx_kbd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c
index 811a7d7..c221194 100644
--- a/src/lnx_kbd.c
+++ b/src/lnx_kbd.c
@@ -187,8 +187,17 @@ OpenKeyboard(InputInfoPtr pInfo)
 
     s = xf86SetStrOption(pInfo->options, "Device", NULL);
     if (s == NULL) {
+       int rc;
        pInfo->fd = xf86Info.consoleFd;
        pKbd->isConsole = TRUE;
+
+       rc = tcsetpgrp(pInfo->fd, getpgid(0));
+       if (rc < 0) {
+           xf86IDrvMsg(pInfo, X_ERROR,
+                       "failed to set us as foreground pgrp (%s)\n",
+                       strerror(errno));
+       }
+
     } else {
        pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
        if (pInfo->fd == -1) {
-- 
2.3.3



More information about the xorg-devel mailing list