From: Xucheng Pan <panxucc@gmail.com>
To: linux-sound@vger.kernel.org
Cc: tiwai@suse.com, perex@perex.cz, linux-usb@vger.kernel.org,
Xucheng Pan <panxucc@gmail.com>
Subject: [PATCH] ALSA: usb-audio: Re-read descriptors for Xiaomi 2717:d005
Date: Wed, 23 Sep 2026 23:25:52 +0800 [thread overview]
Message-ID: <20260923152552.943151-1-panxucc@gmail.com> (raw)
The Xiaomi 2717:d005 USB audio transmitter supports Sound 2 Pro and
Sound 2 Max speakers. This issue was reproduced with two Sound 2 Pro
speakers paired in stereo. After a USB replug, Linux detects the
transmitter and exposes a hardware volume control, but moving the volume
slider changes neither the audible level nor the speakers' volume LEDs.
Windows controls the same speakers with its in-box USB Audio driver.
USB captures show standard UAC2 volume SET_CUR requests on both systems.
Re-reading the device descriptor (18 bytes), configuration header
(9 bytes), and full configuration descriptor (184 bytes on the tested
unit) after 2717:d005 is configured restores hardware volume control.
The USBFS sequence recovered the device after multiple replug tests.
Reading only the device descriptor did not restore volume control.
Perform these reads when snd-usb-audio first probes 2717:d005. Use the
configuration header's wTotalLength for the final read. If a read fails,
warn and continue probing so that playback remains available.
Tested on 7.2.6-zen2-1-zen with the existing userspace workaround
disabled. After a physical USB replug, the quirk ran when 2717:d005
appeared, and both audible volume and the speakers' LEDs followed the
KDE volume slider.
Signed-off-by: Xucheng Pan <panxucc@gmail.com>
---
sound/usb/quirks.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index c587090..f9b7036 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -870,6 +870,49 @@ static int snd_usb_cm1a_boot_quirk(struct usb_device *dev)
return 0;
}
+/*
+ * The Xiaomi audio connector ignores UAC2 volume changes after reconnecting
+ * until the device and configuration descriptors have been read again.
+ */
+#define XIAOMI_AUDIO_MAX_CONFIG_SIZE 1024
+
+static void snd_usb_xiaomi_boot_quirk(struct usb_device *dev)
+{
+ u8 *buf __free(kfree) = kmalloc(XIAOMI_AUDIO_MAX_CONFIG_SIZE, GFP_KERNEL);
+ struct usb_config_descriptor *config;
+ unsigned int length;
+ int ret;
+
+ if (!buf)
+ return;
+
+ ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, buf,
+ USB_DT_DEVICE_SIZE);
+ if (ret != USB_DT_DEVICE_SIZE) {
+ dev_warn(&dev->dev, "device descriptor re-read failed: %d\n", ret);
+ return;
+ }
+
+ ret = usb_get_descriptor(dev, USB_DT_CONFIG, 0, buf,
+ USB_DT_CONFIG_SIZE);
+ if (ret != USB_DT_CONFIG_SIZE) {
+ dev_warn(&dev->dev, "configuration header re-read failed: %d\n", ret);
+ return;
+ }
+
+ config = (struct usb_config_descriptor *)buf;
+ length = le16_to_cpu(config->wTotalLength);
+ if (length < USB_DT_CONFIG_SIZE ||
+ length > XIAOMI_AUDIO_MAX_CONFIG_SIZE) {
+ dev_warn(&dev->dev, "unexpected configuration length: %u\n", length);
+ return;
+ }
+
+ ret = usb_get_descriptor(dev, USB_DT_CONFIG, 0, buf, length);
+ if (ret != (int)length)
+ dev_warn(&dev->dev, "configuration descriptor re-read failed: %d\n", ret);
+}
+
/*
* Some sound cards from Native Instruments are in fact compliant to the USB
* audio standard of version 2 and other approved USB standards, even though
@@ -1704,6 +1747,9 @@ int snd_usb_apply_boot_quirk_once(struct usb_device *dev,
return snd_usb_motu_m_series_boot_quirk(dev);
case USB_ID(0x1397, 0x1234): /* Behringer CM1A */
return snd_usb_cm1a_boot_quirk(dev);
+ case USB_ID(0x2717, 0xd005): /* Xiaomi audio connector */
+ snd_usb_xiaomi_boot_quirk(dev);
+ return 0;
}
return 0;
--
2.55.0
next reply other threads:[~2026-09-23 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 15:25 Xucheng Pan [this message]
2026-09-29 9:35 ` [PATCH] ALSA: usb-audio: Re-read descriptors for Xiaomi 2717:d005 Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923152552.943151-1-panxucc@gmail.com \
--to=panxucc@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox