summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorisaki <isaki@NetBSD.org>2020-03-01 07:35:33 +0000
committerisaki <isaki@NetBSD.org>2020-03-01 07:35:33 +0000
commit63b58781e1386e64a582b1cb0da0ae5a1bfcbef6 (patch)
tree268aa446f483a44ccbef7801ed4853ca0add029d /sys/dev
parent723031e95551b00b569897363f82192fa5b4946b (diff)
Reinitialize the sticky parameters whenever the hardware format is changed.
When the number of the hardware channels becomes less than the number of channels that sticky parameters remember, subsequent open("/dev/sound") will fail without this treatment. This is for rev 1.43.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/audio/audio.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c
index e5a92de31d2..d5835b8086c 100644
--- a/sys/dev/audio/audio.c
+++ b/sys/dev/audio/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.58 2020/02/29 09:38:10 isaki Exp $ */
+/* $NetBSD: audio.c,v 1.59 2020/03/01 07:35:33 isaki Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.58 2020/02/29 09:38:10 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.59 2020/03/01 07:35:33 isaki Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -6507,6 +6507,18 @@ audio_mixers_set_format(struct audio_softc *sc, const struct audio_info *ai)
if (error)
return error;
+ /*
+ * Reinitialize the sticky parameters for /dev/sound.
+ * If the number of the hardware channels becomes less than the number
+ * of channels that sticky parameters remember, subsequent /dev/sound
+ * open will fail. To prevent this, reinitialize the sticky
+ * parameters whenever the hardware format is changed.
+ */
+ sc->sc_sound_pparams = params_to_format2(&audio_default);
+ sc->sc_sound_rparams = params_to_format2(&audio_default);
+ sc->sc_sound_ppause = false;
+ sc->sc_sound_rpause = false;
+
return 0;
}