kbc: Handle setting typematic rate/delay

Per [1], use a default delay of 500ms and a rate of 10.9 CPS. When the
Linux kernel starts, this will be updated by atkbd to the fastest
settings possible [2]: 250ms delay and 30 CPS.

Modifying these values with kbdrate to test settings will cause two
spurious ACKs in the kernel. This behavior is also present in the
proprietary firmware.

[1]: https://web.archive.org/web/20180217074705/http://computer-engineering.org/ps2keyboard/
[2]: c5f8689118/drivers/input/keyboard/atkbd.c (L863-L868)
This commit is contained in:
Tim Crawford
2020-02-25 14:20:13 -07:00
parent a8f921fcab
commit a176da0ebe
9 changed files with 198 additions and 9 deletions

View File

@@ -9,6 +9,8 @@
#include <common/debug.h>
bool kbscan_enabled = false;
uint16_t kbscan_repeat_period = 91;
uint16_t kbscan_repeat_delay = 500;
uint8_t sci_extra = 0;
@@ -232,7 +234,7 @@ void kbscan_event(void) {
if (time < repeat_key_time) {
// Overflow, reset repeat_key_time
repeat_key_time = time;
} else if ((time - repeat_key_time) >= 500) {
} else if ((time - repeat_key_time) >= kbscan_repeat_delay) {
// Typematic repeat
repeat = true;
repeat_start = time;
@@ -240,8 +242,7 @@ void kbscan_event(void) {
}
if (repeat) {
// FIXME: resend key at typematic rate
if ((time - repeat_start) > 60) {
if ((time - repeat_start) > kbscan_repeat_period) {
kbscan_press(repeat_key, true, &layer);
repeat_start = time;
}