mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk
@ 2026-11-20 12:03 chris
  2026-11-20 12:03 ` [PATCH 1/2] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags chris
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: chris @ 2026-11-20 12:03 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela
  Cc: Christopher Snowhill, Cryolitia PukNgae, Rong Zhang, linux-sound,
	linux-kernel

Patch 1 fixes parsing of flag names written to the quirk_flags module
parameter with a trailing newline, as echo produces.

Patch 2 adds quirk flags for the Logitech PRO X 2 LIGHTSPEED receiver
(046d:0af7). This is a mitigation, not a fix. After a hotplug the
receiver firmware resets itself on the first stream open, and also on
repeated GET_STATUS requests or on SET_CONFIGURATION shortly after a
port reset. It only behaves once it has gone through such a reset of
its own. The flags avoid the worse failure, where the probe-time
interface setup wedges the receiver for about 77 seconds.

The same receiver hotplugs without trouble on Windows and macOS. A
USBPcap capture of a Windows hotplug, with G HUB installed, shows no
missing request that made a difference when I tried it. Replaying
G HUB's initial HID reports before the audio driver binds did not
help, and neither did a host port reset. These differences were not
isolated:
- Windows never sends GET_STATUS.
- It sets the playback alt setting once, about 0.9 s after
  configuration, and keeps it.
- It only reads the volume controls at probe.
Suggestions on how to narrow this down, or on whether the quirk should
be expressed differently, are welcome. Captures and logs are available.

The device entry repeats CTL_MSG_DELAY_1M from the Logitech vendor
entry, as the other Logitech device entries do, because a device entry
replaces the vendor match. The receiver also worked with only
SKIP_IFACE_SETUP | IFACE_DELAY. The PRO X Wireless (046d:0aba) entry
does not carry the delay; Rong, I'm not sure whether that was intended.

Testing: with both patches applied, sound/usb/ builds without warnings
with W=1 and checkpatch --strict is clean. Patch 2 was runtime-tested on
a 7.3.5 stable kernel. Cold hotplugs on a front-panel (PROM21) port and
a rear (CPU xHCI, behind a hub) port recover within half a second and
then play normally.
Patch 1 was runtime-tested on the same kernel. Flag names written with
a plain echo are applied, and an empty echo is ignored by the parser.
The sysfs readback still shows the newline as written, because the
parameter stores the raw string. That is cosmetic and left unchanged.

Assisted-by: AI

Christopher Snowhill (2):
  ALSA: usb-audio: Ignore trailing whitespace in quirk_flags
  ALSA: usb-audio: Add quirk flags for Logitech PRO X 2 LIGHTSPEED

 sound/usb/quirks.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


base-commit: 58161ead29e50d70a317ea26b472e0c7508e69da
-- 
2.56.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags
  2026-11-20 12:03 [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk chris
@ 2026-11-20 12:03 ` chris
  2026-11-20 12:03 ` [PATCH 2/2] ALSA: usb-audio: Add quirk flags for Logitech PRO X 2 LIGHTSPEED chris
  2026-11-20 17:09 ` [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: chris @ 2026-11-20 12:03 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela
  Cc: Christopher Snowhill, Cryolitia PukNgae, linux-sound, linux-kernel

Writing a flag name to the quirk_flags module parameter through sysfs
with echo leaves a trailing newline on the string. The parser keeps it
as part of the last flag name, so a valid flag is rejected:

  snd_usb_audio: unknown flag SKIP_IFACE_SETUP
   while parsing param quirk_flags

Numeric flags are not affected because kstrtou64() accepts a trailing
newline. Strip leading and trailing whitespace before parsing.

Fixes: ffd586126a82 ("ALSA: usb-audio: improve module param quirk_flags")
Assisted-by: AI
Signed-off-by: Christopher Snowhill <chris@kode54.net>
---
 sound/usb/quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index a54fabce7920..cff10fac496f 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -2765,7 +2765,7 @@ void snd_usb_init_quirk_flags_parse_string(struct snd_usb_audio *chip,
 	if (!val)
 		return;
 
-	for (p = val; p && *p;) {
+	for (p = strim(val); p && *p;) {
 		/* Each entry consists of VID:PID:flags */
 		field = strsep(&p, ":");
 		if (!field)
-- 
2.56.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ALSA: usb-audio: Add quirk flags for Logitech PRO X 2 LIGHTSPEED
  2026-11-20 12:03 [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk chris
  2026-11-20 12:03 ` [PATCH 1/2] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags chris
@ 2026-11-20 12:03 ` chris
  2026-11-20 17:09 ` [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: chris @ 2026-11-20 12:03 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela
  Cc: Christopher Snowhill, Rong Zhang, linux-sound, linux-kernel

The receiver of the Logitech PRO X 2 LIGHTSPEED headset (046d:0af7)
resets itself on ordinary requests such as SET_INTERFACE when it has
been hotplugged and not yet gone through a reset of its own. When the
probe-time interface setup runs shortly after configuration, the
receiver can instead stop answering control requests altogether until
its watchdog resets it about 77 seconds later, and the headset may not
pair afterwards.

Skip the probe-time interface setup, so that the first alt setting
change happens at stream open. The receiver still resets once there,
but re-enumerates within half a second and then works normally. Also
set IFACE_DELAY: the delay after SET_INTERFACE lets the receiver drop
off before the sample rate request is sent; otherwise that request is
in flight when the device disappears and the disconnect waits for the
control message timeout, delaying recovery by five seconds.

Keep CTL_MSG_DELAY_1M from the Logitech vendor entry, which a device
entry replaces.

A receiver that is present at boot is not affected.

Assisted-by: AI
Signed-off-by: Christopher Snowhill <chris@kode54.net>
---
 sound/usb/quirks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index cff10fac496f..29523d2a99bd 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -2284,6 +2284,9 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
 	DEVICE_FLG(0x046d, 0x0aba, /* Logitech PRO X Wireless */
 		   QUIRK_FLAG_MIXER_GET_CUR_OK |
 		   QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE),
+	DEVICE_FLG(0x046d, 0x0af7, /* Logitech PRO X 2 LIGHTSPEED */
+		   QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_SKIP_IFACE_SETUP |
+		   QUIRK_FLAG_IFACE_DELAY),
 	DEVICE_FLG(0x0499, 0x1506, /* Yamaha THR5 */
 		   QUIRK_FLAG_GENERIC_IMPLICIT_FB),
 	DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk
  2026-11-20 12:03 [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk chris
  2026-11-20 12:03 ` [PATCH 1/2] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags chris
  2026-11-20 12:03 ` [PATCH 2/2] ALSA: usb-audio: Add quirk flags for Logitech PRO X 2 LIGHTSPEED chris
@ 2026-11-20 17:09 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2026-11-20 17:09 UTC (permalink / raw)
  To: chris
  Cc: Takashi Iwai, Jaroslav Kysela, Cryolitia PukNgae, Rong Zhang,
	linux-sound, linux-kernel

On Fri, 20 Nov 2026 13:03:46 +0100,
chris@kode54.net wrote:
> 
> Patch 1 fixes parsing of flag names written to the quirk_flags module
> parameter with a trailing newline, as echo produces.
> 
> Patch 2 adds quirk flags for the Logitech PRO X 2 LIGHTSPEED receiver
> (046d:0af7). This is a mitigation, not a fix. After a hotplug the
> receiver firmware resets itself on the first stream open, and also on
> repeated GET_STATUS requests or on SET_CONFIGURATION shortly after a
> port reset. It only behaves once it has gone through such a reset of
> its own. The flags avoid the worse failure, where the probe-time
> interface setup wedges the receiver for about 77 seconds.
> 
> The same receiver hotplugs without trouble on Windows and macOS. A
> USBPcap capture of a Windows hotplug, with G HUB installed, shows no
> missing request that made a difference when I tried it. Replaying
> G HUB's initial HID reports before the audio driver binds did not
> help, and neither did a host port reset. These differences were not
> isolated:
> - Windows never sends GET_STATUS.
> - It sets the playback alt setting once, about 0.9 s after
>   configuration, and keeps it.
> - It only reads the volume controls at probe.
> Suggestions on how to narrow this down, or on whether the quirk should
> be expressed differently, are welcome. Captures and logs are available.
> 
> The device entry repeats CTL_MSG_DELAY_1M from the Logitech vendor
> entry, as the other Logitech device entries do, because a device entry
> replaces the vendor match. The receiver also worked with only
> SKIP_IFACE_SETUP | IFACE_DELAY. The PRO X Wireless (046d:0aba) entry
> does not carry the delay; Rong, I'm not sure whether that was intended.
> 
> Testing: with both patches applied, sound/usb/ builds without warnings
> with W=1 and checkpatch --strict is clean. Patch 2 was runtime-tested on
> a 7.3.5 stable kernel. Cold hotplugs on a front-panel (PROM21) port and
> a rear (CPU xHCI, behind a hub) port recover within half a second and
> then play normally.
> Patch 1 was runtime-tested on the same kernel. Flag names written with
> a plain echo are applied, and an empty echo is ignored by the parser.
> The sysfs readback still shows the newline as written, because the
> parameter stores the raw string. That is cosmetic and left unchanged.
> 
> Assisted-by: AI
> 
> Christopher Snowhill (2):
>   ALSA: usb-audio: Ignore trailing whitespace in quirk_flags
>   ALSA: usb-audio: Add quirk flags for Logitech PRO X 2 LIGHTSPEED

Applied both patches now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 12:03 [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk chris
2026-11-20 12:03 ` [PATCH 1/2] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags chris
2026-11-20 12:03 ` [PATCH 2/2] ALSA: usb-audio: Add quirk flags for Logitech PRO X 2 LIGHTSPEED chris
2026-11-20 17:09 ` [PATCH 0/2] ALSA: usb-audio: quirk_flags parsing fix and Logitech PRO X 2 LIGHTSPEED quirk Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®