summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-04-24 21:34:01 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-04-24 21:34:01 +0000
commit95ad2e73e71bef4045617a7588b4a7bff91fa678 (patch)
tree2074ac66565c173faf7f2bcb8df182426027f9b9 /sys/dev/usb
parentc31b97db1c8aaf921aab8efa39f7cab2aac03a61 (diff)
Suffix per-channel non-numeric controls with channel number
The audio(9) mixer API can't represent such per-channel controls with a single entry, so we've to expose one mixer entry (with an unique name) per control. Fixes name clashes on usb audio devices with per-channel mute controls.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uaudio.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index a2ddaf02853..a85fbb93073 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.151 2020/03/23 17:10:02 bluhm Exp $ */
+/* $OpenBSD: uaudio.c,v 1.152 2020/04/24 21:34:00 ratchov Exp $ */
/*
* Copyright (c) 2018 Alexandre Ratchov <alex@caoua.org>
*
@@ -4289,8 +4289,13 @@ uaudio_query_devinfo(void *arg, struct mixer_devinfo *devinfo)
*/
strlcpy(devinfo->label.name, u->name, MAX_AUDIO_DEV_LEN);
} else {
- snprintf(devinfo->label.name,
- MAX_AUDIO_DEV_LEN, "%s_%s", u->name, m->fname);
+ if (m->chan == -1) {
+ snprintf(devinfo->label.name, MAX_AUDIO_DEV_LEN,
+ "%s_%s", u->name, m->fname);
+ } else {
+ snprintf(devinfo->label.name, MAX_AUDIO_DEV_LEN,
+ "%s_%s%u", u->name, m->fname, m->chan);
+ }
}
devinfo->mixer_class = u->mixer_class;