Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Fix numbering of vchan mixer controls t...
details: https://anonhg.NetBSD.org/src/rev/aedc374c036a
branches: trunk
changeset: 319055:aedc374c036a
user: nat <nat%NetBSD.org@localhost>
date: Tue May 15 00:19:08 2018 +0000
description:
Fix numbering of vchan mixer controls to correspond to the vchan number in
use.
This makes the numbering of vchans consistient for audioctl and mixerctl.
diffstat:
sys/dev/audio.c | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diffs (73 lines):
diff -r 1059634cfba4 -r aedc374c036a sys/dev/audio.c
--- a/sys/dev/audio.c Mon May 14 22:11:30 2018 +0000
+++ b/sys/dev/audio.c Tue May 15 00:19:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.452 2018/02/06 04:39:18 isaki Exp $ */
+/* $NetBSD: audio.c,v 1.453 2018/05/15 00:19:08 nat Exp $ */
/*-
* Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.452 2018/02/06 04:39:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.453 2018/05/15 00:19:08 nat Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -5784,6 +5784,9 @@
static int
audio_query_devinfo(struct audio_softc *sc, mixer_devinfo_t *di)
{
+ struct audio_chan *chan;
+ unsigned int j;
+
KASSERT(mutex_owned(sc->sc_lock));
if (sc->sc_static_nmixer_states == 0 || sc->sc_nmixer_states == 0)
@@ -5799,18 +5802,40 @@
di->type = AUDIO_MIXER_CLASS;
} else if ((di->index - sc->sc_static_nmixer_states) % 2 == 0) {
di->mixer_class = sc->sc_static_nmixer_states -1;
+ j = 0;
+ SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
+ if (j == (di->index -
+ sc->sc_static_nmixer_states) / 2)
+ break;
+ j++;
+ }
+ if (j != (di->index - sc->sc_static_nmixer_states) / 2)
+ return 0;
+
+ j = chan->deschan;
+
snprintf(di->label.name, sizeof(di->label.name),
- AudioNdac"%d",
- (di->index - sc->sc_static_nmixer_states) / 2);
+ AudioNdac"%d", j);
di->type = AUDIO_MIXER_VALUE;
di->next = di->prev = AUDIO_MIXER_LAST;
di->un.v.num_channels = 1;
unitscopy(di, AudioNvolume);
} else {
di->mixer_class = sc->sc_static_nmixer_states -1;
+ j = 0;
+ SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
+ if (j == (di->index -
+ sc->sc_static_nmixer_states) / 2)
+ break;
+ j++;
+ }
+ if (j != (di->index - sc->sc_static_nmixer_states) / 2)
+ return 0;
+
+ j = chan->deschan;
+
snprintf(di->label.name, sizeof(di->label.name),
- AudioNmicrophone "%d",
- (di->index - sc->sc_static_nmixer_states) / 2);
+ AudioNmicrophone "%d", j);
di->type = AUDIO_MIXER_VALUE;
di->next = di->prev = AUDIO_MIXER_LAST;
di->un.v.num_channels = 1;
Home |
Main Index |
Thread Index |
Old Index