summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Klausner <wiz@NetBSD.org>2013-07-29 23:23:44 +0200
committerGaetan Nadon <memsize@videotron.ca>2013-10-18 16:41:13 -0400
commit8ac42401a6db161e0983df17ac1787f164faf2f3 (patch)
treeb0a88dc1198d525bb78013e8b76a73c9f59a81cf
parentd61dcfd5c297f405a4c200131e88e5dfc95bfa95 (diff)
downloadxorg-driver-xf86-input-keyboard-8ac42401a6db161e0983df17ac1787f164faf2f3.tar.gz
Fix wskbd handling when VT switching.
When using /dev/wskbd* we need to close the device when VT switching out of X, and open it again when switching back. >From Michael Lorenz <macallan@NetBSD.org> Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--src/bsd_kbd.c35
-rw-r--r--src/xf86OSKbd.h1
2 files changed, 35 insertions, 1 deletions
diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c
index 1048a13..d629565 100644
--- a/src/bsd_kbd.c
+++ b/src/bsd_kbd.c
@@ -204,6 +204,24 @@ KbdOn(InputInfoPtr pInfo, int what)
break;
#endif
}
+ } else {
+ switch (pKbd->consType) {
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ if ((pKbd->wsKbdDev[0] != 0) && (pInfo->fd == -1)) {
+ xf86Msg(X_INFO, "opening %s\n", pKbd->wsKbdDev);
+ pInfo->fd = open(pKbd->wsKbdDev, O_RDONLY | O_NONBLOCK | O_EXCL);
+#ifdef WSKBDIO_SETVERSION
+ int version = WSKBDIO_EVENT_VERSION;
+ if (ioctl(pInfo->fd, WSKBDIO_SETVERSION, &version) == -1) {
+ xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name);
+ return FALSE;
+ }
+#endif
+ }
+ break;
+#endif
+ }
}
return Success;
}
@@ -238,7 +256,20 @@ KbdOff(InputInfoPtr pInfo, int what)
break;
#endif
}
- }
+ } else {
+ switch (pKbd->consType) {
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ if ((pKbd->wsKbdDev[0] != 0) && (pInfo->fd != -1)) {
+ xf86Msg(X_INFO, "closing %s\n", pKbd->wsKbdDev);
+ /* need to close the fd while we're gone */
+ close(pInfo->fd);
+ pInfo->fd = -1;
+ }
+ break;
+#endif
+ }
+ }
return Success;
}
@@ -368,6 +399,7 @@ OpenKeyboard(InputInfoPtr pInfo)
pInfo->fd = xf86Info.consoleFd;
pKbd->isConsole = TRUE;
pKbd->consType = xf86Info.consType;
+ pKbd->wsKbdDev[0] = 0;
} else {
pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
if (pInfo->fd == -1) {
@@ -376,6 +408,7 @@ OpenKeyboard(InputInfoPtr pInfo)
return FALSE;
}
pKbd->isConsole = FALSE;
+ strncpy(pKbd->wsKbdDev, s, 256);
pKbd->consType = xf86Info.consType;
free(s);
}
diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h
index 0d8792d..86df0f5 100644
--- a/src/xf86OSKbd.h
+++ b/src/xf86OSKbd.h
@@ -82,6 +82,7 @@ typedef struct {
pointer private;
int consType;
int wsKbdType;
+ char wsKbdDev[256];
} KbdDevRec, *KbdDevPtr;