From 7b6b11ac73da63e4eaef6569247c8f577711d27c Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Tue, 30 Aug 2022 14:34:52 -0400 Subject: [PATCH] device: add support for config change feature --- lib/logitech_receiver/device.py | 7 +++++++ lib/logitech_receiver/hidpp20.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 3f719541..185ba525 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -350,6 +350,13 @@ class Device: self._feature_settings_checked = _check_feature_settings(self, self._settings) return self._settings + def set_configuration(self, configuration, no_reply=False): + if self.online and self.protocol >= 2.0: + _hidpp20.config_change(self, configuration, no_reply=no_reply) + + def reset(self, no_reply=False): + self.set_configuration(0, no_reply) + @property def persister(self): if not self._persister: diff --git a/lib/logitech_receiver/hidpp20.py b/lib/logitech_receiver/hidpp20.py index f9d97c17..e07df110 100644 --- a/lib/logitech_receiver/hidpp20.py +++ b/lib/logitech_receiver/hidpp20.py @@ -65,7 +65,7 @@ FEATURE = _NamedInts( DEVICE_GROUPS=0x0006, DEVICE_FRIENDLY_NAME=0x0007, KEEP_ALIVE=0x0008, - RESET=0x0020, # "Config Change" + CONFIG_CHANGE=0x0020, CRYPTO_ID=0x0021, TARGET_SOFTWARE=0x0030, WIRELESS_SIGNAL_STRENGTH=0x0080, @@ -1560,3 +1560,7 @@ def get_remaining_pairing(device): if result: result = _unpack('!B', result[:1])[0] return result + + +def config_change(device, configuration, no_reply=False): + return feature_request(device, FEATURE.CONFIG_CHANGE, 0x00, configuration, no_reply=no_reply)