From 739b25f49665a4b2bbc007627aa2e7be262a5e4a Mon Sep 17 00:00:00 2001 From: Ken Sanislo Date: Fri, 15 May 2026 11:39:26 -0700 Subject: [PATCH] HeadsetSidetone: log getSidetoneLevelSettings raw reply under -dd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Binary RE of LGHUB established that the 0x0604 wire 'level' is a gain-step index, not a 0-100 percent: GHUB scales it through a step count N sourced from getSidetoneLevelSettings (function 2). Solaar writes a raw percent, which is only correct when N == 101 — so V2 headsets reporting a smaller N (G522/G325) get out-of-range step writes the firmware silently clamps. Function 2's byte layout couldn't be recovered from the binary (it decodes in an inlined lambda). Probe it at build time and log the raw reply so the next debug log captures where N sits — no behavior change, gated on DEBUG so it only runs when diagnostics are on. --- lib/logitech_receiver/settings_templates.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index bdd42014..c40bf9cd 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -1721,6 +1721,15 @@ class HeadsetSidetone(settings.Setting): skip, prefix = 3, b"\x01\xff" else: skip, prefix = 2, b"\x01" + # getSidetoneLevelSettings (fn 2) carries the gain-step count that scales + # wire level <-> UI percent; its byte layout is unmapped. Log the raw + # reply under -dd so a user log pins it down. + if logger.isEnabledFor(logging.DEBUG): + try: + reply = device.feature_request(cls.feature, 0x20) + logger.debug("%s: getSidetoneLevelSettings raw reply: %s", cls.name, reply.hex() if reply else reply) + except Exception as e: + logger.debug("%s: getSidetoneLevelSettings probe raised %s", cls.name, e) rw = settings.FeatureRW(cls.feature, **cls.rw_options) validator = cls.validator_class.build(cls, device, read_skip_byte_count=skip, write_prefix_bytes=prefix) if validator: