Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/audiocfg if opening the audio device fails, try open...



details:   https://anonhg.NetBSD.org/src/rev/de617418bbcc
branches:  trunk
changeset: 343937:de617418bbcc
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Mar 05 22:10:39 2016 +0000

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

diffstat:

 usr.bin/audiocfg/audiodev.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (23 lines):

diff -r ef19ccf0f807 -r de617418bbcc usr.bin/audiocfg/audiodev.c
--- a/usr.bin/audiocfg/audiodev.c       Sat Mar 05 20:26:07 2016 +0000
+++ b/usr.bin/audiocfg/audiodev.c       Sat Mar 05 22:10:39 2016 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -89,8 +89,11 @@
                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;



Home | Main Index | Thread Index | Old Index