From: Brett Gordon Date: Sun, 9 Oct 2016 14:27:21 +0000 (-0400) Subject: add util to set vt's keyboard's rates X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=dcbc769fb4c24d1195f5caff92263fe982259108;p=FUZIX.git add util to set vt's keyboard's rates --- diff --git a/Applications/util/Makefile b/Applications/util/Makefile index b37376cd..762a8601 100644 --- a/Applications/util/Makefile +++ b/Applications/util/Makefile @@ -69,6 +69,7 @@ SRCS = banner.c \ fsck.c \ grep.c \ id.c \ + kbdrate.c \ ll.c \ ls.c \ man.c \ diff --git a/Applications/util/Makefile.6809 b/Applications/util/Makefile.6809 index 21dd6b6c..f1b75c17 100644 --- a/Applications/util/Makefile.6809 +++ b/Applications/util/Makefile.6809 @@ -76,6 +76,7 @@ SRCS = \ fsck.c \ grep.c \ id.c \ + kbdrate.c \ ll.c \ ls.c \ man.c \ diff --git a/Applications/util/fuzix-util.pkg b/Applications/util/fuzix-util.pkg index 1b7e8f66..f96d20f8 100644 --- a/Applications/util/fuzix-util.pkg +++ b/Applications/util/fuzix-util.pkg @@ -68,6 +68,7 @@ f 0755 /bin/fsck fsck f 0755 /bin/grep grep f 0755 /bin/head head f 0755 /bin/id id +f 0755 /bin/kbdrate kbdrate f 0755 /bin/ll ll f 0755 /bin/logname logname f 0755 /bin/man man diff --git a/Applications/util/kbdrate.c b/Applications/util/kbdrate.c new file mode 100644 index 00000000..2c990477 --- /dev/null +++ b/Applications/util/kbdrate.c @@ -0,0 +1,44 @@ +/* + Small utility to set the keyboard repeat/delay rates +*/ + +#include +#include +#include +#include +#include + + + +void printe( char *m ) +{ + write(2, m, strlen(m) ); + write(1, "\n", 1 ); + exit(1); +} + + +int main( int argc, char **argv ) +{ + int fd; + struct key_repeat k; + int ret; + + if( argc < 3 ) + printe( "usage: kbdrate rate delay"); + + fd=open("/dev/tty", O_RDONLY); + if( ! fd ) + printe( "Cannot open tty dev" ); + + k.continual = atoi( argv[1] ); + k.first = atoi( argv[2] ); + + ret=ioctl( fd, KBRATE, &k ); + if( ret ){ + printe( "failed ioctl"); + } + + close( fd ); + exit(0); +} diff --git a/Library/include/sys/kd.h b/Library/include/sys/kd.h new file mode 100644 index 00000000..a5645cb9 --- /dev/null +++ b/Library/include/sys/kd.h @@ -0,0 +1,20 @@ +/* + Header file for manipulation of the fuxiz console keyboard +*/ + + +/* IOCTL numbers */ +#define KBMAPSIZE 0x20 +#define KBMAPGET 0x21 +#define KBSETTRANS (0x23|IOCTL_SUPER) +#define KBRATE 0x25 + + +/* struct for setting keyboard repeat + delays are demarked in tenths of seconds + */ +struct key_repeat { + uint8_t first; + uint8_t continual; +}; +