Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Return correct properties.



details:   https://anonhg.NetBSD.org/src/rev/d0841f829932
branches:  trunk
changeset: 841882:d0841f829932
user:      isaki <isaki%NetBSD.org@localhost>
date:      Thu Jun 06 12:59:33 2019 +0000

description:
Return correct properties.
It fixes PR kern/54264.
XXX I'm not sure all bidirectional uaudio devices support FULLDUPLEX
    or INDEPENDENT.

diffstat:

 sys/dev/usb/uaudio.c |  19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r f526e4ae7b9b -r d0841f829932 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Thu Jun 06 09:42:45 2019 +0000
+++ b/sys/dev/usb/uaudio.c      Thu Jun 06 12:59:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudio.c,v 1.160 2019/05/08 13:40:19 isaki Exp $       */
+/*     $NetBSD: uaudio.c,v 1.161 2019/06/06 12:59:33 isaki Exp $       */
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.160 2019/05/08 13:40:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.161 2019/06/06 12:59:33 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2264,8 +2264,21 @@
 Static int
 uaudio_get_props(void *addr)
 {
-       return AUDIO_PROP_FULLDUPLEX | AUDIO_PROP_INDEPENDENT;
+       struct uaudio_softc *sc;
+       int props;
 
+       sc = addr;
+       props = 0;
+       if ((sc->sc_mode & AUMODE_PLAY))
+               props |= AUDIO_PROP_PLAYBACK;
+       if ((sc->sc_mode & AUMODE_RECORD))
+               props |= AUDIO_PROP_CAPTURE;
+
+       /* XXX I'm not sure all bidirectional devices support FULLDUP&INDEP */
+       if (props == (AUDIO_PROP_PLAYBACK | AUDIO_PROP_CAPTURE))
+               props |= AUDIO_PROP_FULLDUPLEX | AUDIO_PROP_INDEPENDENT;
+
+       return props;
 }
 
 Static void



Home | Main Index | Thread Index | Old Index