NetBSD Problem Report #1006

From gnats  Sat Apr 29 16:06:42 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id QAA15119 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sat, 29 Apr 1995 16:06:40 -0700
Message-Id: <199504292248.SAA00477@kolvir.blrc.ma.us>
Date: Sat, 29 Apr 1995 18:48:19 -0400
From: John Kohl <jtk@kolvir.blrc.ma.us>
Reply-To: jtk@kolvir.blrc.ma.us
To: gnats-bugs@netbsd.org
Cc: current-users@netbsd.org
Subject: audio drivers don't automatically go into record or play mode
X-Send-Pr-Version: 3.2

>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
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 29 16:20:02 +0000 1995
>Closed-Date:    Fri May 05 22:41:48 +0000 1995
>Last-Modified:  
>Originator:     John Kohl
>Release:        1.0A
>Organization:
NetBSD Kernel Hackers `R` Us
>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);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brezak 
State-Changed-When: Fri May 5 15:41:48 PDT 1995 
State-Changed-Why:  
Applied suggested patch. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.