vt: keyboard repeat rate ioctls
authorAlan Cox <alan@linux.intel.com>
Sun, 6 Mar 2016 20:06:38 +0000 (20:06 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 6 Mar 2016 20:06:38 +0000 (20:06 +0000)
Kernel/include/tty.h
Kernel/include/vt.h
Kernel/vt.c

index c7e3168..dc18afd 100644 (file)
@@ -148,8 +148,9 @@ struct termios {
 #define KBMAPSIZE      0x20
 #define KBMAPGET       0x21
 #define VTSIZE         0x22
-#define KBSETTRANS     0x23
+#define KBSETTRANS     (0x23|IOCTL_SUPER)
 #define VTATTRS                0x24
+#define KBRATE         0x25
 
 /* Fuzix systems to level 2 have 256 byte tty buffers as per standards, level 1
    boxes may not */
index bde4f9d..48aedee 100644 (file)
@@ -33,6 +33,11 @@ struct vt_switch {
   signed char ncursory;
 };
 
+struct vt_repeat {
+  uint8_t first;
+  uint8_t continual;
+};
+
 /* Core functions */
 void vtoutput(unsigned char *p, unsigned int len);
 void vtinit(void);
@@ -50,9 +55,10 @@ void plot_char(int8_t y, int8_t x, uint16_t c);
 void do_beep(void);
 int vt_ioctl(uint8_t minor, uarg_t op, char *ptr);
 int vt_inproc(uint8_t minor, unsigned char c);
-void vtattr_notify( void );
+void vtattr_notify(void);
 extern uint8_t vtattr_cap;
 extern uint8_t vtink;
 extern uint8_t vtpaper;
+extern struct vt_repeat keyrepeat;
 
 #endif
index 7637d98..5270984 100644 (file)
@@ -285,13 +285,17 @@ int vt_ioctl(uint8_t minor, uarg_t request, char *data)
                        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 KBRATE:
+                               if (uget(&keyrepeat, data, sizeof(keyrepeat)) == -1)
+                                       return -1;
+                               keyrepeat.first *= (TICKSPERSEC/10);
+                               keyrepeat.continual *= (TICKSPERSEC/10);
+                               return 0;
 #endif                                 
                        case VTSIZE:
                                return VT_HEIGHT << 8 | VT_WIDTH;