Module Name:    src
Committed By:   mrg
Date:           Sat Mar  5 22:10:39 UTC 2016

Modified Files:
        src/usr.bin/audiocfg: audiodev.c

Log Message:
if opening the audio device fails, try opening again with write-only.
this allows my playback-only usb device to be listed and tested.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/audiocfg/audiodev.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/audiocfg/audiodev.c
diff -u src/usr.bin/audiocfg/audiodev.c:1.5 src/usr.bin/audiocfg/audiodev.c:1.6
--- src/usr.bin/audiocfg/audiodev.c:1.5	Sun Aug 11 06:31:00 2013
+++ src/usr.bin/audiocfg/audiodev.c	Sat Mar  5 22:10:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.5 2013/08/11 06:31:00 dholland Exp $ */
+/* $NetBSD: audiodev.c,v 1.6 2016/03/05 22:10:39 mrg Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca>
@@ -89,8 +89,11 @@ audiodev_getinfo(struct audiodev *adev)
 		adev->defaultdev = true;
 
 	adev->fd = open(adev->path, O_RDWR);
-	if (adev->fd == -1)
-		return -1;
+	if (adev->fd == -1) {
+		adev->fd = open(adev->path, O_WRONLY);
+		if (adev->fd == -1)
+			return -1;
+	}
 	if (ioctl(adev->fd, AUDIO_GETDEV, &adev->audio_device) == -1) {
 		close(adev->fd);
 		return -1;

Reply via email to