From e1604db07bdf943e88a518b7c8bd59ed3f4be2df Mon Sep 17 00:00:00 2001 From: Ken Sanislo Date: Sun, 12 Apr 2026 15:21:01 -0700 Subject: [PATCH] Extract _record_ping_protocol helper so all ping paths capture Centurion version The raw Centurion (major, minor) pickup was only in the Centurion-child dongle branch of Device.ping(). Wired Centurion variants (e.g. PRO X 2 LIGHTSPEED 046d:0AF8) go through the generic fallback branch and never recorded the raw version, so they displayed "Centurion 2.6" instead of "Centurion 1.16". Extract the protocol + centurion version recording into a helper and call it from both branches. --- lib/logitech_receiver/device.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 45c4ee2d..2f23c5d1 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -808,6 +808,13 @@ class Device: return None return reply_data[7:] # response data after sub_cpl, sub_feat_idx, sub_func_sw + def _record_ping_protocol(self, handle, protocol): + """Record a successful ping's protocol version, including raw Centurion (major, minor).""" + self._protocol = protocol + cent_ver = base._centurion_protocol_versions.get(int(handle)) + if cent_ver: + self._centurion_protocol = cent_ver + def ping(self): """Checks if the device is online and present, returns True of False. Some devices are integral with their receiver but may not be present even if the receiver responds to ping.""" @@ -820,11 +827,7 @@ class Device: self.online = False return False if protocol: - self._protocol = protocol - # Pick up raw Centurion protocol version from ping response - cent_ver = base._centurion_protocol_versions.get(int(handle)) - if cent_ver: - self._centurion_protocol = cent_ver + self._record_ping_protocol(handle, protocol) # Dongle responded — now check if headset is actually on by probing through bridge. # Send ROOT.GetFeature(0x0001) to the sub-device via CentPPBridge. bridge_idx = getattr(self, "_centurion_bridge_index", None) @@ -847,7 +850,7 @@ class Device: protocol = None self.online = protocol is not None and self.present if protocol: - self._protocol = protocol + self._record_ping_protocol(handle, protocol) if logger.isEnabledFor(logging.DEBUG): logger.debug("pinged %s: online %s protocol %s present %s", self.number, self.online, protocol, self.present) return self.online