Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142585663
D38818.id118968.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D38818.id118968.diff
View Options
diff --git a/sys/dev/adb/adb_kbd.c b/sys/dev/adb/adb_kbd.c
--- a/sys/dev/adb/adb_kbd.c
+++ b/sys/dev/adb/adb_kbd.c
@@ -688,14 +688,7 @@
static int
set_typematic(keyboard_t *kbd, int code)
{
- /* These numbers are in microseconds, so convert to ticks */
-
- static int delays[] = { 250, 500, 750, 1000 };
- static int rates[] = { 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 };
-
+ /* Delays and rates from kbdio.h are in microseconds, so convert to ticks */
if (code & ~0x7f)
return EINVAL;
kbd->kb_delay1 = delays[(code >> 5) & 3];
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c
--- a/sys/dev/atkbdc/atkbd.c
+++ b/sys/dev/atkbdc/atkbd.c
@@ -1571,12 +1571,6 @@
return ((id2 << 8) | id1);
}
-static int delays[] = { 250, 500, 750, 1000 };
-static int rates[] = { 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 };
-
static int
typematic_delay(int i)
{
diff --git a/sys/dev/gpio/gpiokeys.c b/sys/dev/gpio/gpiokeys.c
--- a/sys/dev/gpio/gpiokeys.c
+++ b/sys/dev/gpio/gpiokeys.c
@@ -975,12 +975,6 @@
static int
gpiokeys_set_typematic(keyboard_t *kbd, int code)
{
- static const int delays[] = {250, 500, 750, 1000};
- static const int rates[] = {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};
-
if (code & ~0x7f) {
return (EINVAL);
}
diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c
--- a/sys/dev/hid/hkbd.c
+++ b/sys/dev/hid/hkbd.c
@@ -1832,12 +1832,6 @@
#ifdef EVDEV_SUPPORT
struct hkbd_softc *sc = kbd->kb_data;
#endif
- static const int delays[] = {250, 500, 750, 1000};
- static const int rates[] = {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};
-
if (code & ~0x7f) {
return (EINVAL);
}
diff --git a/sys/dev/kbdmux/kbdmux.c b/sys/dev/kbdmux/kbdmux.c
--- a/sys/dev/kbdmux/kbdmux.c
+++ b/sys/dev/kbdmux/kbdmux.c
@@ -963,17 +963,6 @@
static int
kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
{
- static int delays[] = {
- 250, 500, 750, 1000
- };
-
- static int rates[] = {
- 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
- };
-
kbdmux_state_t *state = (kbdmux_state_t *) kbd->kb_data;
kbdmux_kbd_t *k;
keyboard_info_t *ki;
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -2002,12 +2002,6 @@
#ifdef EVDEV_SUPPORT
struct ukbd_softc *sc = kbd->kb_data;
#endif
- static const int delays[] = {250, 500, 750, 1000};
- static const int rates[] = {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};
-
if (code & ~0x7f) {
return (EINVAL);
}
diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c
--- a/sys/dev/vkbd/vkbd.c
+++ b/sys/dev/vkbd/vkbd.c
@@ -1305,12 +1305,6 @@
* Local functions
*/
-static int delays[] = { 250, 500, 750, 1000 };
-static int rates[] = { 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 };
-
static int
typematic_delay(int i)
{
diff --git a/sys/sys/kbio.h b/sys/sys/kbio.h
--- a/sys/sys/kbio.h
+++ b/sys/sys/kbio.h
@@ -70,6 +70,13 @@
};
typedef struct keyboard_info keyboard_info_t;
+/* keyboard repeat rate mapping table */
+static const int delays[] = { 250, 500, 750, 1000 };
+static const int rates[] = { 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 };
+
/* add/remove keyboard to/from mux */
#define KBADDKBD _IOW('K', 68, keyboard_info_t) /* add keyboard */
#define KBRELKBD _IOW('K', 69, keyboard_info_t) /* release keyboard */
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -107,13 +107,8 @@
/* 93-96 */ "" , "" , "" , "" ,
};
-static const int delays[] = {250, 500, 750, 1000};
-static 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};
static const int ndelays = (sizeof(delays) / sizeof(int));
-static const int nrepeats = (sizeof(repeats) / sizeof(int));
+static const int nrepeats = (sizeof(rates) / sizeof(int));
static int hex = 0;
static int paths_configured = 0;
static int token;
@@ -1058,14 +1053,20 @@
int r, d;
if (!strcmp(opt, "slow")) {
- delay = 1000, repeat = 500;
- d = 3, r = 31;
+ delay = 1000;
+ repeat = 504;
+ d = 3;
+ r = 31;
} else if (!strcmp(opt, "normal")) {
- delay = 500, repeat = 125;
- d = 1, r = 15;
+ delay = 500;
+ repeat = 126;
+ d = 1;
+ r = 15;
} else if (!strcmp(opt, "fast")) {
- delay = repeat = 0;
- d = r = 0;
+ delay = 0;
+ repeat = 0;
+ d = 0;
+ r = 0;
} else {
int n;
char *v1;
@@ -1085,7 +1086,7 @@
break;
d = n;
for (n = 0; n < nrepeats - 1; n++)
- if (repeat <= repeats[n])
+ if (repeat <= rates[n])
break;
r = n;
}
@@ -1093,6 +1094,7 @@
arg[0] = delay;
arg[1] = repeat;
if (ioctl(0, KDSETREPEAT, arg)) {
+ warn("fallback, setting keyboard rate via legacy interface (KDSETRAD), will be removed soon");
if (ioctl(0, KDSETRAD, (d << 5) | r))
warn("setting keyboard rate");
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 22, 7:11 AM (41 m, 57 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27833777
Default Alt Text
D38818.id118968.diff (5 KB)
Attached To
Mode
D38818: consolidate kb interfaces
Attached
Detach File
Event Timeline
Log In to Comment