device: add support for config change feature

This commit is contained in:
Peter F. Patel-Schneider 2022-08-30 14:34:52 -04:00
parent beb9dfdab8
commit 7b6b11ac73
2 changed files with 12 additions and 1 deletions

View File

@ -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:

View File

@ -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)