summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uaudio.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2019-05-01 14:51:41 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2019-05-01 14:51:41 +0000
commit8e302c9be22576aa8a14a98ecc7f92ff38600b1c (patch)
tree3cddb5537061d56bed8695ef5d508669d1a29123 /sys/dev/usb/uaudio.c
parent84057ac80e58841cfb56322bb96ed844707d7650 (diff)
Use the proper UAC-v2.0 request to read the device controls.
Fixes STALL errors in mixer requests causing the mixer to be unusable. With help from Claus <claus at mailbox.org>. Thanks.
Diffstat (limited to 'sys/dev/usb/uaudio.c')
-rw-r--r--sys/dev/usb/uaudio.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index 29b73af2ad0..f6d20ec384c 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.140 2019/04/10 15:14:49 ratchov Exp $ */
+/* $OpenBSD: uaudio.c,v 1.141 2019/05/01 14:51:40 ratchov Exp $ */
/*
* Copyright (c) 2018 Alexandre Ratchov <alex@caoua.org>
*
@@ -4089,17 +4089,25 @@ uaudio_get_port(void *arg, struct mixer_ctrl *ctl)
struct uaudio_mixent *m;
unsigned char req_buf[4];
struct uaudio_blob p;
- int i, nch, val;
+ int i, nch, val, req_num;
if (!uaudio_mixer_byindex(sc, ctl->dev, &u, &m))
return ENOENT;
+ switch (sc->version) {
+ case UAUDIO_V1:
+ req_num = UAUDIO_V1_REQ_GET_CUR;
+ break;
+ case UAUDIO_V2:
+ req_num = UAUDIO_V2_REQ_CUR;
+ }
+
switch (m->type) {
case UAUDIO_MIX_SW:
p.rptr = p.wptr = req_buf;
if (!uaudio_req(sc,
UT_READ_CLASS_INTERFACE,
- UAUDIO_V1_REQ_GET_CUR,
+ req_num,
m->req_sel,
m->chan < 0 ? 0 : m->chan,
sc->ctl_ifnum,
@@ -4119,7 +4127,7 @@ uaudio_get_port(void *arg, struct mixer_ctrl *ctl)
p.rptr = p.wptr = req_buf;
if (!uaudio_req(sc,
UT_READ_CLASS_INTERFACE,
- UAUDIO_V1_REQ_GET_CUR,
+ req_num,
m->req_sel,
m->chan < 0 ? 0 : i + 1,
sc->ctl_ifnum,