git: 694923501f56 - main - snd_uaudio: Read the UAC2 sample rate back after setting it
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Sep 2026 12:13:02 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=694923501f56a5d4519f548ee06db603f9486bc7
commit 694923501f56a5d4519f548ee06db603f9486bc7
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-09-15 12:12:43 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-09-15 12:12:43 +0000
snd_uaudio: Read the UAC2 sample rate back after setting it
Some devices only apply a new sample rate once it has been read back,
and produce no sound at all otherwise.
PR: 294803
Reported by: tatsuki_makino@hotmail.com
Tested by: tatsuki_makino@hotmail.com
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D59616
---
sys/dev/sound/usb/uaudio.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index de2b9c467835..491827c87f84 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -5446,6 +5446,7 @@ uaudio20_set_speed(struct usb_device *udev, uint8_t iface_no,
uint8_t clockid, uint32_t speed)
{
struct usb_device_request req;
+ usb_error_t err;
uDWord data;
DPRINTFN(6, "ifaceno=%d clockid=%d speed=%u\n",
@@ -5458,7 +5459,27 @@ uaudio20_set_speed(struct usb_device *udev, uint8_t iface_no,
USETW(req.wLength, sizeof(data));
USETDW(data, speed);
- return (usbd_do_request(udev, NULL, &req, data));
+ err = usbd_do_request(udev, NULL, &req, data);
+ if (err != USB_ERR_NORMAL_COMPLETION)
+ return (err);
+
+ /*
+ * Read the rate back, because some devices only apply it once it has
+ * been read, and produce no sound otherwise.
+ */
+ req.bmRequestType = UT_READ_CLASS_INTERFACE;
+ USETDW(data, 0);
+
+ err = usbd_do_request(udev, NULL, &req, data);
+ if (err != USB_ERR_NORMAL_COMPLETION) {
+ DPRINTF("could not read sample rate back: %s\n",
+ usbd_errstr(err));
+ } else if (UGETDW(data) != speed) {
+ DPRINTF("sample rate is %u Hz, expected %u Hz\n",
+ UGETDW(data), speed);
+ }
+
+ return (USB_ERR_NORMAL_COMPLETION);
}
static int