diff options
author | Devaev Maxim <[email protected]> | 2019-09-26 10:26:21 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-09-26 10:26:21 +0300 |
commit | 31c17bb583717bf99fa5990d6a4507bebe8086ce (patch) | |
tree | e774256754a658f471673943ecee59c5e3c31915 /genmap.py | |
parent | cbebefc6c97c45b8e7c63c07df8c355077fed657 (diff) |
otg keymap
Diffstat (limited to 'genmap.py')
-rwxr-xr-x | genmap.py | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -33,9 +33,11 @@ import mako.template # ===== @dataclasses.dataclass(frozen=True) class _KeyMapping: - serial_hid_code: int - serial_hid_key: str web_key: str + serial_code: int + arduino_key: str + otg_code: int + otg_is_modifier: bool def _read_keymap_in(path: str) -> List[_KeyMapping]: @@ -45,11 +47,13 @@ def _read_keymap_in(path: str) -> List[_KeyMapping]: line = line.strip() if len(line) > 0 and not line.startswith("#"): parts = list(map(str.strip, line.split())) - if len(parts) >= 3: + if len(parts) >= 5: keymap.append(_KeyMapping( - serial_hid_code=int(parts[0]), - serial_hid_key=parts[1], - web_key=parts[2], + web_key=parts[0], + serial_code=int(parts[1]), + arduino_key=parts[2], + otg_code=int(parts[3], 16), + otg_is_modifier=(parts[4].lower() == "m"), )) return keymap |