summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-01-09 14:32:14 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-01-16 16:21:16 +1000
commitb33905234025f005819c7e2acd653a3a0ecfeb82 (patch)
treeb4918131420de5e7428382e3a394e6908d475ef8
parent646add4eb47c01c045ef64405510a08ecfb5bfd6 (diff)
xfree86: always force RAW mode under linux.
The previous check for AEI on left us with the possibility that AEI is forced off in the config, but devices are added through evdev nonetheless. A keyboard added this way can CTRL+C the server. Even when we use kbd, we can set the mode to RAW, so it's safer alround to to so. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 0ac97e891..17502a1da 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -250,6 +250,8 @@ xf86OpenConsole(void)
250 250
251 if (!ShareVTs) 251 if (!ShareVTs)
252 { 252 {
253 struct termios nTty;
254
253#if defined(DO_OS_FONTRESTORE) 255#if defined(DO_OS_FONTRESTORE)
254 lnx_savefont(); 256 lnx_savefont();
255#endif 257#endif
@@ -282,37 +284,27 @@ xf86OpenConsole(void)
282 FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n", 284 FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
283 strerror(errno)); 285 strerror(errno));
284 286
285 /* Set the keyboard to RAW mode. If we're using the keyboard 287 tcgetattr(xf86Info.consoleFd, &tty_attr);
286 * driver, the driver does it for us. If we have AEI on, then 288 ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
287 * we're expecting the devices to be added (i.e. evdev) and we 289
288 * have to set it manually. 290 if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
289 */ 291 FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
290 if (xf86Info.allowEmptyInput) 292 strerror(errno));
291 { 293
292 struct termios nTty; 294 nTty = tty_attr;
293 295 nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
294 tcgetattr(xf86Info.consoleFd, &tty_attr); 296 nTty.c_oflag = 0;
295 ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode); 297 nTty.c_cflag = CREAD | CS8;
296 298 nTty.c_lflag = 0;
297 if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) 299 nTty.c_cc[VTIME]=0;
298 FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n", 300 nTty.c_cc[VMIN]=1;
299 strerror(errno)); 301 cfsetispeed(&nTty, 9600);
300 302 cfsetospeed(&nTty, 9600);
301 nTty = tty_attr; 303 tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
302 nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); 304
303 nTty.c_oflag = 0; 305 /* need to keep the buffer clean, else the kernel gets angry */
304 nTty.c_cflag = CREAD | CS8; 306 console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
305 nTty.c_lflag = 0; 307 drain_console, NULL);
306 nTty.c_cc[VTIME]=0;
307 nTty.c_cc[VMIN]=1;
308 cfsetispeed(&nTty, 9600);
309 cfsetospeed(&nTty, 9600);
310 tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
311
312 /* need to keep the buffer clean, else the kernel gets angry */
313 console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
314 drain_console, NULL);
315 }
316 308
317 /* we really should have a InitOSInputDevices() function instead 309 /* we really should have a InitOSInputDevices() function instead
318 * of Init?$#*&Device(). So I just place it here */ 310 * of Init?$#*&Device(). So I just place it here */
@@ -376,10 +368,8 @@ xf86CloseConsole(void)
376 xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n", 368 xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
377 strerror(errno)); 369 strerror(errno));
378 370
379 if (xf86Info.allowEmptyInput) { 371 ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
380 ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode); 372 tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
381 tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
382 }
383 373
384 if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) 374 if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
385 xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n", 375 xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",