Subject: kern/1006: audio drivers don't automatically go into record or play mode
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 04/29/1995 16:20:05
>Number: 1006
>Category: kern
>Synopsis: /dev/audio when opened in half-duplex mode doesn't auto-select its mode
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Apr 29 16:20:02 1995
>Originator: John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>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);
>Audit-Trail:
>Unformatted: