Hide mic-mute toggle on G522; strip trailing whitespace in get_feature comment

G522 advertises HEADSET_MIC_MUTE (0x0601) in its FeatureSet at index 21
but the firmware returns 0x0A UNSUPPORTED for both GetState (fn 0x10)
and SetState (fn 0x00) — the physical mute switch on the headset doesn't
drive this feature, and G HUB silently swallows the failures. Hide the
broken toggle on G522 PIDs (0x0B18 wireless, 0x0B19 wired) by returning
None from build() so it never reaches the UI.

Also strip the trailing space on the sub-device comment in get_feature
that pre-commit's whitespace hook flags in CI.
This commit is contained in:
Ken Sanislo 2026-04-24 20:14:10 -07:00
parent f6a6315a7d
commit 9bb0fc0205
2 changed files with 12 additions and 1 deletions

View File

@ -301,7 +301,7 @@ class FeaturesArray(dict):
feature = self.inverse.get(index)
if feature is not None:
return feature
# Sub-device index; bridge unwrap offsets by 0x100 (see listener).
# Sub-device index; bridge unwrap offsets by 0x100 (see listener).
if index >= 0x100:
return self.sub_inverse.get(index - 0x100)
elif self._check():

View File

@ -1621,6 +1621,17 @@ class HeadsetMicMute(settings.Setting):
feature = _F.HEADSET_MIC_MUTE
validator_class = settings_validator.BooleanValidator
@classmethod
def build(cls, device):
# G522 advertises 0x0601 in its FeatureSet but the firmware returns
# 0x0A UNSUPPORTED for both GetState and SetState. The physical mute
# switch doesn't drive this feature anyway — G HUB attempts and
# silently ignores failures. Hide the toggle on G522 PIDs (0x0B18
# wireless, 0x0B19 wired) so users don't see a permanently-broken UI.
if getattr(device, "product_id", None) in (0x0B18, 0x0B19):
return None
return super().build(device)
class HeadsetMicSNR(settings.Setting):
name = "headset-mic-snr"