summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod/siofile.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/sndiod/siofile.c')
-rw-r--r--usr.bin/sndiod/siofile.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/sndiod/siofile.c b/usr.bin/sndiod/siofile.c
index 5ae66167dfe..ddc6a5973d1 100644
--- a/usr.bin/sndiod/siofile.c
+++ b/usr.bin/sndiod/siofile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siofile.c,v 1.21 2020/06/18 05:11:13 ratchov Exp $ */
+/* $OpenBSD: siofile.c,v 1.22 2020/06/28 05:21:39 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -96,6 +96,8 @@ dev_sio_openlist(struct dev *d, unsigned int mode, struct sioctl_hdl **rctlhdl)
struct dev_alt *n;
struct sio_hdl *hdl;
struct sioctl_hdl *ctlhdl;
+ struct ctl *c;
+ int val;
for (n = d->alt_list; n != NULL; n = n->next) {
if (d->alt_num == n->idx)
@@ -117,6 +119,17 @@ dev_sio_openlist(struct dev *d, unsigned int mode, struct sioctl_hdl **rctlhdl)
}
}
d->alt_num = n->idx;
+ for (c = d->ctl_list; c != NULL; c = c->next) {
+ if (c->addr < CTLADDR_ALT_SEL ||
+ c->addr >= CTLADDR_ALT_SEL + DEV_NMAX)
+ continue;
+ val = (c->addr - CTLADDR_ALT_SEL) == n->idx;
+ if (c->curval == val)
+ continue;
+ c->curval = val;
+ if (val)
+ c->val_mask = ~0U;
+ }
*rctlhdl = ctlhdl;
return hdl;
}