From ed14e1a4d70dc53b47eb36cf8a647fe854c5ec0f Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Sat, 26 Jan 2013 20:55:12 +0100 Subject: Stupid hotfix for keyboard hickups --- kbc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kbc.c b/kbc.c index a1f70b8..95665c9 100644 --- a/kbc.c +++ b/kbc.c @@ -360,6 +360,7 @@ static uint8_t wait_byte(void) static uint8_t cntr = 0; static uint8_t close_try = 0; +static uint8_t idle_looped = 0; #ifdef KILLSWITCH static uint8_t error; #endif @@ -426,7 +427,13 @@ static void state_enter(void) break; if (send_byte(0x00) != 0xfa) break; - nextstate = STATE_NONE; + + /* We have some issues with the keyboard failing every + * now and then. Until we know more about the issue, + * reset it every 256th time we enter STATE_IDLE :/ */ + idle_looped += 1; + if (idle_looped != 0xff) + nextstate = STATE_NONE; break; case STATE_IDLEBLINK: toutstate = STATE_IDLE; @@ -441,6 +448,7 @@ static void state_enter(void) break; case STATE_INPUT: toutstate = STATE_IDLE; + idle_looped = 0; /* input still works, reset idle counter */ statecntr = WAIT_INPUT; if (send_byte(0xed) != 0xfa) break; -- cgit v1.2.1