diff --git a/lib/logitech_receiver/hidpp10.py b/lib/logitech_receiver/hidpp10.py index 51de5c2870..482259506c 100644 --- a/lib/logitech_receiver/hidpp10.py +++ b/lib/logitech_receiver/hidpp10.py @@ -118,6 +118,7 @@ REGISTERS = _NamedInts( # only apply to receivers receiver_connection=0x02, + devices_configuration=0x03, receiver_pairing=0xB2, devices_activity=0x2B3, receiver_info=0x2B5, @@ -379,6 +380,19 @@ def set_notification_flags(device, *flag_bits): return result is not None +def get_configuration_pending_flags(receiver): + assert not receiver.isDevice + result = read_register(receiver, REGISTERS.devices_configuration) + if result is not None: + return ord(result[:1]) + + +def set_configuration_pending_flags(receiver, devices): + assert not receiver.isDevice + result = write_register(receiver, REGISTERS.devices_configuration, devices) + return result is not None + + def get_device_features(device): assert device is not None diff --git a/lib/logitech_receiver/notifications.py b/lib/logitech_receiver/notifications.py index 4dbb3db375..07b8275b56 100644 --- a/lib/logitech_receiver/notifications.py +++ b/lib/logitech_receiver/notifications.py @@ -283,6 +283,9 @@ def _process_hidpp10_notification(device, status, n): bool(flags & 0x10), link_encrypted, link_established, bool(flags & 0x80) ) status[_K.LINK_ENCRYPTED] = link_encrypted + if not link_established and device.receiver: + print('FLAGS OFFLINE', _hidpp10.get_configuration_pending_flags(device.receiver)) + _hidpp10.set_configuration_pending_flags(device.receiver, 0xFF) status.changed(active=link_established) return True diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py index 55786b0e98..f325c89496 100644 --- a/lib/logitech_receiver/receiver.py +++ b/lib/logitech_receiver/receiver.py @@ -85,6 +85,8 @@ def __init__(self, handle, path, product_id): self._firmware = None self._devices = {} self._remaining_pairings = None + print('FLAGS', _hidpp10.get_configuration_pending_flags(self)) + _hidpp10.set_configuration_pending_flags(self, 0xFF) def close(self): handle, self.handle = self.handle, None diff --git a/lib/logitech_receiver/settings.py b/lib/logitech_receiver/settings.py index 5bc136b389..c28d8d572f 100644 --- a/lib/logitech_receiver/settings.py +++ b/lib/logitech_receiver/settings.py @@ -1550,6 +1550,10 @@ def key_action(self, key): # acction to take when some other diverted key is pr def apply_all_settings(device): + if device.receiver: + from . import hidpp10 as _hidpp10 + print(device, device.receiver) + print('FLAGS APPLY', _hidpp10.get_configuration_pending_flags(device.receiver)) if device.features and _hidpp20.FEATURE.HIRES_WHEEL in device.features: _sleep(0.2) # delay to try to get out of race condition with Linux HID++ driver persister = getattr(device, 'persister', None) diff --git a/lib/solaar/cli/show.py b/lib/solaar/cli/show.py index 9b204d0ab1..c8f0cdf8b3 100644 --- a/lib/solaar/cli/show.py +++ b/lib/solaar/cli/show.py @@ -35,6 +35,9 @@ def _print_receiver(receiver): print(' Device path :', receiver.path) print(' USB id : 046d:%s' % receiver.product_id) print(' Serial :', receiver.serial) + pending = _hidpp10.get_configuration_pending_flags(receiver) + if pending: + print(' C Pending : %02x' % pending) if receiver.firmware: for f in receiver.firmware: print(' %-11s: %s' % (f.kind, f.version)) @@ -222,6 +225,9 @@ def _print_device(dev, num=None): print(' Unit ID: %s Model ID: %s Transport IDs: %s' % (unitId, modelId, tid_map)) elif feature == _hidpp20.FEATURE.REPORT_RATE or feature == _hidpp20.FEATURE.EXTENDED_ADJUSTABLE_REPORT_RATE: print(' Report Rate: %s' % _hidpp20.get_polling_rate(dev)) + elif feature == _hidpp20.FEATURE.CONFIG_CHANGE: + response = dev.feature_request(_hidpp20.FEATURE.CONFIG_CHANGE, 0x10) + print(' Configuration: %s' % response.hex()) elif feature == _hidpp20.FEATURE.REMAINING_PAIRING: print(' Remaining Pairings: %d' % _hidpp20.get_remaining_pairing(dev)) elif feature == _hidpp20.FEATURE.ONBOARD_PROFILES: