Subject: audio drivers don't automatically go into record or play mode
To: None <gnats-bugs@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: current-users
Date: 04/29/1995 18:48:19
>Submitter-Id: net
>Originator: John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Confidential: no
>Synopsis: /dev/audio when opened in half-duplex mode doesn't auto-select its mode
>Severity: non-critical
>Priority: medium
>Category: kern
>Class: change-request
>Release: 1.0A
>Environment:
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #304: Sat Apr 29 18:31:26 EDT 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386
>Description:
When /dev/audio is opened for read only, or for write only, it should go
into "stupid non-ioctl() aware program" mode, i.e. it should auto-select
the mode depending on the direction of the open.
>How-To-Repeat:
cat /dev/audio >/tmp/audio
Notice that it doesn't give you anything on a half-duplex device, such
as the SBPro.
>Fix:
--- 1.1 1995/04/29 21:08:13
+++ sys/dev/audio.c 1995/04/29 22:40:59
@@ -573,6 +573,20 @@
audio_init_record(sc);
/* audiostartr(sc); don't start recording until read */
}
+ }
+ if (ISDEVAUDIO(dev)) {
+ /* if open only for read or only for write, then set specific mode */
+ if ((flags & (FWRITE|FREAD)) == FWRITE) {
+ sc->sc_mode = 1 << AUMODE_PLAY;
+ sc->pr.cb_pause = 0;
+ sc->rr.cb_pause = 1;
+ audiostartp(sc);
+ } else if ((flags & (FWRITE|FREAD)) == FREAD) {
+ sc->sc_mode = 1 << AUMODE_RECORD;
+ sc->rr.cb_pause = 0;
+ sc->pr.cb_pause = 1;
+ audiostartr(sc);
+ }
}
splx(s);
return (0);