From 708ed51b801d73b6627a8db2c08b702c49ea7a6a Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 18 Nov 2021 13:04:54 -0800 Subject: [PATCH] Add a system76_ec command to disable input events For testing purposes. --- keyboards/system76/launch_1/launch_1.c | 4 ++++ keyboards/system76/system76_ec.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/keyboards/system76/launch_1/launch_1.c b/keyboards/system76/launch_1/launch_1.c index 92afab8cee3f..4175f93edd45 100644 --- a/keyboards/system76/launch_1/launch_1.c +++ b/keyboards/system76/launch_1/launch_1.c @@ -132,6 +132,7 @@ static const uint8_t levels[] = { }; static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; static void set_value_all_layers(uint8_t value) { if (!system76_ec_is_unlocked()) { @@ -143,6 +144,9 @@ static void set_value_all_layers(uint8_t value) { } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) + return false; + switch(keycode) { case RESET: if (record->event.pressed) { diff --git a/keyboards/system76/system76_ec.c b/keyboards/system76/system76_ec.c index 340db40448b3..78ba327985af 100644 --- a/keyboards/system76/system76_ec.c +++ b/keyboards/system76/system76_ec.c @@ -34,8 +34,12 @@ enum Command { CMD_MATRIX_GET = 17, // Save LED settings to ROM CMD_LED_SAVE = 18, + // Enable/disable no input mode + CMD_SET_NO_INPUT = 19, }; +bool input_disabled = false; + #define CMD_LED_INDEX_ALL 0xFF static bool keymap_get(uint8_t layer, uint8_t output, uint8_t input, uint16_t *value) { @@ -406,6 +410,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { data[1] = 0; } break; + case CMD_SET_NO_INPUT: + { + clear_keyboard(); + input_disabled = data[2] != 0; + data[1] = 0; + } + break; } raw_hid_send(data, length);