Solaar/lib/logitech_receiver
Ken Sanislo 6e84325d67 HeadsetRGBColor: reorder host mode before zone query, parse tight response
Field testing on G522 showed two problems:

1. GetRGBZoneInfo returned all zeros (count=0, all-zero body) when
   queried BEFORE SetHostModeState(1). Protocol doc's recommended
   order is: claim host mode first, then enumerate zones. Our code
   was querying zones first.

2. The response format the G522 returns does NOT match the doc's
   layout. Doc says [count, 3 reserved, 1 reserved, zone_ids...] but
   the G522 seems to pack them tight as [count, zone_ids...] — the
   SetRgbZonesSingleValue response "0801020304050607080000" decodes
   cleanly as count=8, zones=[1..8] under the tight format.

Fixes:
- Call SetHostModeState(1) before GetRGBZoneInfo.
- Try tight format first, fall back to doc format. Only cache a
  parsed result if it makes sense (non-zero zone IDs, count matches).
- Don't cache ambiguous results so subsequent writes retry.

This also incidentally suggests the G522 has 8 RGB zones (not the 2
left/right earcups we were guessing) — the red set we sent in the
previous test probably did set zones 0x01 and 0x02 correctly, but
those zones are only a fraction of the total lighting so the color
change wasn't visible.
2026-05-10 15:39:17 -07:00
..
__init__.py
…
advanced_para_eq.py Add read-only HeadsetAdvancedEQ (0x020D) display 2026-05-10 15:39:17 -07:00
base.py Tighten Centurion probe and silence FeaturesArray query spam 2026-05-10 15:39:17 -07:00
base_usb.py
…
centurion.py Fix FeatureNotSupported crash on pending CenturionReceiver 2026-05-10 15:39:17 -07:00
centurion_constants.py
…
common.py
…
descriptors.py Add G522 LIGHTSPEED headset support (Centurion 0x50 transport variant) 2026-05-10 15:39:16 -07:00
desktop_notifications.py
…
device.py Guard Centurion feature lookups against HID++ 2.0 enum collisions 2026-05-10 15:39:17 -07:00
diversion.py
…
exceptions.py
…
hidpp10.py
…
hidpp10_constants.py
…
hidpp20.py Add read-only HeadsetAdvancedEQ (0x020D) display 2026-05-10 15:39:17 -07:00
hidpp20_constants.py
…
i18n.py
…
listener.py Add G522 LIGHTSPEED headset support (Centurion 0x50 transport variant) 2026-05-10 15:39:16 -07:00
notifications.py
…
onboard_eq.py
…
receiver.py
…
settings.py Add per-key RGB color painter and replace MAP_CHOICE color validator 2026-05-10 17:52:55 -04:00
settings_new.py
…
settings_templates.py HeadsetRGBColor: reorder host mode before zone query, parse tight response 2026-05-10 15:39:17 -07:00
settings_validator.py Add per-key RGB color painter and replace MAP_CHOICE color validator 2026-05-10 17:52:55 -04:00
special_keys.py
…