From 4fd75a64ff6432c9c8ff5a44da945f585ec8e4a5 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Sun, 24 Mar 2024 06:57:43 -0400 Subject: [PATCH] settings: fix small bugs found from testing --- lib/logitech_receiver/hidpp20.py | 13 ++++++------- lib/logitech_receiver/settings_templates.py | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/logitech_receiver/hidpp20.py b/lib/logitech_receiver/hidpp20.py index 384a91d1..9710e772 100644 --- a/lib/logitech_receiver/hidpp20.py +++ b/lib/logitech_receiver/hidpp20.py @@ -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: diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index d296a69d..903c74ff 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -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