device: fix no-output values for persistent key mappings

This commit is contained in:
Peter F. Patel-Schneider 2022-06-26 11:57:37 -04:00
parent 34685852aa
commit 2658fbba5a
2 changed files with 3 additions and 2 deletions

View File

@ -729,7 +729,7 @@ class KeysArrayPersistent(KeysArray):
elif actionId == special_keys.ACTIONID.Consumer: elif actionId == special_keys.ACTIONID.Consumer:
remapped = special_keys.HID_CONSUMERCODES[remapped] remapped = special_keys.HID_CONSUMERCODES[remapped]
elif actionId == special_keys.ACTIONID.Empty: # purge data from empty value elif actionId == special_keys.ACTIONID.Empty: # purge data from empty value
remapped = modifiers = status = 0 remapped = modifiers = 0
self.keys[index] = PersistentRemappableAction(self.device, index, key, actionId, remapped, modifiers, status) self.keys[index] = PersistentRemappableAction(self.device, index, key, actionId, remapped, modifiers, status)
elif _log.isEnabledFor(_WARNING): elif _log.isEnabledFor(_WARNING):
_log.warn(f"Key with index {index} was expected to exist but device doesn't report it.") _log.warn(f"Key with index {index} was expected to exist but device doesn't report it.")

View File

@ -758,6 +758,7 @@ USB_HID_KEYCODES = _NamedInts(
MEDIA_REFRESH=0xfa, MEDIA_REFRESH=0xfa,
MEDIA_CALC=0xfb, MEDIA_CALC=0xfb,
) )
USB_HID_KEYCODES[0] = 'No Output'
USB_HID_KEYCODES[0x1e] = '1' USB_HID_KEYCODES[0x1e] = '1'
USB_HID_KEYCODES[0x1f] = '2' USB_HID_KEYCODES[0x1f] = '2'
USB_HID_KEYCODES[0x20] = '3' USB_HID_KEYCODES[0x20] = '3'
@ -1237,7 +1238,7 @@ for code in HORIZONTAL_SCROLL:
def persistent_keys(action_ids): def persistent_keys(action_ids):
keys = _UnsortedNamedInts() keys = _UnsortedNamedInts()
keys[KEYS_Default] = 'Default' # Value to reset to default keys[KEYS_Default] = 'Default' # Value to reset to default
keys[0] = 'None' # Value for no output keys[0] = 'No Output (only as default)'
for key in KEYS: for key in KEYS:
if (int(key) >> 24) in action_ids: if (int(key) >> 24) in action_ids:
keys[int(key)] = str(key) keys[int(key)] = str(key)