diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2008-06-03 14:36:21 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2008-06-03 14:36:21 +0000 |
commit | e70f08b5652c86aa41ffd6d501e1cd28172dc64b (patch) | |
tree | ba7f83b7c287739aae3e6689bc8bada00eba64e6 /usr.bin | |
parent | 0743eefa3417919830b5416ee2abe83a4a9c019a (diff) |
Allow aucat to play/record from input-only or output-only devices.
ok jakemsr, ratchov
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/aucat/dev_sun.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/aucat/dev_sun.c b/usr.bin/aucat/dev_sun.c index a2ab57684ad..e0e36b07d0e 100644 --- a/usr.bin/aucat/dev_sun.c +++ b/usr.bin/aucat/dev_sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_sun.c,v 1.3 2008/06/02 17:08:11 ratchov Exp $ */ +/* $OpenBSD: dev_sun.c,v 1.4 2008/06/03 14:36:20 drahn Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -107,13 +107,21 @@ dev_init(char *path, struct aparams *ipar, struct aparams *opar, { int fd; int fullduplex; + int flags; struct audio_info aui; struct audio_bufinfo aubi; if (!ipar && !opar) errx(1, "%s: must at least play or record", path); - fd = open(path, O_RDWR | O_NONBLOCK); + if (ipar && opar) { + flags = O_RDWR; + } else if (ipar) { + flags = O_RDONLY; + } else { + flags = O_WRONLY; + } + fd = open(path, flags | O_NONBLOCK); if (fd < 0) { warn("%s", path); return -1; |