Log GetHostModeState before/after write for RGB diagnostic

solaar show has been reporting headset-rgb-hostmode as False even
when SetHostModeState(1) just succeeded without error. Could be:
  (a) the write doesn't actually stick on the device, OR
  (b) our GetHostModeState response decode is wrong, OR
  (c) the device uses a different function for "read" than we expect.

Log the raw response bytes returned by function 7 (GetHostModeState)
immediately before and after the SetHostModeState write so the next
test log will show:
- what byte the device returns for "off"
- what byte the device returns for "on"
- whether the byte changes across a write

Diagnostic only — temporary; remove once we've isolated the cause.
This commit is contained in:
Ken Sanislo 2026-04-18 12:46:49 -07:00
parent a56d02a6fb
commit f1c8f22fbc
1 changed files with 19 additions and 0 deletions

View File

@ -1931,6 +1931,25 @@ class HeadsetRGBHostMode(settings.Setting):
rw_options = {"read_fnid": 0x70, "write_fnid": 0x80}
validator_class = settings_validator.BooleanValidator
def write(self, value, save=True):
# Diagnostic wrapper: log what GetHostModeState returns immediately
# before AND after the SetHostModeState write, so we can see whether
# (a) the write takes effect on the device or (b) our decoding of the
# response is wrong. solaar show has been reporting this value as
# False even after writes we believed succeeded.
try:
before = self._device.feature_request(self.feature, 0x70)
except Exception as e:
before = f"<err:{e}>"
logger.info("HeadsetRGBHostMode.write: before=%s requested=%s", before, value)
result = super().write(value, save=save)
try:
after = self._device.feature_request(self.feature, 0x70)
except Exception as e:
after = f"<err:{e}>"
logger.info("HeadsetRGBHostMode.write: after=%s write_returned=%s", after, result)
return result
class HeadsetRGBColor(settings.Setting):
"""Pick a color from the shared `special_keys.COLORS` palette and apply it