From: Alan Cox Date: Sun, 6 Mar 2016 20:06:38 +0000 (+0000) Subject: vt: keyboard repeat rate ioctls X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1e03517bb40682cecc8ac4949c3e09104d5c30f8;p=FUZIX.git vt: keyboard repeat rate ioctls --- diff --git a/Kernel/include/tty.h b/Kernel/include/tty.h index c7e31683..dc18afda 100644 --- a/Kernel/include/tty.h +++ b/Kernel/include/tty.h @@ -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 */ diff --git a/Kernel/include/vt.h b/Kernel/include/vt.h index bde4f9d3..48aedeef 100644 --- a/Kernel/include/vt.h +++ b/Kernel/include/vt.h @@ -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 diff --git a/Kernel/vt.c b/Kernel/vt.c index 7637d982..5270984d 100644 --- a/Kernel/vt.c +++ b/Kernel/vt.c @@ -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;