Skip to contentSkip to conversation

ALSA: usb-audio: Add quirk for Redragon H510-PRO Wireless headset

PATCH Applied Agustin Luzardo 2 participants 5 messages Jul 5 – Jul 8 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Add quirk for Redragon H510-PRO Wireless headset

The device with USB ID 040b:0897 (Weltrend Semiconductor chipset, sold rebranded as the Redragon H510-PRO Wireless headset, reporting "XiiSound Technology Corporation" in its USB string descriptors) reports a constant value on GET_CUR for its PCM Playback Volume control while still supporting an actually tunable volume. This trips the sticky-value detection in check_sticky_volume_control(), which disables the mixer control entirely:

usb 1-4: 5:0: sticky mixer values (0/100/1 => 80), disabling

As a result, the device boots with playback volume effectively muted and provides no way to raise it through the normal ALSA/PipeWire mixer path.

Apply QUIRK_FLAG_MIXER_GET_CUR_BROKEN so the sticky check marks the control as get_cur_broken and relies on the cached value instead of disabling the mixer control outright.

Tested by backporting this quirk flag and the supporting get_cur_broken logic onto a Linux 7.1.2-zen kernel build that does not yet carry it, and confirming that after applying the flag the kernel log changes from:

usb 1-4: 5:0: sticky mixer values (0/100/1 => 80), disabling

to:

usb 1-4: 5:0: broken mixer GET_CUR (0/100/1 => 80)

with the control usable via the driver's cached value afterward.

---
 sound/usb/quirks.c | 2 ++
 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
index 0000000..0000000 100644
@@ -2211,6 +2211,8 @@
 	DEVICE_FLG(0x03f0, 0x654a, /* HP 320 FHD Webcam */
 		   QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_MIC_RES_16),
+	DEVICE_FLG(0x040b, 0x0897, /* Weltrend Semiconductor, sold as Redragon H510-PRO Wireless headset */
+		   QUIRK_FLAG_MIXER_GET_CUR_BROKEN),
 	DEVICE_FLG(0x041e, 0x3000, /* Creative SB Extigy */
 		   QUIRK_FLAG_IGNORE_CTL_ERROR),
 	DEVICE_FLG(0x041e, 0x4080, /* Creative Live Cam VF0610 */
Signature · 1 line
2.46.1
#1 lore raw

PATCH 1/1 ALSA: usb-audio: Do not drop per-channel feature controls marked get_cur_broken

When a per-channel Feature Unit control (e.g. a stereo PCM Playback Volume control) hits the sticky-mixer check during get_min_max_with_quirks(), and the device carries QUIRK_FLAG_MIXER_GET_CUR_BROKEN, the sticky check marks the control as cval->get_cur_broken and returns -ENXIO instead of disabling it outright.

However, __build_feature_ctl() does not know about this and treats any negative return other than -EAGAIN as fatal, discarding the kcontrol entirely:

	if ((ret < 0 && ret != -EAGAIN) || cval->max <= cval->min) {
		...
		snd_ctl_free_one(kctl);
		return;
	}

For a stereo device where only some channels trip the sticky check, this silently drops the per-channel (stereo) control while the master-only control (built separately, without going through the same channel-specific GET_CUR negotiation) survives. The result is that the user is left with a single mono/master volume control instead of the independent per-channel controls the device actually supports, with no visible error (usb_audio_dbg is typically compiled out).

This was observed on a Weltrend Semiconductor 040b:0897 device (sold as the Redragon H510-PRO Wireless headset), which reports a genuine stereo Feature Unit (bNrChannels = 2, bmaControls with Volume set for both channels) but ends up exposing only a single-channel "PCM Playback Volume" control once QUIRK_FLAG_MIXER_GET_CUR_BROKEN is applied for that device.

Skip the discard when the control was already marked get_cur_broken, as long as a sane range was otherwise established.

---
 sound/usb/mixer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sound/usb/mixer.c +5 -2
index 0000000..0000000 100644
@@ -1970,8 +1970,10 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer,
 	/* get min/max values */
 	ret = get_min_max_with_quirks(cval, 0, kctl);
 
-	/* skip a bogus volume range */
-	if ((ret < 0 && ret != -EAGAIN) || cval->max <= cval->min) {
+	/* skip a bogus volume range, unless the sticky check already
+	 * marked this control as usable via the driver's cached value
+	 * (QUIRK_FLAG_MIXER_GET_CUR_BROKEN) */
+	if ((ret < 0 && ret != -EAGAIN && !cval->get_cur_broken) ||
+	    cval->max <= cval->min) {
 		usb_audio_dbg(mixer->chip,
 			      "[%d] FU [%s] skipped due to invalid volume\n",

cval->head.id, kctl->id.name);

Signature · 1 line
2.46.1
#2 lore raw

Re: [PATCH] ALSA: usb-audio: Do not drop per-channel feature controls marked get_cur_broken

Quoted 33 lines · Agustin Luzardo

When a per-channel Feature Unit control (e.g. a stereo PCM Playback Volume control) hits the sticky-mixer check during get_min_max_with_quirks(), and the device carries QUIRK_FLAG_MIXER_GET_CUR_BROKEN, the sticky check marks the control as cval->get_cur_broken and returns -ENXIO instead of disabling it outright.

However, __build_feature_ctl() does not know about this and treats any negative return other than -EAGAIN as fatal, discarding the kcontrol entirely:

	if ((ret < 0 && ret != -EAGAIN) || cval->max <= cval->min) {
		...
		snd_ctl_free_one(kctl);
		return;
	}

For a stereo device where only some channels trip the sticky check, this silently drops the per-channel (stereo) control while the master-only control (built separately, without going through the same channel-specific GET_CUR negotiation) survives. The result is that the user is left with a single mono/master volume control instead of the independent per-channel controls the device actually supports, with no visible error (usb_audio_dbg is typically compiled out).

This was observed on a Weltrend Semiconductor 040b:0897 device (sold as the Redragon H510-PRO Wireless headset), which reports a genuine stereo Feature Unit (bNrChannels = 2, bmaControls with Volume set for both channels) but ends up exposing only a single-channel "PCM Playback Volume" control once QUIRK_FLAG_MIXER_GET_CUR_BROKEN is applied for that device.

Quoted 4 lines

Skip the discard when the control was already marked get_cur_broken, as long as a sane range was otherwise established.

Hm, by some reason, this patch couldn't be applied cleanly via git-am. It seems that your mailer screwed up.

Could you try to resubmit after correcting the setup?
At best, try to submit to yourself and verify that you can do properly apply the patch from the mail beforehand.

thanks,

Takashi

#3 lore raw

Re: [PATCH] ALSA: usb-audio: Do not drop per-channel feature controls marked get_cur_broken

In reply to Agustin Luzardo

Please disregard this patch - after further testing I found real regressions with it (non-independent channels, duplicated device chimes on boot and even on shutdown). No need to resubmit it.

The first patch (quirk_flags mixer_get_cur_broken for 040b:0897, already applied) is the one that should stay - please just ignore this second one.

Thanks,
Agustin

Applied
#4 lore raw
In reply to Agustin Luzardo
Quoted 26 lines · Agustin Luzardo

The device with USB ID 040b:0897 (Weltrend Semiconductor chipset, sold rebranded as the Redragon H510-PRO Wireless headset, reporting "XiiSound Technology Corporation" in its USB string descriptors) reports a constant value on GET_CUR for its PCM Playback Volume control while still supporting an actually tunable volume. This trips the sticky-value detection in check_sticky_volume_control(), which disables the mixer control entirely:

usb 1-4: 5:0: sticky mixer values (0/100/1 => 80), disabling

As a result, the device boots with playback volume effectively muted and provides no way to raise it through the normal ALSA/PipeWire mixer path.

Apply QUIRK_FLAG_MIXER_GET_CUR_BROKEN so the sticky check marks the control as get_cur_broken and relies on the cached value instead of disabling the mixer control outright.

Tested by backporting this quirk flag and the supporting get_cur_broken logic onto a Linux 7.1.2-zen kernel build that does not yet carry it, and confirming that after applying the flag the kernel log changes from:

usb 1-4: 5:0: sticky mixer values (0/100/1 => 80), disabling

Quoted 7 lines

to:

usb 1-4: 5:0: broken mixer GET_CUR (0/100/1 => 80)

with the control usable via the driver's cached value afterward.

Applied this one now. Thanks.

Takashi