settings: fix small bugs found from testing

This commit is contained in:
Peter F. Patel-Schneider 2024-03-24 06:57:43 -04:00
parent 6f613b17c7
commit 4fd75a64ff
2 changed files with 7 additions and 8 deletions

View File

@ -555,13 +555,12 @@ class KeysArrayPersistent(KeysArray):
keydata = self.device.feature_request(FEATURE.PERSISTENT_REMAPPABLE_ACTION, 0x20, index, 0xFF)
if keydata:
key = _unpack("!H", keydata[:2])[0]
try:
mapped_data = self.device.feature_request(
FEATURE.PERSISTENT_REMAPPABLE_ACTION, 0x30, key & 0xFF00, key & 0xFF, 0xFF
)
if mapped_data:
_ignore, _ignore, actionId, remapped, modifiers, status = _unpack("!HBBHBB", mapped_data[:8])
except Exception:
mapped_data = self.device.feature_request(
FEATURE.PERSISTENT_REMAPPABLE_ACTION, 0x30, key & 0xFF00, key & 0xFF, 0xFF
)
if mapped_data:
_ignore, _ignore, actionId, remapped, modifiers, status = _unpack("!HBBHBB", mapped_data[:8])
else:
actionId = remapped = modifiers = status = 0
actionId = special_keys.ACTIONID[actionId]
if actionId == special_keys.ACTIONID.Key:

View File

@ -388,7 +388,7 @@ class Backlight3(_Setting):
label = _("Backlight")
description = _("Set illumination time for keyboard.")
feature = _F.BACKLIGHT3
rw_options = {"read_fnid": 0x10, "write_fnid": 0x20, "suffix": 0x09}
rw_options = {"read_fnid": 0x10, "write_fnid": 0x20, "suffix": b"\x09"}
validator_class = _RangeV
min_value = 0
max_value = 1000