Skip to content

Commit

Permalink
Add a system76_ec command to disable input events
Browse files Browse the repository at this point in the history
For testing purposes.
  • Loading branch information
ids1024 committed Nov 18, 2021
1 parent 3e342a8 commit 708ed51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions keyboards/system76/launch_1/launch_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions keyboards/system76/system76_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 708ed51

Please sign in to comment.