summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/sound/usb/uaudio.c10
-rw-r--r--sys/dev/sound/usb/uaudio.h5
2 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index de76f28..e6b4a1b 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -765,7 +765,15 @@ uaudio_detach(device_t dev)
{
struct uaudio_softc *sc = device_get_softc(dev);
- if (bus_generic_detach(dev)) {
+ /*
+ * Stop USB transfers early so that any audio applications
+ * will time out and close opened /dev/dspX.Y device(s), if
+ * any.
+ */
+ uaudio_chan_stop(&sc->sc_play_chan);
+ uaudio_chan_stop(&sc->sc_rec_chan);
+
+ if (bus_generic_detach(dev) != 0) {
DPRINTF("detach failed!\n");
}
sbuf_delete(&sc->sc_sndstat);
diff --git a/sys/dev/sound/usb/uaudio.h b/sys/dev/sound/usb/uaudio.h
index 622cb3b..10c10de 100644
--- a/sys/dev/sound/usb/uaudio.h
+++ b/sys/dev/sound/usb/uaudio.h
@@ -27,6 +27,9 @@
/* prototypes from "uaudio.c" used by "uaudio_pcm.c" */
+#ifndef _UAUDIO_H_
+#define _UAUDIO_H_
+
struct uaudio_chan;
struct uaudio_softc;
struct snd_dbuf;
@@ -63,3 +66,5 @@ extern uint32_t uaudio_mixer_setrecsrc(struct uaudio_softc *sc, uint32_t src);
int uaudio_get_vendor(device_t dev);
int uaudio_get_product(device_t dev);
int uaudio_get_release(device_t dev);
+
+#endif /* _UAUDIO_H_ */
OpenPOWER on IntegriCloud