via/vial: kill all rawhid handling while unlocking
This commit is contained in:
parent
1b670b3fea
commit
cc59ab21c5
@ -218,6 +218,13 @@ __attribute__((weak)) void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
|
|||||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||||
uint8_t *command_id = &(data[0]);
|
uint8_t *command_id = &(data[0]);
|
||||||
uint8_t *command_data = &(data[1]);
|
uint8_t *command_data = &(data[1]);
|
||||||
|
|
||||||
|
#ifdef VIAL_ENABLE
|
||||||
|
/* When unlock is in progress, only command we react to is unlock_poll */
|
||||||
|
if (vial_unlock_in_progress && (data[0] != id_vial_prefix || data[1] != vial_unlock_poll))
|
||||||
|
goto skip;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (*command_id) {
|
switch (*command_id) {
|
||||||
case id_get_protocol_version: {
|
case id_get_protocol_version: {
|
||||||
command_data[0] = VIA_PROTOCOL_VERSION >> 8;
|
command_data[0] = VIA_PROTOCOL_VERSION >> 8;
|
||||||
@ -419,7 +426,7 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef VIAL_ENABLE
|
#ifdef VIAL_ENABLE
|
||||||
case 0xFE: {
|
case id_vial_prefix: {
|
||||||
vial_handle_cmd(data, length);
|
vial_handle_cmd(data, length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ enum via_command_id {
|
|||||||
id_dynamic_keymap_get_layer_count = 0x11,
|
id_dynamic_keymap_get_layer_count = 0x11,
|
||||||
id_dynamic_keymap_get_buffer = 0x12,
|
id_dynamic_keymap_get_buffer = 0x12,
|
||||||
id_dynamic_keymap_set_buffer = 0x13,
|
id_dynamic_keymap_set_buffer = 0x13,
|
||||||
|
id_vial_prefix = 0xFE,
|
||||||
id_unhandled = 0xFF,
|
id_unhandled = 0xFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,18 +25,6 @@
|
|||||||
|
|
||||||
#define VIAL_UNLOCK_COUNTER_MAX 50
|
#define VIAL_UNLOCK_COUNTER_MAX 50
|
||||||
|
|
||||||
enum {
|
|
||||||
vial_get_keyboard_id = 0x00,
|
|
||||||
vial_get_size = 0x01,
|
|
||||||
vial_get_def = 0x02,
|
|
||||||
vial_get_encoder = 0x03,
|
|
||||||
vial_set_encoder = 0x04,
|
|
||||||
vial_get_lock = 0x05,
|
|
||||||
vial_unlock_start = 0x06,
|
|
||||||
vial_unlock_poll = 0x07,
|
|
||||||
vial_lock = 0x08,
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef VIAL_INSECURE
|
#ifdef VIAL_INSECURE
|
||||||
#pragma message "Building Vial-enabled firmware in insecure mode."
|
#pragma message "Building Vial-enabled firmware in insecure mode."
|
||||||
int vial_unlocked = 1;
|
int vial_unlocked = 1;
|
||||||
|
@ -29,3 +29,15 @@ void vial_encoder_update(uint8_t index, bool clockwise);
|
|||||||
|
|
||||||
extern int vial_unlocked;
|
extern int vial_unlocked;
|
||||||
extern int vial_unlock_in_progress;
|
extern int vial_unlock_in_progress;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
vial_get_keyboard_id = 0x00,
|
||||||
|
vial_get_size = 0x01,
|
||||||
|
vial_get_def = 0x02,
|
||||||
|
vial_get_encoder = 0x03,
|
||||||
|
vial_set_encoder = 0x04,
|
||||||
|
vial_get_lock = 0x05,
|
||||||
|
vial_unlock_start = 0x06,
|
||||||
|
vial_unlock_poll = 0x07,
|
||||||
|
vial_lock = 0x08,
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user