summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2008-06-03 14:36:20 +0000
committerdrahn <drahn@openbsd.org>2008-06-03 14:36:20 +0000
commit298793f01a0ca8500de90e72f2be920a41af75a8 (patch)
treea6ec38a81566094b105374704feb2bb4556a70df
parentput code to print periodic debug statistics in #ifdef EM_DEBUG, shrinks (diff)
downloadwireguard-openbsd-298793f01a0ca8500de90e72f2be920a41af75a8.tar.xz
wireguard-openbsd-298793f01a0ca8500de90e72f2be920a41af75a8.zip
Allow aucat to play/record from input-only or output-only devices.
ok jakemsr, ratchov
-rw-r--r--usr.bin/aucat/dev_sun.c12
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;