libpayload/keyboard: Add a detention state
Instead of ignoring keyboards indefinitely when they failed to initialize, we wait 5s and then start over with the hotplug detection. As we always assume a present keyboard at first, we'd otherwise never have a chance to hot plug a device after the initial 30s timer ran out. Change-Id: I8dec4921b2e932442d52b5118cdcf27090633498 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48774 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
e97d320df2
commit
4dc92782fc
|
@ -259,7 +259,7 @@ static enum keyboard_state {
|
||||||
STATE_ENABLE_SCAN,
|
STATE_ENABLE_SCAN,
|
||||||
STATE_RUNNING,
|
STATE_RUNNING,
|
||||||
STATE_RUNNING_ECHO,
|
STATE_RUNNING_ECHO,
|
||||||
STATE_IGNORE,
|
STATE_DETENTION,
|
||||||
} keyboard_state;
|
} keyboard_state;
|
||||||
|
|
||||||
#define STATE_NAMES_ENTRY(name) [STATE_##name] = #name
|
#define STATE_NAMES_ENTRY(name) [STATE_##name] = #name
|
||||||
|
@ -279,7 +279,7 @@ static const char *const state_names[] = {
|
||||||
STATE_NAMES_ENTRY(ENABLE_SCAN),
|
STATE_NAMES_ENTRY(ENABLE_SCAN),
|
||||||
STATE_NAMES_ENTRY(RUNNING),
|
STATE_NAMES_ENTRY(RUNNING),
|
||||||
STATE_NAMES_ENTRY(RUNNING_ECHO),
|
STATE_NAMES_ENTRY(RUNNING_ECHO),
|
||||||
STATE_NAMES_ENTRY(IGNORE),
|
STATE_NAMES_ENTRY(DETENTION),
|
||||||
};
|
};
|
||||||
|
|
||||||
__attribute__((unused))
|
__attribute__((unused))
|
||||||
|
@ -455,8 +455,9 @@ static void keyboard_poll(void)
|
||||||
state_time = timer_us(0);
|
state_time = timer_us(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_IGNORE:
|
case STATE_DETENTION:
|
||||||
/* TODO: Try again after timeout if it ever seems useful. */
|
if (timer_us(state_time) > 5*1000*1000)
|
||||||
|
next_state = STATE_HOTPLUG;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -467,11 +468,11 @@ static void keyboard_poll(void)
|
||||||
case STATE_HOTPLUG_ECHO:
|
case STATE_HOTPLUG_ECHO:
|
||||||
case STATE_RUNNING:
|
case STATE_RUNNING:
|
||||||
case STATE_RUNNING_ECHO:
|
case STATE_RUNNING_ECHO:
|
||||||
case STATE_IGNORE:
|
case STATE_DETENTION:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (timer_us(keyboard_time) > 30*1000*1000)
|
if (timer_us(keyboard_time) > 30*1000*1000)
|
||||||
next_state = STATE_IGNORE;
|
next_state = STATE_DETENTION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue