Module Name:    xsrc
Committed By:   macallan
Date:           Thu Feb 14 20:53:27 UTC 2013

Modified Files:
        xsrc/external/mit/xf86-input-keyboard/dist/src: bsd_kbd.c xf86OSKbd.h

Log Message:
when using /dev/wskbd* we need to close the device when VT switching out of
X, and open it again when switching back


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
    xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c
cvs rdiff -u -r1.1.1.3 -r1.2 \
    xsrc/external/mit/xf86-input-keyboard/dist/src/xf86OSKbd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.16 xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.17
--- xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.16	Sat Jul 21 10:19:40 2012
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c	Thu Feb 14 20:53:26 2013
@@ -204,6 +204,24 @@ KbdOn(InputInfoPtr pInfo, int what)
 #endif
         }
 #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);
     }

Index: xsrc/external/mit/xf86-input-keyboard/dist/src/xf86OSKbd.h
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/xf86OSKbd.h:1.1.1.3 xsrc/external/mit/xf86-input-keyboard/dist/src/xf86OSKbd.h:1.2
--- xsrc/external/mit/xf86-input-keyboard/dist/src/xf86OSKbd.h:1.1.1.3	Sun Jul 24 00:04:34 2011
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/xf86OSKbd.h	Thu Feb 14 20:53:26 2013
@@ -78,6 +78,7 @@ typedef struct {
     pointer		private;
     int			consType;
     int			wsKbdType;
+    char		wsKbdDev[256];
 
 } KbdDevRec, *KbdDevPtr;
 

Reply via email to