summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kbdcontrol/kbdcontrol.c
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1999-03-10 10:36:53 +0000
committeryokota <yokota@FreeBSD.org>1999-03-10 10:36:53 +0000
commit1c67fa8f3d842ef1daea6a8442e829e386fafdd5 (patch)
tree41f00cd620389bf07e2912551d080e830f0dc85a /usr.sbin/kbdcontrol/kbdcontrol.c
parent6eb9a9adf91724bc8f8bb0516ce6bc9f52b58d95 (diff)
downloadFreeBSD-src-1c67fa8f3d842ef1daea6a8442e829e386fafdd5.zip
FreeBSD-src-1c67fa8f3d842ef1daea6a8442e829e386fafdd5.tar.gz
Keyboard driver update in preparation for the USB keyboard driver.
- Refined internal interface in keyboard drivers so that: 1. the side effect of device probe is kept minimal, 2. polling mode function is added, 3. and new ioctl and configuration options are added (see below). - Added new ioctl: KDSETREPEAT Set keyboard typematic rate. There has existed an ioctl command, KDSETRAD, for the same purpose. However, KDSETRAD is dependent on the AT keyboard. KDSETREPEAT provides more generic interface. KDSETRAD will still be supported in the atkbd driver. - Added new configuration options: ATKBD_DFLT_KEYMAP Specify a keymap to be used as the default, built-in keymap. (There has been undocumented options, DKKEYMAP, UKKEYMAP, GRKEYMAP, SWKEYMAP, RUKEYMAP, ESKEYMAP, and ISKEYMAP to set the default keymap. These options are now gone for good. The new option is more general.) KBD_DISABLE_KEYMAP_LOADING Don't allow the user to change the keymap.
Diffstat (limited to 'usr.sbin/kbdcontrol/kbdcontrol.c')
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
index b5a9457..f02c68b 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: kbdcontrol.c,v 1.21 1999/01/12 23:06:29 mjacob Exp $";
+ "$Id: kbdcontrol.c,v 1.22 1999/01/23 17:04:13 dfr Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -88,13 +88,6 @@ char fkey_table[96][MAXFK] = {
/* 93-96 */ "" , "" , "" , "" ,
};
-const int delays[] = {250, 500, 750, 1000};
-const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63,
- 68, 76, 84, 92, 100, 110, 118, 126,
- 136, 152, 168, 184, 200, 220, 236, 252,
- 272, 304, 336, 368, 400, 440, 472, 504};
-const int ndelays = (sizeof(delays) / sizeof(int));
-const int nrepeats = (sizeof(repeats) / sizeof(int));
int hex = 0;
int number;
char letter;
@@ -417,8 +410,13 @@ print_entry(FILE *fp, int value)
}
+#ifdef __i386__
void
print_key_definition_line(FILE *fp, int scancode, struct keyent_t *key)
+#else
+void
+print_key_definition_line(FILE *fp, int scancode, struct key_t *key)
+#endif
{
int i;
@@ -814,13 +812,14 @@ badopt:
void
set_keyrates(char *opt)
{
+ int arg[2];
int repeat;
int delay;
if (!strcmp(opt, "slow"))
- delay = 3, repeat = 31;
+ delay = 1000, repeat = 500;
else if (!strcmp(opt, "normal"))
- delay = 1, repeat = 15;
+ delay = 500, repeat = 125;
else if (!strcmp(opt, "fast"))
delay = repeat = 0;
else {
@@ -837,17 +836,11 @@ badopt:
warnx("argument to -r must be delay.repeat");
return;
}
- for (n = 0; n < ndelays - 1; n++)
- if (delay <= delays[n])
- break;
- delay = n;
- for (n = 0; n < nrepeats - 1; n++)
- if (repeat <= repeats[n])
- break;
- repeat = n;
}
- if (ioctl(0, KDSETRAD, (delay << 5) | repeat) < 0)
+ arg[0] = delay;
+ arg[1] = repeat;
+ if (ioctl(0, KDSETREPEAT, arg))
warn("setting keyboard rate");
}
@@ -866,7 +859,6 @@ set_history(char *opt)
warn("setting history buffer size");
}
-#ifdef __i386__
static char
*get_kbd_type_name(int type)
{
@@ -960,22 +952,15 @@ release_keyboard(void)
if (ioctl(0, CONS_RELKBD, 0) == -1)
warn("unable to release the keyboard");
}
-#endif /* __i386__ */
static void
usage()
{
fprintf(stderr, "%s\n%s\n%s\n",
-#ifdef __i386__
"usage: kbdcontrol [-dFKix] [-b duration.pitch | [quiet.]belltype]",
" [-r delay.repeat | speed] [-l mapfile] [-f # string]",
" [-h size] [-k device] [-L mapfile]");
-#else
-"usage: kbdcontrol [-dFx] [-b duration.pitch | [quiet.]belltype]",
-" [-r delay.repeat | speed] [-l mapfile] [-f # string]",
-" [-h size] [-L mapfile]");
-#endif
exit(1);
}
@@ -985,11 +970,7 @@ main(int argc, char **argv)
{
int opt;
-#ifdef __i386__
while((opt = getopt(argc, argv, "b:df:h:iKk:Fl:L:r:x")) != -1)
-#else
- while((opt = getopt(argc, argv, "b:df:h:Fl:L:r:x")) != -1)
-#endif
switch(opt) {
case 'b':
set_bell_values(optarg);
@@ -1013,7 +994,6 @@ main(int argc, char **argv)
case 'h':
set_history(optarg);
break;
-#ifdef __i386__
case 'i':
show_kbd_info();
break;
@@ -1023,7 +1003,6 @@ main(int argc, char **argv)
case 'k':
set_keyboard(optarg);
break;
-#endif /* __i386__ */
case 'r':
set_keyrates(optarg);
break;
OpenPOWER on IntegriCloud