diff --git a/src/main/python/keyboard_comm.py b/src/main/python/keyboard_comm.py index d245788..a150637 100644 --- a/src/main/python/keyboard_comm.py +++ b/src/main/python/keyboard_comm.py @@ -5,6 +5,7 @@ import json import lzma from collections import OrderedDict +from keycodes import RESET_KEYCODE from kle_serial import Serial as KleSerial from unlocker import Unlocker from util import MSG_LEN, hid_send, chunks @@ -208,6 +209,9 @@ class Keyboard: key = (layer, row, col) if self.layout[key] != code: + if code == RESET_KEYCODE: + Unlocker.get().perform_unlock(self) + self.usb_send(self.dev, struct.pack(">BBBBH", CMD_VIA_SET_KEYCODE, layer, row, col, code), retries=20) self.layout[key] = code @@ -217,6 +221,9 @@ class Keyboard: key = (layer, index, direction) if self.encoder_layout[key] != code: + if code == RESET_KEYCODE: + Unlocker.get().perform_unlock(self) + self.usb_send(self.dev, struct.pack(">BBBBBH", CMD_VIA_VIAL_PREFIX, CMD_VIAL_SET_ENCODER, layer, index, direction, code), retries=20) self.encoder_layout[key] = code diff --git a/src/main/python/keycodes.py b/src/main/python/keycodes.py index bc7f214..ebaffed 100644 --- a/src/main/python/keycodes.py +++ b/src/main/python/keycodes.py @@ -227,8 +227,11 @@ def LT(layer): return QK_LAYER_TAP | (((layer) & 0xF) << 8) +RESET_KEYCODE = 0x5C00 + + KEYCODES_QUANTUM = [ - K(0x5C00, "RESET", "Reset", "Reboot to bootloader"), + K(RESET_KEYCODE, "RESET", "Reset", "Reboot to bootloader"), K(QK_ONE_SHOT_MOD | MOD_LSFT, "OSM(MOD_LSFT)", "OSM\nLSft", "Enable Left Shift for one keypress"), K(QK_ONE_SHOT_MOD | MOD_LCTL, "OSM(MOD_LCTL)", "OSM\nLCtl", "Enable Left Control for one keypress"), K(QK_ONE_SHOT_MOD | MOD_LALT, "OSM(MOD_LALT)", "OSM\nLAlt", "Enable Left Alt for one keypress"),