From d8944a7749386ed10413d532a977fcefea4f9a01 Mon Sep 17 00:00:00 2001 From: Jacob Meuser Date: Fri, 6 Jul 2007 04:40:21 +0000 Subject: - enable full-duplex mode by default if a device is opened read-write and it supports full-duplex operation. - update documentation to match this behaviour. see http://marc.info/?l=openbsd-tech&m=118310788926431&w=2 for more background on this change "patches look correct to me" marc@ --- share/man/man4/audio.4 | 7 +++---- sys/dev/audio.c | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/share/man/man4/audio.4 b/share/man/man4/audio.4 index fbae1c8c3d1..17afb388b6a 100644 --- a/share/man/man4/audio.4 +++ b/share/man/man4/audio.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: audio.4,v 1.40 2007/05/31 19:19:49 jmc Exp $ +.\" $OpenBSD: audio.4,v 1.41 2007/07/06 04:40:20 jakemsr Exp $ .\" $NetBSD: audio.4,v 1.20 1998/05/28 17:27:15 augustss Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: July 6 2007 $ .Dt AUDIO 4 .Os .Sh NAME @@ -118,8 +118,7 @@ concurrently without interference. If a full-duplex capable .Nm audio device is opened for both reading and writing, -it will start in half-duplex play mode; full-duplex mode has to be set -explicitly. +it will start in full-duplex playback and recording mode. On either type of device, if the playback mode is paused then silence is played instead of the provided samples and, if recording is paused, then the process blocks in diff --git a/sys/dev/audio.c b/sys/dev/audio.c index c924fbf6114..cc814273ea8 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.59 2007/07/06 04:25:28 jakemsr Exp $ */ +/* $OpenBSD: audio.c,v 1.60 2007/07/06 04:40:20 jakemsr Exp $ */ /* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */ /* @@ -999,11 +999,9 @@ audio_open(dev, sc, flags, ifmt, p) sc->sc_eof = 0; sc->sc_playdrop = 0; - sc->sc_full_duplex = 0; -/* doesn't always work right on SB. + sc->sc_full_duplex = (flags & (FWRITE|FREAD)) == (FWRITE|FREAD) && (sc->hw_if->get_props(sc->hw_hdl) & AUDIO_PROP_FULLDUPLEX); -*/ mode = 0; if (flags & FREAD) { -- cgit v1.2.3