vial: allow resuming an interrupted unlock sequence
This commit is contained in:
parent
e2447a0eea
commit
cc43ad2b41
@ -220,9 +220,14 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||||||
uint8_t *command_data = &(data[1]);
|
uint8_t *command_data = &(data[1]);
|
||||||
|
|
||||||
#ifdef VIAL_ENABLE
|
#ifdef VIAL_ENABLE
|
||||||
/* When unlock is in progress, only command we react to is unlock_poll */
|
/* When unlock is in progress, we can only react to a subset of commands */
|
||||||
if (vial_unlock_in_progress && (data[0] != id_vial_prefix || data[1] != vial_unlock_poll))
|
if (vial_unlock_in_progress) {
|
||||||
goto skip;
|
if (data[0] != id_vial_prefix)
|
||||||
|
goto skip;
|
||||||
|
uint8_t cmd = data[1];
|
||||||
|
if (cmd != vial_get_keyboard_id && cmd != vial_get_size && cmd != vial_get_def && cmd != vial_get_unlock_status && cmd != vial_unlock_start && cmd != vial_unlock_poll)
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (*command_id) {
|
switch (*command_id) {
|
||||||
|
@ -105,7 +105,8 @@ void vial_handle_cmd(uint8_t *msg, uint8_t length) {
|
|||||||
memset(msg, 0xFF, length);
|
memset(msg, 0xFF, length);
|
||||||
/* First byte of message contains the status: whether board is unlocked */
|
/* First byte of message contains the status: whether board is unlocked */
|
||||||
msg[0] = vial_unlocked;
|
msg[0] = vial_unlocked;
|
||||||
msg[1] = 0;
|
/* Second byte is whether unlock is in progress */
|
||||||
|
msg[1] = vial_unlock_in_progress;
|
||||||
#ifndef VIAL_INSECURE
|
#ifndef VIAL_INSECURE
|
||||||
/* Rest of the message are keys in the matrix that should be held to unlock the board */
|
/* Rest of the message are keys in the matrix that should be held to unlock the board */
|
||||||
for (size_t i = 0; i < VIAL_UNLOCK_NUM_KEYS; ++i) {
|
for (size_t i = 0; i < VIAL_UNLOCK_NUM_KEYS; ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user