vt: Add a vt_ helper for console keyboard code input
authorAlan Cox <alan@linux.intel.com>
Sun, 4 Jan 2015 17:37:10 +0000 (17:37 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 4 Jan 2015 17:37:10 +0000 (17:37 +0000)
Kernel/include/tty.h
Kernel/include/vt.h
Kernel/vt.c

index c1265ae..89527e6 100644 (file)
@@ -139,8 +139,7 @@ struct termios {
 #define KBMAPSIZE      0x20
 #define KBMAPGET       0x21
 #define VTSIZE         0x22
-
-#define CTRL(c)  (c & 0x1f)
+#define KBSETTRANS     0x23
 
 /* Character Input Queue size */
 #define TTYSIZ 132
index 4968769..ef820a9 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __VT_DOT_H__
 #define __VT_DOT_H__
 
+#include <keycode.h>
+
 /* Optional defines */
 
 #ifndef MAX_VT
@@ -38,5 +40,6 @@ void scroll_down(void);
 void plot_char(int8_t y, int8_t x, uint16_t c);
 void do_beep(void);
 int vt_ioctl(uint8_t minor, uint16_t op, char *ptr);
+int vt_inproc(uint8_t minor, unsigned char c);
 
 #endif
\ No newline at end of file
index 2a58d65..d2cfa56 100644 (file)
@@ -193,6 +193,14 @@ int vt_ioctl(uint8_t minor, uint16_t request, char *data)
                                return KEY_ROWS << 8 | KEY_COLS;
                        case KBMAPGET:
                                return uput(keymap, data, sizeof(keymap));
+                       case KBSETTRANS:
+                               if (esuper())
+                                       return -1;
+                               if (uget(keyboard, data, sizeof(keyboard)) == -1)
+                                       return -1;
+                               return uget(shiftkeyboard,
+                                       data + sizeof(keyboard),
+                                       sizeof(shiftkeyboard));
                        case VTSIZE:
                                return VT_HEIGHT << 8 | VT_WIDTH;
                }
@@ -200,6 +208,29 @@ int vt_ioctl(uint8_t minor, uint16_t request, char *data)
        return tty_ioctl(minor, request, data);
 }
 
+int vt_inproc(uint8_t minor, unsigned char c)
+{
+#ifdef CONFIG_UNIKEY
+       if (c == KEY_POUND) {
+               tty_inproc(minor, 0xC2);
+               return tty_inproc(minor, 0xA3);
+       }
+       if (c == KEY_HALF) {
+               tty_inproc(minor, 0xC2);
+               return tty_inproc(minor, 0xBD);
+       }
+       f (c == KEY_EURO) {
+               tty_inproc(minor, 0xE2);
+               tty_inproc(minor, 0x82);
+               return tty_inproc(minor, 0xAC);
+       }
+#endif
+       if (c > 0x9F) {
+               tty_inproc(minor, KEY_ESC);
+               c &= 0x7F;
+       }
+       return tty_inproc(minor, c);
+}
 
 void vtinit(void)
 {