diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index c4368c04b559..554d277f3eed 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.75 2004/07/09 18:08:00 mycroft Exp $ */ +/* $NetBSD: uaudio.c,v 1.76 2004/07/16 20:08:23 mycroft Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.75 2004/07/09 18:08:00 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.76 2004/07/16 20:08:23 mycroft Exp $"); #include #include @@ -2368,9 +2368,13 @@ uaudio_set_params(void *addr, int setmode, int usemode, if ((usemode & AUMODE_RECORD) && sc->sc_recchan.altidx != -1) sc->sc_alts[sc->sc_recchan.altidx].sc_busy = 0; + /* Some uaudio devices are unidirectional. Don't try to find a + matching mode for the unsupported direction. */ + setmode &= sc->sc_mode; + for (mode = AUMODE_RECORD; mode != -1; mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) { - if ((setmode & sc->sc_mode & mode) == 0) + if ((setmode & mode) == 0) continue; p = (mode == AUMODE_PLAY) ? play : rec;