From kazuhito@ph.noda.tus.ac.jp  Thu Dec  9 14:13:09 2004
Return-Path: <kazuhito@ph.noda.tus.ac.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 462C316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Dec 2004 14:13:09 +0000 (GMT)
Received: from t-mta2.odn.ne.jp (mfep2.odn.ne.jp [143.90.131.180])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 051AE43D2F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Dec 2004 14:13:08 +0000 (GMT)
	(envelope-from kazuhito@ph.noda.tus.ac.jp)
Received: from localhost ([61.196.1.74]) by t-mta2.odn.ne.jp with ESMTP
          id <20041209141306903.VJPW.481886.t-mta2.odn.ne.jp@mta2.odn.ne.jp>;
          Thu, 9 Dec 2004 23:13:06 +0900
Message-Id: <20041209.231306.730548600.kazuhito@ph.noda.tus.ac.jp>
Date: Thu, 09 Dec 2004 23:13:06 +0900 (JST)
From: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
Reply-To: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc: kazuhito@ph.noda.tus.ac.jp
Subject: Channels of USB audio can't be initialized (uaudio).
X-Send-Pr-Version: 3.113

>Number:         74893
>Category:       kern
>Synopsis:       [sound] [patch] Channels of USB audio can't be initialized (uaudio).
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 09 14:20:24 GMT 2004
>Closed-Date:    Tue Nov 08 16:48:37 GMT 2005
>Last-Modified:  Tue Nov 08 16:48:37 GMT 2005
>Originator:     Kazuhito HONDA
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD kaoru 5.3-STABLE FreeBSD 5.3-STABLE #182: Wed Dec 8 00:40:36 JST 2004 root@kaoru:/usr/obj/src/sys/i386/compile/KAORU.5.3.1 i386


>Description:
I use a usb audio device, Sound Blaster Digital Music (SBDM).  It played some sound sources (but false sampling rate) on FreeBSD-stable of about  Nov 15.  But It can't be used on the code of Dec 8 with this error message (dmesg):

uaudio0: Creative USB Audio, rev 1.10/1.00, addr 2
uaudio_add_selector: NOT IMPLEMENTED
uaudio0: audio rev 1.00
pcm0: <USB Audio> on uaudio0
pcm0: chn_init(pcm0:play:0) failed: err = 19
pcm0: pcm_chn_create(ua_chan, 1, 0xc1a74d00) failed

This results from EFBIG error of _bus_dmamap_load_buffer function in busdma_machdep.c (at least in the case of i386). 
>How-To-Repeat:
always.
>Fix:
I don't know.

But it roughly solves this problem that DMA buffer size is decreased:

--- patch begins here ---
--- src/sys/dev/sound/usb/uaudio_pcm.c.orig	Sun Oct 31 02:56:01 2004
+++ src/sys/dev/sound/usb/uaudio_pcm_n.c	Thu Dec  9 04:21:10 2004
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.5 2004/07/16 03:58:57 tanimura Exp $ */
+/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm_n.c,v 1.5 $ */
 
 /*
  * Copyright (c) 2000-2002 Hiroyuki Aizu <aizu@navi.org>
@@ -58,7 +58,7 @@
 
 static struct pcmchan_caps ua_reccaps = {8000, 48000, ua_recfmt, 0};
 
-#define UAUDIO_PCM_BUFF_SIZE	16*1024
+#define UAUDIO_PCM_BUFF_SIZE	(16*1024-1)
 
 /************************************************************/
 static void *
--- patch ends here ---



>Release-Note:
>Audit-Trail:

From: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
To: freebsd-gnats-submit@FreeBSD.org
Cc: kazuhito@ph.noda.tus.ac.jp
Subject: Re: kern/74893: Channels of USB audio can't be initialized
 (uaudio).
Date: Sun, 26 Dec 2004 01:23:05 +0900 (JST)

 Oh-oh.  I'm shamed that I don't find the interchange 
 of left and right channels with this patch.
 The left-right channels are correctly playbacked
 when UAUDIO_PCM_BUFF_SIZE is decreased not by 1 but by 4,
 in the case of 16-bit-stereo source.
 But I guess that interchange is caused in other precision sources.

From: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
To: bug-followup@FreeBSD.org
Cc: kazuhito@ph.noda.tus.ac.jp
Subject: Re: kern/74893: Channels of USB audio can't be initialized
 (uaudio).
Date: Wed, 02 Feb 2005 13:08:29 +0900 (JST)

 This problem can also be fixed by enlarging maxsegz 
 of bus_dma_tag_create() in uaudio_pcm.c.
 It must come from maxsegz which is smaller 
 than than UAUDIO_PCM_BUFF_SIZE and one digit smaller 
 than maxsegzs of other audio devices.
 But I don't know it has some reasons, 
 or it is a mere copy mistake.
Responsible-Changed-From-To: freebsd-bugs->sound 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Apr 3 09:02:43 GMT 2005 
Responsible-Changed-Why:  
Reassign to appropriate mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74893 

From: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
To: freebsd-gnats-submit@FreeBSD.org
Cc: kazuhito@ph.noda.tus.ac.jp
Subject: Re: kern/74893: Channels of USB audio can't be initialized
 (uaudio).
Date: Thu, 14 Apr 2005 01:30:12 +0900 (JST)

 In <20050410195645.GA2178@cnd.mcgill.ca> at freebsd-multimedia@freebsd.org, 
 Julian Elischer said:
 	The uaudio dma problem came up again on the -current list so I
     had another look at it seems that we don't even need to do DMA at all
     at that layer of the driver.
 and he attached a patch along this idea.
 
 It is true, and his solution is fundamental.

From: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
To: freebsd-gnats-submit@FreeBSD.org
Cc: kazuhito@ph.noda.tus.ac.jp, kazuhito@ph.noda.tus.ac.jp
Subject: Re: kern/74893: Channels of USB audio can't be initialized
 (uaudio).
Date: Thu, 14 Apr 2005 01:43:11 +0900 (JST)

 Sorry, I wrote the reciever of the carbon copy 
 in mistake for the mail sender.
 Mathew Kanner wrote that mail.
State-Changed-From-To: open->feedback 
State-Changed-By: arved 
State-Changed-When: Tue Jun 14 12:56:08 GMT 2005 
State-Changed-Why:  
It looks like matk committed his patch, 
Is there any reason this PR can't be closed?  

http://www.freebsd.org/cgi/query-pr.cgi?pr=74893 
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Tue Nov 8 16:48:08 GMT 2005 
State-Changed-Why:  
Submitter agreed that this can be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74893 
>Unformatted:
