84 lines
3.3 KiB
Text
84 lines
3.3 KiB
Text
$NetBSD: patch-ah,v 1.2 2003/07/31 15:12:40 bencollver Exp $
|
|
|
|
--- src/keyboard/keyboard.c.orig Sun Oct 8 05:37:40 2000
|
|
+++ src/keyboard/keyboard.c
|
|
@@ -28,12 +28,12 @@
|
|
#include <sys/ioctl.h>
|
|
#include <fcntl.h>
|
|
#include <termios.h>
|
|
-#include <linux/kd.h>
|
|
/* linux/keyboard.h defines NR_KEYS and some scancode-like constants, so it */
|
|
/* should also be useful for svgalib programs using the keyboard. It misses */
|
|
/* a few KERNEL ifdefs around kernel data structures though. */
|
|
+#include <dev/wscons/wsconsio.h>
|
|
+#include <dev/wscons/wsdisplay_usl_io.h>
|
|
#include <linux/keyboard.h>
|
|
-#include <sys/vt.h>
|
|
/* Needed to check uid of keymap files */
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
@@ -46,7 +46,7 @@
|
|
void (*__svgalib_keyboard_eventhandler) (int, int);
|
|
|
|
static struct termios oldkbdtermios, newkbdtermios;
|
|
-static int oldkbmode;
|
|
+static int oldkbmode, newkbmode;
|
|
/* vga.c needs to check that: */
|
|
int __svgalib_kbd_fd = -1; /* nowadays merely used as a flag */
|
|
static int c_state, ctrl_state, alt_state, functionkey_state, win_state;
|
|
@@ -69,10 +69,11 @@ static char keynames[NR_KEYS][MAX_KEYNAM
|
|
"KP_4", "KP_5", "KP_6", "KP_Add",
|
|
"KP_1", "KP_2", "KP_3",
|
|
"KP_0", "KP_Period",
|
|
- "Last_Console", "", "less", "F11", "F12", "", "", "", "", "", "", "",
|
|
- "KP_Enter", "Control", "KP_Divide", "Control_backslash", "AltGr", "Break",
|
|
+ "Last_Console", "", "less", "F11", "F12",
|
|
+ "KP_Enter", "Control", "KP_Divide", "Control_backslash", "AltGr",
|
|
"Find", "Up", "Prior", "Left", "Right", "Select", "Down", "Next", "Insert",
|
|
- "Remove", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
|
+ "Remove", "Break", "", "", "", "", "", "",
|
|
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
|
};
|
|
static void default_handler(int, int);
|
|
static char *kbd_load_keymap(char *ptr);
|
|
@@ -326,21 +327,27 @@ int keyboard_init_return_fd(void) {
|
|
__svgalib_open_devconsole();
|
|
__svgalib_kbd_fd = __svgalib_tty_fd; /* We are initialized. */
|
|
|
|
- if (ioctl(__svgalib_kbd_fd, KDGKBMODE, &oldkbmode)) {
|
|
+ if (ioctl(__svgalib_kbd_fd, WSKBDIO_GETMODE, &oldkbmode)) {
|
|
printf("svgalib: cannot get keyboard mode.\n");
|
|
return -1;
|
|
}
|
|
tcgetattr(__svgalib_kbd_fd, &oldkbdtermios);
|
|
newkbdtermios = oldkbdtermios;
|
|
|
|
+ cfmakeraw(&newkbdtermios);
|
|
newkbdtermios.c_lflag &= ~(ICANON | ECHO | ISIG);
|
|
- newkbdtermios.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
|
|
+ newkbdtermios.c_oflag = OPOST | ONLCR;
|
|
+ newkbdtermios.c_iflag = IGNPAR | IGNBRK;
|
|
+ newkbdtermios.c_cflag = CREAD | CS8;
|
|
newkbdtermios.c_cc[VMIN] = 0; /* Making these 0 seems to have the */
|
|
newkbdtermios.c_cc[VTIME] = 0; /* desired effect. */
|
|
+ cfsetispeed(&newkbdtermios, 9600);
|
|
+ cfsetospeed(&newkbdtermios, 9600);
|
|
|
|
- tcsetattr(__svgalib_kbd_fd, TCSAFLUSH, &newkbdtermios);
|
|
+ tcsetattr(__svgalib_kbd_fd, TCSANOW, &newkbdtermios);
|
|
|
|
- ioctl(__svgalib_kbd_fd, KDSKBMODE, K_MEDIUMRAW);
|
|
+ newkbmode = WSKBD_RAW;
|
|
+ ioctl(__svgalib_kbd_fd, WSKBDIO_SETMODE, &newkbmode);
|
|
|
|
keyboard_clearstate();
|
|
|
|
@@ -379,7 +386,7 @@ void keyboard_close(void) {
|
|
fake_mouse_events = NULL;
|
|
}
|
|
|
|
- ioctl(__svgalib_kbd_fd, KDSKBMODE, oldkbmode);
|
|
+ ioctl(__svgalib_kbd_fd, WSKBDIO_SETMODE, &oldkbmode);
|
|
tcsetattr(__svgalib_kbd_fd, 0, &oldkbdtermios);
|
|
|
|
__svgalib_kbd_fd = -1;
|