open-src/xserver/xorg/KB_EncodingAtXCrash.patch
author Alan Coopersmith <Alan.Coopersmith@Sun.COM>
Thu, 15 Jan 2009 12:55:00 -0800
changeset 606 068c11b419c9
parent 237 0a22d5e84c61
permissions -rw-r--r--
6582489 X11R7.4: Xorg server 1.5.3, Mesa 7.2, and associated driver updates Includes changes contributed by Liang, Kan <[email protected]>: - G41 support patches - DRM_CAS in libdrm type error can cause deadlock and hang the glxgears. Includes changes contributed by Martin Bochnig <[email protected]>: - Make SUNWxorg-mesa package platform-clean

diff -urp -x '*~' -x '*.orig' hw/xfree86/common/xf86Events.c hw/xfree86/common/xf86Events.c
--- hw/xfree86/common/xf86Events.c	2008-09-23 11:24:58.000000000 -0700
+++ hw/xfree86/common/xf86Events.c	2008-09-24 20:24:56.137289000 -0700
@@ -764,6 +764,31 @@ xf86SigHandler(int signo)
   xorg_backtrace();
 
   FatalError("Caught signal %d.  Server aborting\n", signo);
+
+/* CR 6545884 If server crashes keyboard left in un-encoded mode*/
+#ifdef sun
+        {
+            int kbd_fd,console_fd;
+            int translate=TR_ASCII;
+
+            Error ("Resetting keyboard\n");
+            /* Check if on console, since kbd_mode works on console only */
+            if (((console_fd = open("/dev/console", O_RDWR | O_NDELAY, 0)) != -1)) { 
+                if ((kbd_fd = open("/dev/kbd", O_RDONLY, 0)) < 0) {
+                    Error("/dev/kbd open failed\n");
+                } else {
+                    if (ioctl(kbd_fd, KIOCTRANS, (caddr_t) &translate)) {
+                        Error("Could not set /dev/kbd back to ASCII mode\n");
+                    }
+                    close(kbd_fd);
+                }
+            close (console_fd);
+            }
+            else
+                Error ("Not on Console not Resetting keyboard\n");
+        }
+#endif
+    
 }
 
 static void