Module Name:    src
Committed By:   isaki
Date:           Thu Jun  6 12:59:33 UTC 2019

Modified Files:
        src/sys/dev/usb: uaudio.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/usb/uaudio.c

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

Modified files:

Index: src/sys/dev/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.160 src/sys/dev/usb/uaudio.c:1.161
--- src/sys/dev/usb/uaudio.c:1.160	Wed May  8 13:40:19 2019
+++ src/sys/dev/usb/uaudio.c	Thu Jun  6 12:59:33 2019
@@ -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 @@ uaudio_round_blocksize(void *addr, int b
 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

Reply via email to