From owner-freebsd-multimedia@FreeBSD.ORG Sun Feb 13 10:05:29 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADB19106566B for ; Sun, 13 Feb 2011 10:05:29 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id 3AF848FC0C for ; Sun, 13 Feb 2011 10:05:28 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=6QwXiDozn7Gnsf2tGidwH+ndAwLlGixx7JAIKZICKmI= c=1 sm=1 a=kj9zAlcOel0A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=LtfSNsxXVXpDFrYMqoUA:9 a=VBuOze46KWGNeJA-hBUWqBMCvWMA:4 a=CjuIK1q_8ugA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 87026990 for freebsd-multimedia@freebsd.org; Sun, 13 Feb 2011 11:05:27 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Sun, 13 Feb 2011 11:05:18 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201102131105.18912.hselasky@c2i.net> Subject: Recording played back sound X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2011 10:05:29 -0000 Hi, Does the existing sound system support recording what is being played back? --HPS From owner-freebsd-multimedia@FreeBSD.ORG Mon Feb 14 11:07:08 2011 Return-Path: Delivered-To: freebsd-multimedia@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F11E1065696 for ; Mon, 14 Feb 2011 11:07:08 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 610998FC15 for ; Mon, 14 Feb 2011 11:07:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1EB78mw077237 for ; Mon, 14 Feb 2011 11:07:08 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1EB77P4077235 for freebsd-multimedia@FreeBSD.org; Mon, 14 Feb 2011 11:07:07 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 14 Feb 2011 11:07:07 GMT Message-Id: <201102141107.p1EB77P4077235@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-multimedia@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-multimedia@FreeBSD.org X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2011 11:07:08 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o ports/154083 multimedia multimedia/gstreamer-plugins-fluendo-mpegdemux: update o ports/154082 multimedia audio/gstreamer-plugins-fluendo-mp3: update to 0.10.15 o kern/153920 multimedia [sound] [patch] Replace the GPL'd sound/maestro3 heade o kern/153901 multimedia [sound] [patch] Replace the GPL'd emu10k1-alsa.h with o ports/153846 multimedia graphics/libcaca 0.99.beta17 - Hidden dependency on Xl o kern/152622 multimedia [pcm] uaudio recording problem o kern/152500 multimedia [hdac] play interrupt timeout, channel dead o kern/152378 multimedia [sound][patch] Update snd_envy24ht to be MPSAFE and us o ports/150502 multimedia multimedia/gpac-libgpac 0.4.5_4,1 fails to compile on o kern/150284 multimedia [snd_hda] No gain with Audio o kern/149943 multimedia [pcm]: CS4236 audio problem o ports/149765 multimedia [PATCH] audio/faac: improve build patches o kern/148741 multimedia [sound] Headphones are deaf (do not work) on Lenovo Th o kern/147504 multimedia [oss] [panic] panic: dev_pager_getpage: map function r p kern/147466 multimedia [snd_hda] [patch] Thinkpad t510, codecs not recognized o kern/146031 multimedia [snd_hda] race condition when kldunload snd_hda sound o kern/144659 multimedia [pcm] The distortion of the sound playback of music at o kern/143505 multimedia [pcm] FreeBSD 8.0-RELEASE (x64) won't make sound card o kern/141826 multimedia [snd_hda] load of snd_hda module fails o kern/140591 multimedia [PATCH][sound] No sound output on lineout/headphone ja o kern/140453 multimedia [sound] No sound inside Virtualbox on 50% volume o kern/137589 multimedia [snd_uaudio] snd_uaudio.ko (USB audio driver) doesn't o kern/134767 multimedia [sound] [snd_hda] [regression] Sigmatel STAC9205X no s o kern/132848 multimedia [sound] [snd_emu10kx] driver problem with card init, s o kern/132511 multimedia [sound] [snd_hda] Probing ALC888 codec on ASRock K10N7 o kern/129604 multimedia [sound] Sound stops with error: pcm0:virtual:dsp0.vp0: o kern/127131 multimedia [bktr] /usr/src/sys/dev/bktr/bktr_os.c, line 469: wron s kern/125756 multimedia [sound] [patch] cannot detect soft-modem on HDA bus o kern/124319 multimedia [sound] [snd_emu10k1] [regression] Cannot record from o kern/122086 multimedia [sound] maestro sound driver is working, but mixer ini p kern/121156 multimedia [sound] [patch] Turn on inverted external amplifier se o kern/120857 multimedia [sound] [snd_emu10k1] snd_emu10k1 driver issues a warn o kern/120780 multimedia [sound] [snd_hda] snd_hda doesn't work on Dell Latitut o kern/119973 multimedia [sound] [snd_maestro] [regression] snd_maestro only wo o kern/119931 multimedia [sound] No sound card detected on ASUS "K8V-X SE R2.00 o kern/119759 multimedia [sound] [snd_emu10k1] [regression] Can not record anyt f kern/115666 multimedia [sound] Microphone does not work o kern/115300 multimedia [sound] [snd_hda] [regression] snd_hda(4) fails to att o kern/114760 multimedia [sound] [snd_cmi] snd_cmi driver causing sporadic syst o kern/111767 multimedia [sound] ATI SB450 High Definition Audio Controller sou o kern/107516 multimedia [sound] [snd_emu10k1] - skips, clicks and lag after a o kern/107051 multimedia [sound] only 2 channels output works for the ALC850 (o o kern/104874 multimedia [sound] [snd_emu10k1] kldload snd_emu10k1 hangs system o kern/104626 multimedia [sound] FreeBSD 6.2 does not support SoundBlaster Audi o kern/101417 multimedia [sound] 4-speakers output not possible on Asus A8V-Del o kern/100859 multimedia [sound] [snd_ich] snd_ich broken on GIGABYTE 915 syste o kern/98752 multimedia [sound] Intel ich6 82801 FB - on Packard Bell A8810 la o kern/98504 multimedia [sound] Sound is distorted with SB Live 5.1 o kern/98496 multimedia [sound] [snd_ich] some functions don't work in my soun o kern/97609 multimedia [sound] Load Sound Module - VIA8233 - fails o kern/97535 multimedia [sound] [snd_mss] doesn't work in 6.0-RELEASE and abov o kern/96538 multimedia [sound] emu10k1-driver inverts channels o kern/95086 multimedia [sound] uaudio line in problem with sbdm lx o kern/94279 multimedia [sound] [snd_neomagic] snd_neomagic crashes on FreeBSD o kern/93986 multimedia [sound] Acer TravelMate 4652LMi pcm0 channel dead o kern/92512 multimedia [sound] distorted mono output with emu10k1 o kern/87782 multimedia [sound] snd_t4dwave and pcm0:record:0: record interrup s kern/83697 multimedia [sound] [snd_mss] [patch] support, docs added for full o kern/82043 multimedia [sound] snd_emu10k1 - mixer does not work. o kern/81146 multimedia [sound] Sound isn't working AT ALL for Sis7012 onboard o kern/80632 multimedia [sound] pcm driver missing support for CMI8738 auxilla o kern/79912 multimedia [sound] sound broken for 2 VIA chipsets: interrupt sto o kern/79905 multimedia [sound] sis7018 sound module problem o kern/79678 multimedia [sound] sound works except recording from any source o conf/75137 multimedia [sound] add snd_* modules support to /etc/rc.d/mixer f kern/72995 multimedia [sound] Intel ICH2 (82801BA) - sound nearly inaudible o kern/63204 multimedia [sound] /dev/mixer broken with ESS Maestro-2E (still o o kern/60677 multimedia [sound] [patch] No reaction of volume controy key on I s kern/60599 multimedia [bktr] [partial patch] No sound for ATI TV Wonder (ste o kern/37600 multimedia [sound] [partial patch] t4dwave drive doesn't record. o kern/23546 multimedia [sound] [snd_csa] [patch] csa DMA-interrupt problem 71 problems total. From owner-freebsd-multimedia@FreeBSD.ORG Tue Feb 15 19:08:07 2011 Return-Path: Delivered-To: multimedia@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B07F106566B for ; Tue, 15 Feb 2011 19:08:07 +0000 (UTC) (envelope-from erwin@mail.droso.net) Received: from mail.droso.net (grizzly.droso.net [IPv6:2a01:4f8:130:7021::5]) by mx1.freebsd.org (Postfix) with ESMTP id 9F9DE8FC18 for ; Tue, 15 Feb 2011 19:08:06 +0000 (UTC) Received: by mail.droso.net (Postfix, from userid 1001) id 06B6159B0E; Tue, 15 Feb 2011 20:08:06 +0100 (CET) Date: Tue, 15 Feb 2011 20:08:05 +0100 From: Erwin Lansing To: multimedia@FreeBSD.org Message-ID: <20110215190805.GZ18095@droso.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="REOXmE5zpOGz6VLu" Content-Disposition: inline X-Operating-System: FreeBSD/amd64 8.1-RELEASE User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: [ports-i386@FreeBSD.org: win32-codecs-20100303,1 failed on i386 7] X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2011 19:08:07 -0000 --REOXmE5zpOGz6VLu Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable FYI; can you please investigate and/or report to the developers? If you are already aware of this problem but do not yet have a fix, please mark the port BROKEN in the appropriate case, so that users do not unexpectedly encounter it. See http://pointyhat.freebsd.org for the full log. Thanks, -erwin ----- Forwarded message from User Ports-i386 ----- Date: Tue, 15 Feb 2011 19:03:19 GMT =46rom: User Ports-i386 To: erwin@FreeBSD.org, miwi@FreeBSD.org, itetcu@FreeBSD.org Subject: win32-codecs-20100303,1 failed on i386 7 You can also find this build log at http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/a.7.20110215174908/= win32-codecs-20100303,1.log building win32-codecs-20100303,1 on hobson6.isc.freebsd.org in directory /usr2/pkgbuild/7/20110215174908/chroot/5 DISTDIR=3D/tmp/distfiles DISTDIR=3D/tmp/distfiles/RESTRICTED building for: 7.4-RC3 i386 maintained by: multimedia@FreeBSD.org port directory: /usr/ports/multimedia/win32-codecs Makefile ident: $FreeBSD: ports/multimedia/win32-codecs/Makefile,v 1.42 201= 0/04/10 14:56:36 sylvio Exp $ build started at Tue Feb 15 19:01:47 UTC 2011 FETCH_DEPENDS=3D PATCH_DEPENDS=3D EXTRACT_DEPENDS=3D BUILD_DEPENDS=3D RUN_DEPENDS=3D prefixes: LOCALBASE=3Dusr/local add_pkg =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D> License check disabled, port has not defined LICENSE =3D> all-20100303.tar.bz2 doesn't seem to exist in /tmp/distfiles/RESTRICTE= D/win32. =3D> Attempting to fetch ftp://freebsd.isc.org/pub/FreeBSD/ports/distfiles/= win32//all-20100303.tar.bz2 fetch: ftp://freebsd.isc.org/pub/FreeBSD/ports/distfiles/win32/all-20100303= =2Etar.bz2: Protocol error =3D> Attempting to fetch ftp://pointyhat.freebsd.org/pub/FreeBSD/distfiles/= win32//all-20100303.tar.bz2 fetch: ftp://pointyhat.freebsd.org/pub/FreeBSD/distfiles/win32/all-20100303= =2Etar.bz2: File unavailable (e.g., file not found, no access) =3D> Attempting to fetch http://www1.mplayerhq.hu/MPlayer/releases/codecs//= all-20100303.tar.bz2 fetch: http://www1.mplayerhq.hu/MPlayer/releases/codecs/all-20100303.tar.bz= 2: size mismatch: expected 20670194, actual 12604416 =3D> Attempting to fetch http://www2.mplayerhq.hu/MPlayer/releases/codecs//= all-20100303.tar.bz2 fetch: http://www2.mplayerhq.hu/MPlayer/releases/codecs/all-20100303.tar.bz= 2: size mismatch: expected 20670194, actual 12604416 =3D> Attempting to fetch http://www4.mplayerhq.hu/MPlayer/releases/codecs//= all-20100303.tar.bz2 fetch: http://www4.mplayerhq.hu/MPlayer/releases/codecs/all-20100303.tar.bz= 2: Operation timed out =3D> Attempting to fetch http://ftp.lug.udel.edu/MPlayer/releases/codecs//a= ll-20100303.tar.bz2 fetch: http://ftp.lug.udel.edu/MPlayer/releases/codecs/all-20100303.tar.bz2= : Moved Permanently =3D> Attempting to fetch http://www.mplayerhq.hu/MPlayer/releases/codecs//a= ll-20100303.tar.bz2 fetch: http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20100303.tar.bz2= : size mismatch: expected 20670194, actual 12604416 =3D> Attempting to fetch ftp://ftp1.mplayerhq.hu/MPlayer/releases/codecs//a= ll-20100303.tar.bz2 fetch: ftp://ftp1.mplayerhq.hu/MPlayer/releases/codecs/all-20100303.tar.bz2= : size mismatch: expected 20670194, actual 12604416 =3D> Attempting to fetch ftp://ftp2.mplayerhq.hu/MPlayer/releases/codecs//a= ll-20100303.tar.bz2 fetch: ftp://ftp2.mplayerhq.hu/MPlayer/releases/codecs/all-20100303.tar.bz2= : size mismatch: expected 20670194, actual 12604416 =3D> Attempting to fetch ftp://ftp.lug.udel.edu/MPlayer/releases/codecs//al= l-20100303.tar.bz2 fetch: ftp://ftp.lug.udel.edu/MPlayer/releases/codecs/all-20100303.tar.bz2:= Protocol error =3D> Attempting to fetch ftp://freebsd.isc.org/pub/FreeBSD/ports/distfiles/= win32//all-20100303.tar.bz2 fetch: ftp://freebsd.isc.org/pub/FreeBSD/ports/distfiles/win32/all-20100303= =2Etar.bz2: Protocol error =3D> Attempting to fetch ftp://pointyhat.freebsd.org/pub/FreeBSD/distfiles/= win32//all-20100303.tar.bz2 fetch: ftp://pointyhat.freebsd.org/pub/FreeBSD/distfiles/win32/all-20100303= =2Etar.bz2: Protocol error =3D> Couldn't fetch it - please try to retrieve this =3D> port manually into /tmp/distfiles/RESTRICTED/win32 and try again. *** Error code 1 Stop in /a/ports/multimedia/win32-codecs. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D build of /usr/ports/multimedia/win32-codecs ended at Tue Feb 15 19:03:17 UT= C 2011 !DSPAM:4d5acdfa315012491640823! ----- End forwarded message ----- --=20 Erwin Lansing http://droso.org Prediction is very difficult especially about the future erwin@FreeBSD.org --REOXmE5zpOGz6VLu Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFNWs8Vqy9aWxUlaZARAqY+AJ9kZT49ECqju1sZLqUGvuAoRsMNNACglhqK I9KGBpamXn9CDcxUgaCWFsE= =2c42 -----END PGP SIGNATURE----- --REOXmE5zpOGz6VLu-- From owner-freebsd-multimedia@FreeBSD.ORG Wed Feb 16 02:50:17 2011 Return-Path: Delivered-To: freebsd-multimedia@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F2221065695; Wed, 16 Feb 2011 02:50:17 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 35E968FC08; Wed, 16 Feb 2011 02:50:17 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1G2oH26014088; Wed, 16 Feb 2011 02:50:17 GMT (envelope-from edwin@freefall.freebsd.org) Received: (from edwin@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1G2oHRS014079; Wed, 16 Feb 2011 02:50:17 GMT (envelope-from edwin) Date: Wed, 16 Feb 2011 02:50:17 GMT Message-Id: <201102160250.p1G2oHRS014079@freefall.freebsd.org> To: edwin@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org, freebsd-multimedia@FreeBSD.org From: edwin@FreeBSD.org Cc: Subject: Re: ports/154815: multimedia/win32-codecs build fails X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2011 02:50:17 -0000 Synopsis: multimedia/win32-codecs build fails Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-multimedia Responsible-Changed-By: edwin Responsible-Changed-When: Wed Feb 16 02:50:16 UTC 2011 Responsible-Changed-Why: Over to maintainer (via the GNATS Auto Assign Tool) http://www.freebsd.org/cgi/query-pr.cgi?pr=154815 From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 10:18:54 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 816571065674 for ; Thu, 17 Feb 2011 10:18:54 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.c2i.net [212.247.154.2]) by mx1.freebsd.org (Postfix) with ESMTP id C5C478FC27 for ; Thu, 17 Feb 2011 10:18:53 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=Vlw5OJcoxCC473z5moizI40ESYe+BpcMN2hU0iQoJwI= c=1 sm=1 a=46oqABt5gJ4A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=ndaoGXS1AAAA:8 a=3ziMWcUK5_xYcMQ0bhMA:9 a=APSVeI_o1NQ5sB_7TB8A:7 a=l_OltHOgMSR2TluNCYralG3mKrgA:4 a=CjuIK1q_8ugA:10 a=qY83MnDu8rvUkoB5eoAA:9 a=VBO2gmYM-_pV7M2Pr-0A:7 a=B4lRkPcYGopspZAsoz1Gw6nR_BcA:4 a=TmWXExzkfR-4VbEZ:21 a=k_LAZnOC6g8uWLS9:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe01.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89685611 for freebsd-multimedia@freebsd.org; Thu, 17 Feb 2011 11:18:51 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Thu, 17 Feb 2011 11:18:40 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_AYPXNgVCRizMd8n" Message-Id: <201102171118.40721.hselasky@c2i.net> Subject: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 10:18:54 -0000 --Boundary-00=_AYPXNgVCRizMd8n Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Dear all USB MIDI freaks using FreeBSD 8+! After some more testing I'm going to push a patch for the USB AUDIO driver that improves USB MIDI on FreeBSD. I'm sending the patch out for review so that users get a chance to try out the changes before they get committed. The patch should apply to 8.2-RELEASE aswell as 9-CURRENT. How to apply: cd /usr/src/sys/dev/sound/usb/ cat umidi_patch_001.txt | patch A short summary of what the changes are about: - Make the USB MIDI driver more OSS compliant by implementing the correct data format for the /dev/umidiX.Y character devices. Also implement some missing OSS MIDI ioctls. - Use the USB stack's builtin clear-stall feature. - Wrap some long lines. - Use memcpy() instead of bcopy(). --HPS Some demo tunes: fluidsynth + zynaddsubfx + audacity + midipp: http://www.selasky.org/hans_petter/synth_test_new.mp3 zynaddsubfx + midipp: http://www.selasky.org/hans_petter/synth_test.mp3 --HPS --Boundary-00=_AYPXNgVCRizMd8n Content-Type: text/plain; charset="us-ascii"; name="umidi_patch_001.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="umidi_patch_001.txt" === uaudio.c ================================================================== --- uaudio.c (revision 217265) +++ uaudio.c (patch umidi_patch_001.txt level 1) @@ -191,10 +191,15 @@ uint8_t iface_alt_index; }; -#define UMIDI_N_TRANSFER 4 /* units */ #define UMIDI_CABLES_MAX 16 /* units */ #define UMIDI_BULK_SIZE 1024 /* bytes */ +enum { + UMIDI_TX_TRANSFER, + UMIDI_RX_TRANSFER, + UMIDI_N_TRANSFER, +}; + struct umidi_sub_chan { struct usb_fifo_sc fifo; uint8_t *temp_cmd; @@ -224,10 +229,6 @@ uint8_t iface_index; uint8_t iface_alt_index; - uint8_t flags; -#define UMIDI_FLAG_READ_STALL 0x01 -#define UMIDI_FLAG_WRITE_STALL 0x02 - uint8_t read_open_refcount; uint8_t write_open_refcount; @@ -336,9 +337,7 @@ static usb_callback_t uaudio_chan_play_callback; static usb_callback_t uaudio_chan_record_callback; static usb_callback_t uaudio_mixer_write_cfg_callback; -static usb_callback_t umidi_read_clear_stall_callback; static usb_callback_t umidi_bulk_read_callback; -static usb_callback_t umidi_write_clear_stall_callback; static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, @@ -493,7 +492,7 @@ static const struct usb_config umidi_config[UMIDI_N_TRANSFER] = { - [0] = { + [UMIDI_TX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -502,7 +501,7 @@ .callback = &umidi_bulk_write_callback, }, - [1] = { + [UMIDI_RX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -510,26 +509,6 @@ .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, .callback = &umidi_bulk_read_callback, }, - - [2] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_write_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, - - [3] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_read_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, }; static devclass_t uaudio_devclass; @@ -1577,10 +1556,10 @@ uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc) { struct uaudio_mixer_node *p_mc_new = - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); - if (p_mc_new) { - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); + if (p_mc_new != NULL) { + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); p_mc_new->next = sc->sc_mixer_root; sc->sc_mixer_root = p_mc_new; sc->sc_mixer_count++; @@ -3284,25 +3263,12 @@ *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[1]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - } -} - -static void umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct umidi_chan *chan = usbd_xfer_softc(xfer); struct umidi_sub_chan *sub; struct usb_page_cache *pc; - uint8_t buf[1]; + uint8_t buf[4]; uint8_t cmd_len; uint8_t cn; uint16_t pos; @@ -3320,60 +3286,64 @@ while (actlen >= 4) { - usbd_copy_out(pc, pos, buf, 1); - - cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */ - cn = buf[0] >> 4; /* cable number */ + /* copy out the MIDI data */ + usbd_copy_out(pc, pos, buf, 4); + /* command length */ + cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; + /* cable number */ + cn = buf[0] >> 4; + /* + * Lookup sub-channel. The index is range + * checked below. + */ sub = &chan->sub[cn]; - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, - pos + 1, cmd_len, 1); - } else { - /* ignore the command */ + if ((cmd_len != 0) && + (cn < chan->max_cable) && + (sub->read_open != 0)) { + + /* re-pack into a 4-byte array */ + buf[0] = SEQ_MIDIPUTC; + + /* zero unused bytes */ + if (cmd_len == 1) { + buf[2] = 0; + buf[3] = 0; + } else if (cmd_len == 2) { + buf[3] = 0; + } + + /* + * Send data in 4-byte chunks to the + * application: + */ + usb_fifo_put_data_linear( + sub->fifo.fp[USB_FIFO_RX], + buf, 4, 1); } - actlen -= 4; pos += 4; } case USB_ST_SETUP: DPRINTF("start\n"); - - if (chan->flags & UMIDI_FLAG_READ_STALL) { - usbd_transfer_start(chan->xfer[3]); - return; - } +tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - return; + break; default: DPRINTF("error=%s\n", usbd_errstr(error)); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; - usbd_transfer_start(chan->xfer[3]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } -static void -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[0]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - } -} - /* * The following statemachine, that converts MIDI commands to * USB MIDI packets, derives from Linux's usbmidi.c, which @@ -3502,6 +3472,8 @@ sub->temp_cmd = sub->temp_1; sub->state = UMIDI_ST_SYSEX_0; return (1); + default: + break; } } return (0); @@ -3527,13 +3499,9 @@ DPRINTF("actlen=%d bytes\n", len); case USB_ST_SETUP: - +tr_setup: DPRINTF("start\n"); - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { - usbd_transfer_start(chan->xfer[2]); - return; - } total_length = 0; /* reset */ start_cable = chan->curr_cable; tr_any = 0; @@ -3593,7 +3561,7 @@ usbd_xfer_set_frame_len(xfer, 0, total_length); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ @@ -3601,11 +3569,10 @@ if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(chan->xfer[2]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } @@ -3635,7 +3602,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); } static void @@ -3662,7 +3629,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); } static void @@ -3703,7 +3670,7 @@ } /* clear stall first */ mtx_lock(&chan->mtx); - chan->flags |= UMIDI_FLAG_WRITE_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); chan->write_open_refcount++; sub->write_open = 1; @@ -3730,6 +3697,50 @@ umidi_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags) { + struct synth_info *psi; + struct midi_info *pmi; + + switch (cmd) { + case SNDCTL_SYNTH_INFO: + psi = (struct synth_info *)data; + memset(psi, 0, sizeof(*psi)); + psi->name[0] = 'u'; + psi->name[1] = 'm'; + psi->name[2] = 'i'; + psi->name[3] = 'd'; + psi->name[4] = 'i'; + psi->synth_type = SYNTH_TYPE_MIDI; + psi->capabilities = SYNTH_CAP_INPUT; + return (0); + case SNDCTL_MIDI_INFO: + pmi = (struct midi_info *)data; + memset(pmi, 0, sizeof(*pmi)); + pmi->name[0] = 'u'; + pmi->name[1] = 'm'; + pmi->name[2] = 'i'; + pmi->name[3] = 'd'; + pmi->name[4] = 'i'; + pmi->capabilities = SYNTH_CAP_INPUT; + pmi->dev_type = 0x01; /* XXX */ + return (0); + case SNDCTL_SEQ_GETTIME: + *(int *)data = 0; + return (0); + case SNDCTL_SEQ_GETINCOUNT: + *(int *)data = 0; + return (0); + case SNDCTL_SEQ_GETOUTCOUNT: + *(int *)data = 0; + return (0); + case SNDCTL_SEQ_SYNC: + case SNDCTL_SEQ_RESET: + case SNDCTL_SEQ_PANIC: + /* FALLTHROUGH */ + case SNDCTL_SEQ_TESTMIDI: + return (0); + default: + break; + } return (ENODEV); } @@ -3769,7 +3780,8 @@ DPRINTF("setting of alternate index failed!\n"); goto detach; } - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, chan->iface_index, + sc->sc_mixer_iface_index); error = usbd_transfer_setup(uaa->device, &chan->iface_index, chan->xfer, umidi_config, UMIDI_N_TRANSFER, @@ -3799,13 +3811,15 @@ mtx_lock(&chan->mtx); /* clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); /* - * NOTE: at least one device will not work properly unless - * the BULK pipe is open all the time. + * NOTE: At least one device will not work properly unless the + * BULK IN pipe is open all the time. This might have to do + * about that the internal queues of the device overflow if we + * don't read them regularly. */ - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); --Boundary-00=_AYPXNgVCRizMd8n-- From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 12:22:37 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3361065670 for ; Thu, 17 Feb 2011 12:22:37 +0000 (UTC) (envelope-from marcelbonnet@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 965908FC15 for ; Thu, 17 Feb 2011 12:22:37 +0000 (UTC) Received: by qwj9 with SMTP id 9so2293720qwj.13 for ; Thu, 17 Feb 2011 04:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=Asi9TTTys3xsdwvku9vSW7yxZcV1EL7d5kTRHEo8pXY=; b=qeND1nqRzKFAIkHWyaLbH5m9OMWuzD+BtRRizjhHxCTMIsO33pk/HylNSUm3aP+dzC ProzH5u56KTrECjJ/RQVo7GNIMaMzhucYv1TXcH/AFu2Lu8ZnacL43Ads9wZg0mbrjk4 Kf2ZhzfB1MYzqiTTFGDXdVN1VdSJTo508pqpc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=UETpHZP5KEjX0JGsMh0CFzVipWK89dDH3j1hXFYw92PSnJpr12YxINcUCrBV3JRCGb 2HELWiAK5GQWTsj2mSY8nO9qA3cCS10wTnAvGTHOoLXZOOEJ6oqFhyq5vyht9uPo9qwS OsnaCTG9QKJ5VV/nwBOgr/yJoMuARTveMfiHs= MIME-Version: 1.0 Received: by 10.229.226.193 with SMTP id ix1mr2163243qcb.283.1297943942088; Thu, 17 Feb 2011 03:59:02 -0800 (PST) Received: by 10.229.63.204 with HTTP; Thu, 17 Feb 2011 03:59:02 -0800 (PST) Date: Thu, 17 Feb 2011 09:59:02 -0200 Message-ID: From: Marcel Bonnet To: freebsd-multimedia@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: snd_envy24 recording support status X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 12:22:37 -0000 Hi. I was taking a look at wiki.freebsd.org/Sound and Konstantin Dimitrov's email to this list in the past years ( http://lists.freebsd.org/pipermail/freebsd-multimedia/2007-January/005721.html) about the development of the snd_envy24 driver. Does anybody (or Konstantin himself, if possible) knows if snd_envy24 now supports the analog recording for the M AUDIO Audiophile 2496, as it is listed as a supported hardware in the FreeBSD's Hardware Notes? -- Marcel Bonnet From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 18:22:15 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E0D5106566C for ; Thu, 17 Feb 2011 18:22:15 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id C33DE8FC13 for ; Thu, 17 Feb 2011 18:22:14 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=LfWZgthhXpRoR/5kSLoV97TeOFxNHdDd5OkOatCv3DI= c=1 sm=1 a=nrtpgiN_JOIA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=f8wu6lLQTL6PvfZws68A:9 a=Fhb8b6EYl3JXdSeqKU4A:7 a=We8qWVr7E_-w_J-LIkGSJbw91eIA:4 a=PUjeQqilurYA:10 a=FMRtb0CO9QA4LcEd8q0A:9 a=39y22y5K3W2tKp2TfegA:7 a=CYnOm1y2b5pTuM6PV5QP6QncxtwA:4 a=NWP0g5Kcjthmoquo:21 a=JxhUnRD_1vdESG3L:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 88713412 for freebsd-multimedia@freebsd.org; Thu, 17 Feb 2011 19:22:12 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Thu, 17 Feb 2011 19:00:39 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <201102171118.40721.hselasky@c2i.net> In-Reply-To: <201102171118.40721.hselasky@c2i.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_HJWXN7NIxEvKAlB" Message-Id: <201102171900.39165.hselasky@c2i.net> Subject: Re: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 18:22:15 -0000 --Boundary-00=_HJWXN7NIxEvKAlB Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit On Thursday 17 February 2011 11:18:40 Hans Petter Selasky wrote: > Dear all USB MIDI freaks using FreeBSD 8+! > > After some more testing I'm going to push a patch for the USB AUDIO driver > that improves USB MIDI on FreeBSD. I'm sending the patch out for review so > that users get a chance to try out the changes before they get committed. > The patch should apply to 8.2-RELEASE aswell as 9-CURRENT. > > How to apply: > > cd /usr/src/sys/dev/sound/usb/ > cat umidi_patch_001.txt | patch > > A short summary of what the changes are about: > > - Make the USB MIDI driver more OSS compliant by implementing the > correct data format for the /dev/umidiX.Y character devices. Also > implement some missing OSS MIDI ioctls. > - Use the USB stack's builtin clear-stall feature. > - Wrap some long lines. > - Use memcpy() instead of bcopy(). - Use memset() instead of bzero(). > > --HPS Found some bugs in my initial patch after testing. Attaching new one. --HPS --Boundary-00=_HJWXN7NIxEvKAlB Content-Type: text/plain; charset="iso-8859-15"; name="umidi_patch_002.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="umidi_patch_002.txt" === uaudio.c ================================================================== --- uaudio.c (revision 218769) +++ uaudio.c (local) @@ -191,10 +191,15 @@ uint8_t iface_alt_index; }; -#define UMIDI_N_TRANSFER 4 /* units */ #define UMIDI_CABLES_MAX 16 /* units */ #define UMIDI_BULK_SIZE 1024 /* bytes */ +enum { + UMIDI_TX_TRANSFER, + UMIDI_RX_TRANSFER, + UMIDI_N_TRANSFER, +}; + struct umidi_sub_chan { struct usb_fifo_sc fifo; uint8_t *temp_cmd; @@ -224,10 +229,6 @@ uint8_t iface_index; uint8_t iface_alt_index; - uint8_t flags; -#define UMIDI_FLAG_READ_STALL 0x01 -#define UMIDI_FLAG_WRITE_STALL 0x02 - uint8_t read_open_refcount; uint8_t write_open_refcount; @@ -336,9 +337,7 @@ static usb_callback_t uaudio_chan_play_callback; static usb_callback_t uaudio_chan_record_callback; static usb_callback_t uaudio_mixer_write_cfg_callback; -static usb_callback_t umidi_read_clear_stall_callback; static usb_callback_t umidi_bulk_read_callback; -static usb_callback_t umidi_write_clear_stall_callback; static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, @@ -493,7 +492,7 @@ static const struct usb_config umidi_config[UMIDI_N_TRANSFER] = { - [0] = { + [UMIDI_TX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -502,7 +501,7 @@ .callback = &umidi_bulk_write_callback, }, - [1] = { + [UMIDI_RX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -510,26 +509,6 @@ .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, .callback = &umidi_bulk_read_callback, }, - - [2] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_write_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, - - [3] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_read_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, }; static devclass_t uaudio_devclass; @@ -1577,10 +1556,10 @@ uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc) { struct uaudio_mixer_node *p_mc_new = - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); - if (p_mc_new) { - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); + if (p_mc_new != NULL) { + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); p_mc_new->next = sc->sc_mixer_root; sc->sc_mixer_root = p_mc_new; sc->sc_mixer_count++; @@ -1722,7 +1701,7 @@ DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); uaudio_mixer_determine_class(&iot[id], &mix); @@ -1782,7 +1761,7 @@ if (d->bNrInPins == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); mix.wValue[0] = MAKE_WORD(0, 0); @@ -1852,7 +1831,7 @@ if (d->bControlSize == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); nchan = (d->bLength - 7) / d->bControlSize; mmask = uaudio_mixer_feature_get_bmaControls(d, 0); @@ -1986,7 +1965,7 @@ DPRINTF("no mode select\n"); return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2012,7 +1991,7 @@ struct uaudio_mixer_node mix; uint16_t ptype; - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); ptype = UGETW(d0->wProcessType); @@ -2067,7 +2046,7 @@ } if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2294,7 +2273,7 @@ } error: DPRINTF("bad data\n"); - bzero(&r, sizeof(r)); + memset(&r, 0, sizeof(r)); done: return (r); } @@ -3284,25 +3263,12 @@ *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[1]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - } -} - -static void umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct umidi_chan *chan = usbd_xfer_softc(xfer); struct umidi_sub_chan *sub; struct usb_page_cache *pc; - uint8_t buf[1]; + uint8_t buf[5]; uint8_t cmd_len; uint8_t cn; uint16_t pos; @@ -3320,60 +3286,66 @@ while (actlen >= 4) { - usbd_copy_out(pc, pos, buf, 1); - - cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */ - cn = buf[0] >> 4; /* cable number */ + /* copy out the MIDI data */ + usbd_copy_out(pc, pos, buf, 4); + /* command length */ + cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; + /* cable number */ + cn = buf[0] >> 4; + /* + * Lookup sub-channel. The index is range + * checked below. + */ sub = &chan->sub[cn]; - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, - pos + 1, cmd_len, 1); - } else { - /* ignore the command */ - } + if ((cmd_len != 0) && + (cn < chan->max_cable) && + (sub->read_open != 0)) { + /* re-pack into a 4-byte array */ + /* zero unused bytes */ + if (cmd_len == 1) { + buf[2] = 0; + buf[3] = 0; + buf[4] = 0; + } else if (cmd_len == 2) { + buf[3] = 0; + buf[4] = 0; + } else { + buf[4] = 0; + } + + /* + * Send data in 4-byte chunks to the + * application: + */ + usb_fifo_put_data_linear( + sub->fifo.fp[USB_FIFO_RX], + buf + 1, 4, 1); + } actlen -= 4; pos += 4; } case USB_ST_SETUP: DPRINTF("start\n"); - - if (chan->flags & UMIDI_FLAG_READ_STALL) { - usbd_transfer_start(chan->xfer[3]); - return; - } +tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - return; + break; default: DPRINTF("error=%s\n", usbd_errstr(error)); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; - usbd_transfer_start(chan->xfer[3]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } -static void -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[0]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - } -} - /* * The following statemachine, that converts MIDI commands to * USB MIDI packets, derives from Linux's usbmidi.c, which @@ -3502,6 +3474,8 @@ sub->temp_cmd = sub->temp_1; sub->state = UMIDI_ST_SYSEX_0; return (1); + default: + break; } } return (0); @@ -3527,13 +3501,9 @@ DPRINTF("actlen=%d bytes\n", len); case USB_ST_SETUP: - +tr_setup: DPRINTF("start\n"); - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { - usbd_transfer_start(chan->xfer[2]); - return; - } total_length = 0; /* reset */ start_cable = chan->curr_cable; tr_any = 0; @@ -3593,7 +3563,7 @@ usbd_xfer_set_frame_len(xfer, 0, total_length); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ @@ -3601,11 +3571,10 @@ if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(chan->xfer[2]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } @@ -3635,7 +3604,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); } static void @@ -3662,7 +3631,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); } static void @@ -3677,8 +3646,7 @@ if (--(chan->write_open_refcount) == 0) { DPRINTF("(stopping write transfer)\n"); - usbd_transfer_stop(chan->xfer[2]); - usbd_transfer_stop(chan->xfer[0]); + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); } } @@ -3703,7 +3671,7 @@ } /* clear stall first */ mtx_lock(&chan->mtx); - chan->flags |= UMIDI_FLAG_WRITE_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); chan->write_open_refcount++; sub->write_open = 1; @@ -3769,7 +3737,8 @@ DPRINTF("setting of alternate index failed!\n"); goto detach; } - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, chan->iface_index, + sc->sc_mixer_iface_index); error = usbd_transfer_setup(uaa->device, &chan->iface_index, chan->xfer, umidi_config, UMIDI_N_TRANSFER, @@ -3799,13 +3768,15 @@ mtx_lock(&chan->mtx); /* clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); /* - * NOTE: at least one device will not work properly unless - * the BULK pipe is open all the time. + * NOTE: At least one device will not work properly unless the + * BULK IN pipe is open all the time. This might have to do + * about that the internal queues of the device overflow if we + * don't read them regularly. */ - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); @@ -3828,8 +3799,7 @@ mtx_lock(&chan->mtx); - usbd_transfer_stop(chan->xfer[3]); - usbd_transfer_stop(chan->xfer[1]); + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); --Boundary-00=_HJWXN7NIxEvKAlB-- From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 18:39:34 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 291DA1065705 for ; Thu, 17 Feb 2011 18:39:34 +0000 (UTC) (envelope-from shoesoft@gmx.net) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mx1.freebsd.org (Postfix) with SMTP id 7030C8FC17 for ; Thu, 17 Feb 2011 18:39:33 +0000 (UTC) Received: (qmail invoked by alias); 17 Feb 2011 18:12:51 -0000 Received: from 85-127-251-167.dynamic.xdsl-line.inode.at (EHLO walrus.pepperland) [85.127.251.167] by mail.gmx.net (mp063) with SMTP; 17 Feb 2011 19:12:51 +0100 X-Authenticated: #16703784 X-Provags-ID: V01U2FsdGVkX19pnmAanl1p0t9GACKyF5X7JFZGRKfL+xNyMqJLVj 7a7RnZXXfBLpa0 From: Stefan Ehmann To: freebsd-multimedia@freebsd.org Date: Thu, 17 Feb 2011 19:12:49 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-RELEASE; KDE/4.5.5; i386; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102171912.49915.shoesoft@gmx.net> X-Y-GMX-Trusted: 0 Cc: Subject: Re: snd_envy24 recording support status X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 18:39:34 -0000 On Thursday, February 17, 2011 12:59:02 pm Marcel Bonnet wrote: > Hi. I was taking a look at wiki.freebsd.org/Sound and Konstantin Dimitrov's > email to this list in the past years ( > http://lists.freebsd.org/pipermail/freebsd-multimedia/2007-January/005721.h > tml) about the development of the snd_envy24 driver. > Does anybody (or Konstantin himself, if possible) knows if snd_envy24 now > supports the analog recording for the M AUDIO Audiophile 2496, as it is > listed as a supported hardware in the FreeBSD's Hardware Notes? Currently, it doesn't work. At least I only get noise when I try to record anything. I haven't checked how much work it would take, since recording is not important for me. At least, there seems to be some existing recording infrastructure in envy24.c. From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 21:30:41 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A900B106564A for ; Thu, 17 Feb 2011 21:30:41 +0000 (UTC) (envelope-from rmgls@free.fr) Received: from smtpfb1-g21.free.fr (smtpfb1-g21.free.fr [212.27.42.9]) by mx1.freebsd.org (Postfix) with ESMTP id CDA8B8FC16 for ; Thu, 17 Feb 2011 21:30:38 +0000 (UTC) Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id 438C72DAA4 for ; Thu, 17 Feb 2011 22:12:20 +0100 (CET) Received: from free.fr (unknown [88.172.40.194]) by smtp3-g21.free.fr (Postfix) with ESMTP id F1DC8A6284 for ; Thu, 17 Feb 2011 22:12:13 +0100 (CET) From: Raoul Mégélas To: freebsd-multimedia@freebsd.org Date: Thu, 17 Feb 2011 22:12:16 +0100 Sender: rmgls@free.fr Message-Id: <20110217211213.F1DC8A6284@smtp3-g21.free.fr> Subject: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 21:30:41 -0000 on Thu, 17 Feb 2011 11:18:40 +0100 Hans Petter Selasky wrote: ... > cd /usr/src/sys/dev/sound/usb/ > cat umidi_patch_001.txt | patch > > A short summary of what the changes are about: > > - Make the USB MIDI driver more OSS compliant by implementing the > correct data format for the /dev/umidiX.Y character devices. Also > implement some missing OSS MIDI ioctls. > - Use the USB stack's builtin clear-stall feature. > - Wrap some long lines. > - Use memcpy() instead of bcopy(). > > --HPS > > Some demo tunes: > > fluidsynth + zynaddsubfx + audacity + midipp: > > http://www.selasky.org/hans_petter/synth_test_new.mp3 > > zynaddsubfx + midipp: > > http://www.selasky.org/hans_petter/synth_test.mp3 > > --HPS > > --Boundary-00=_AYPXNgVCRizMd8n > Content-Type: text/plain; > charset="us-ascii"; > name="umidi_patch_001.txt" > Content-Transfer-Encoding: 7bit > Content-Disposition: inline; > filename="umidi_patch_001.txt" > > === uaudio.c > ================================================================== > --- uaudio.c (revision 218769) > +++ uaudio.c (local) > @@ -191,10 +191,15 @@ > uint8_t iface_alt_index; > }; > > -#define UMIDI_N_TRANSFER 4 /* units */ > #define UMIDI_CABLES_MAX 16 /* units */ > #define UMIDI_BULK_SIZE 1024 /* bytes */ > > +enum { > + UMIDI_TX_TRANSFER, > + UMIDI_RX_TRANSFER, > + UMIDI_N_TRANSFER, > +}; > + > struct umidi_sub_chan { > struct usb_fifo_sc fifo; > uint8_t *temp_cmd; > @@ -224,10 +229,6 @@ > uint8_t iface_index; > uint8_t iface_alt_index; > > - uint8_t flags; > -#define UMIDI_FLAG_READ_STALL 0x01 > -#define UMIDI_FLAG_WRITE_STALL 0x02 > - > uint8_t read_open_refcount; > uint8_t write_open_refcount; > > @@ -336,9 +337,7 @@ > static usb_callback_t uaudio_chan_play_callback; > static usb_callback_t uaudio_chan_record_callback; > static usb_callback_t uaudio_mixer_write_cfg_callback; > -static usb_callback_t umidi_read_clear_stall_callback; > static usb_callback_t umidi_bulk_read_callback; > -static usb_callback_t umidi_write_clear_stall_callback; > static usb_callback_t umidi_bulk_write_callback; > > static void uaudio_chan_fill_info_sub(struct uaudio_softc *, > @@ -493,7 +492,7 @@ > > static const struct usb_config > umidi_config[UMIDI_N_TRANSFER] = { > - [0] = { > + [UMIDI_TX_TRANSFER] = { > .type = UE_BULK, > .endpoint = UE_ADDR_ANY, > .direction = UE_DIR_OUT, > @@ -502,7 +501,7 @@ > .callback = &umidi_bulk_write_callback, > }, > > - [1] = { > + [UMIDI_RX_TRANSFER] = { > .type = UE_BULK, > .endpoint = UE_ADDR_ANY, > .direction = UE_DIR_IN, > @@ -510,26 +509,6 @@ > .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, > .callback = &umidi_bulk_read_callback, > }, > - > - [2] = { > - .type = UE_CONTROL, > - .endpoint = 0x00, /* Control pipe */ > - .direction = UE_DIR_ANY, > - .bufsize = sizeof(struct usb_device_request), > - .callback = &umidi_write_clear_stall_callback, > - .timeout = 1000, /* 1 second */ > - .interval = 50, /* 50ms */ > - }, > - > - [3] = { > - .type = UE_CONTROL, > - .endpoint = 0x00, /* Control pipe */ > - .direction = UE_DIR_ANY, > - .bufsize = sizeof(struct usb_device_request), > - .callback = &umidi_read_clear_stall_callback, > - .timeout = 1000, /* 1 second */ > - .interval = 50, /* 50ms */ > - }, > }; > > static devclass_t uaudio_devclass; > @@ -1577,10 +1556,10 @@ > uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc) > { > struct uaudio_mixer_node *p_mc_new = > - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); > + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); > > - if (p_mc_new) { > - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); > + if (p_mc_new != NULL) { > + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); > p_mc_new->next = sc->sc_mixer_root; > sc->sc_mixer_root = p_mc_new; > sc->sc_mixer_count++; > @@ -1722,7 +1701,7 @@ > > DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); > > - bzero(&mix, sizeof(mix)); > + memset(&mix, 0, sizeof(mix)); > > mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > uaudio_mixer_determine_class(&iot[id], &mix); > @@ -1782,7 +1761,7 @@ > if (d->bNrInPins == 0) { > return; > } > - bzero(&mix, sizeof(mix)); > + memset(&mix, 0, sizeof(mix)); > > mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); > mix.wValue[0] = MAKE_WORD(0, 0); > @@ -1852,7 +1831,7 @@ > if (d->bControlSize == 0) { > return; > } > - bzero(&mix, sizeof(mix)); > + memset(&mix, 0, sizeof(mix)); > > nchan = (d->bLength - 7) / d->bControlSize; > mmask = uaudio_mixer_feature_get_bmaControls(d, 0); > @@ -1986,7 +1965,7 @@ > DPRINTF("no mode select\n"); > return; > } > - bzero(&mix, sizeof(mix)); > + memset(&mix, 0, sizeof(mix)); > > mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > mix.nchan = 1; > @@ -2012,7 +1991,7 @@ > struct uaudio_mixer_node mix; > uint16_t ptype; > > - bzero(&mix, sizeof(mix)); > + memset(&mix, 0, sizeof(mix)); > > ptype = UGETW(d0->wProcessType); > > @@ -2067,7 +2046,7 @@ > } > if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { > > - bzero(&mix, sizeof(mix)); > + memset(&mix, 0, sizeof(mix)); > > mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > mix.nchan = 1; > @@ -2294,7 +2273,7 @@ > } > error: > DPRINTF("bad data\n"); > - bzero(&r, sizeof(r)); > + memset(&r, 0, sizeof(r)); > done: > return (r); > } > @@ -3284,25 +3263,12 @@ > *========================================================================*/ > > static void > -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) > -{ > - struct umidi_chan *chan = usbd_xfer_softc(xfer); > - struct usb_xfer *xfer_other = chan->xfer[1]; > - > - if (usbd_clear_stall_callback(xfer, xfer_other)) { > - DPRINTF("stall cleared\n"); > - chan->flags &= ~UMIDI_FLAG_READ_STALL; > - usbd_transfer_start(xfer_other); > - } > -} > - > -static void > umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) > { > struct umidi_chan *chan = usbd_xfer_softc(xfer); > struct umidi_sub_chan *sub; > struct usb_page_cache *pc; > - uint8_t buf[1]; > + uint8_t buf[5]; > uint8_t cmd_len; > uint8_t cn; > uint16_t pos; > @@ -3320,60 +3286,66 @@ > > while (actlen >= 4) { > > - usbd_copy_out(pc, pos, buf, 1); > - > - cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */ > - cn = buf[0] >> 4; /* cable number */ > + /* copy out the MIDI data */ > + usbd_copy_out(pc, pos, buf, 4); > + /* command length */ > + cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; > + /* cable number */ > + cn = buf[0] >> 4; > + /* > + * Lookup sub-channel. The index is range > + * checked below. > + */ > sub = &chan->sub[cn]; > > - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { > - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, > - pos + 1, cmd_len, 1); > - } else { > - /* ignore the command */ > - } > + if ((cmd_len != 0) && > + (cn < chan->max_cable) && > + (sub->read_open != 0)) { > > + /* re-pack into a 4-byte array */ > + /* zero unused bytes */ > + if (cmd_len == 1) { > + buf[2] = 0; > + buf[3] = 0; > + buf[4] = 0; > + } else if (cmd_len == 2) { > + buf[3] = 0; > + buf[4] = 0; > + } else { > + buf[4] = 0; > + } > + > + /* > + * Send data in 4-byte chunks to the > + * application: > + */ > + usb_fifo_put_data_linear( > + sub->fifo.fp[USB_FIFO_RX], > + buf + 1, 4, 1); > + } > actlen -= 4; > pos += 4; > } > > case USB_ST_SETUP: > DPRINTF("start\n"); > - > - if (chan->flags & UMIDI_FLAG_READ_STALL) { > - usbd_transfer_start(chan->xfer[3]); > - return; > - } > +tr_setup: > usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); > usbd_transfer_submit(xfer); > - return; > + break; > > default: > DPRINTF("error=%s\n", usbd_errstr(error)); > > if (error != USB_ERR_CANCELLED) { > /* try to clear stall first */ > - chan->flags |= UMIDI_FLAG_READ_STALL; > - usbd_transfer_start(chan->xfer[3]); > + usbd_xfer_set_stall(xfer); > + goto tr_setup; > } > - return; > - > + break; > } > } > > -static void > -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) > -{ > - struct umidi_chan *chan = usbd_xfer_softc(xfer); > - struct usb_xfer *xfer_other = chan->xfer[0]; > - > - if (usbd_clear_stall_callback(xfer, xfer_other)) { > - DPRINTF("stall cleared\n"); > - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; > - usbd_transfer_start(xfer_other); > - } > -} > - > /* > * The following statemachine, that converts MIDI commands to > * USB MIDI packets, derives from Linux's usbmidi.c, which > @@ -3502,6 +3474,8 @@ > sub->temp_cmd = sub->temp_1; > sub->state = UMIDI_ST_SYSEX_0; > return (1); > + default: > + break; > } > } > return (0); > @@ -3527,13 +3501,9 @@ > DPRINTF("actlen=%d bytes\n", len); > > case USB_ST_SETUP: > - > +tr_setup: > DPRINTF("start\n"); > > - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { > - usbd_transfer_start(chan->xfer[2]); > - return; > - } > total_length = 0; /* reset */ > start_cable = chan->curr_cable; > tr_any = 0; > @@ -3593,7 +3563,7 @@ > usbd_xfer_set_frame_len(xfer, 0, total_length); > usbd_transfer_submit(xfer); > } > - return; > + break; > > default: /* Error */ > > @@ -3601,11 +3571,10 @@ > > if (error != USB_ERR_CANCELLED) { > /* try to clear stall first */ > - chan->flags |= UMIDI_FLAG_WRITE_STALL; > - usbd_transfer_start(chan->xfer[2]); > + usbd_xfer_set_stall(xfer); > + goto tr_setup; > } > - return; > - > + break; > } > } > > @@ -3635,7 +3604,7 @@ > { > struct umidi_chan *chan = usb_fifo_softc(fifo); > > - usbd_transfer_start(chan->xfer[1]); > + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); > } > > static void > @@ -3662,7 +3631,7 @@ > { > struct umidi_chan *chan = usb_fifo_softc(fifo); > > - usbd_transfer_start(chan->xfer[0]); > + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); > } > > static void > @@ -3677,8 +3646,7 @@ > > if (--(chan->write_open_refcount) == 0) { > DPRINTF("(stopping write transfer)\n"); > - usbd_transfer_stop(chan->xfer[2]); > - usbd_transfer_stop(chan->xfer[0]); > + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); > } > } > > @@ -3703,7 +3671,7 @@ > } > /* clear stall first */ > mtx_lock(&chan->mtx); > - chan->flags |= UMIDI_FLAG_WRITE_STALL; > + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); > chan->write_open_refcount++; > sub->write_open = 1; > > @@ -3769,7 +3737,8 @@ > DPRINTF("setting of alternate index failed!\n"); > goto detach; > } > - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index); > + usbd_set_parent_iface(sc->sc_udev, chan->iface_index, > + sc->sc_mixer_iface_index); > > error = usbd_transfer_setup(uaa->device, &chan->iface_index, > chan->xfer, umidi_config, UMIDI_N_TRANSFER, > @@ -3799,13 +3768,15 @@ > mtx_lock(&chan->mtx); > > /* clear stall first */ > - chan->flags |= UMIDI_FLAG_READ_STALL; > + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); > > /* > - * NOTE: at least one device will not work properly unless > - * the BULK pipe is open all the time. > + * NOTE: At least one device will not work properly unless the > + * BULK IN pipe is open all the time. This might have to do > + * about that the internal queues of the device overflow if we > + * don't read them regularly. > */ > - usbd_transfer_start(chan->xfer[1]); > + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); > > mtx_unlock(&chan->mtx); > > @@ -3828,8 +3799,7 @@ > > mtx_lock(&chan->mtx); > > - usbd_transfer_stop(chan->xfer[3]); > - usbd_transfer_stop(chan->xfer[1]); > + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); > > mtx_unlock(&chan->mtx); Hi Hans Peter, On my laptop The first patch coredump, but not the second. without the patch, my little soft runs fine, i.e. using the mutexes part of code from ssynth. With the second patch: in the same conditions of testing, all notes stick, and make some jam. It seems that the performances are degraded here. what i do is simple: the master keyboard sends the notes, the soft does some transformations and resends the notes to the two modules. Do you need something else? feel free to ask, of course. Best Regards Raoul rmgls@free.fr From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 21:54:50 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC419106566B for ; Thu, 17 Feb 2011 21:54:50 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id D7F528FC08 for ; Thu, 17 Feb 2011 21:54:49 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=118a5bn0tGnRZbUa9ClBty6BTuM1bA5mUZqmf2RHYp4= c=1 sm=1 a=nrtpgiN_JOIA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=8kQB0OdkAAAA:8 a=ndaoGXS1AAAA:8 a=QwOGWP9MhimP6-45idwA:9 a=85-kelz5BWVnloe1SMsA:7 a=Au20LFnGj7U_T3nQ-u_TmstiFckA:4 a=QEXdDO2ut3YA:10 a=9aOQ2cSd83gA:10 a=3EsQE-4JTRtL-bxW:21 a=IvYDzcm4hIWiTQap:21 a=qY83MnDu8rvUkoB5eoAA:9 a=f50Q6O1aLvoz7ecdVNsA:7 a=Ocmj9r0inir9N870EDng5_2A2XIA:4 a=PUjeQqilurYA:10 a=MlrXV98htw5H6N_O:21 a=TgECxQEwtohr3gle:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89528882; Thu, 17 Feb 2011 22:54:47 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Thu, 17 Feb 2011 22:54:35 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <20110217211213.F1DC8A6284@smtp3-g21.free.fr> In-Reply-To: <20110217211213.F1DC8A6284@smtp3-g21.free.fr> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?utf-8?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?utf-8?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_bkZXNBbphpH84ED" Message-Id: <201102172254.35501.hselasky@c2i.net> Cc: Subject: Re: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 21:54:50 -0000 --Boundary-00=_bkZXNBbphpH84ED Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thursday 17 February 2011 22:12:16 Raoul M=EF=BF=BDg=EF=BF=BDlas wrote: > on Thu, 17 Feb 2011 11:18:40 +0100 > Hans Petter Selasky wrote: >=20 > ... >=20 > > cd /usr/src/sys/dev/sound/usb/ > > cat umidi_patch_001.txt | patch > >=20 > > A short summary of what the changes are about: > >=20 > > - Make the USB MIDI driver more OSS compliant by implementing the > > correct data format for the /dev/umidiX.Y character devices. Also > > implement some missing OSS MIDI ioctls. > > - Use the USB stack's builtin clear-stall feature. > > - Wrap some long lines. > > - Use memcpy() instead of bcopy(). > >=20 > > --HPS > >=20 > > Some demo tunes: > >=20 > > fluidsynth + zynaddsubfx + audacity + midipp: > >=20 > > http://www.selasky.org/hans_petter/synth_test_new.mp3 > >=20 > > zynaddsubfx + midipp: > >=20 > > http://www.selasky.org/hans_petter/synth_test.mp3 > >=20 > > --HPS > >=20 > > --Boundary-00=3D_AYPXNgVCRizMd8n > > Content-Type: text/plain; > >=20 > > charset=3D"us-ascii"; > > name=3D"umidi_patch_001.txt" > >=20 > > Content-Transfer-Encoding: 7bit > > Content-Disposition: inline; > >=20 > > filename=3D"umidi_patch_001.txt" > >=20 > > =3D=3D=3D uaudio.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- uaudio.c (revision 218769) > > +++ uaudio.c (local) > > @@ -191,10 +191,15 @@ > >=20 > > uint8_t iface_alt_index; > > =20 > > }; > >=20 > > -#define UMIDI_N_TRANSFER 4 /* units */ > >=20 > > #define UMIDI_CABLES_MAX 16 /* units */ > > #define UMIDI_BULK_SIZE 1024 /* bytes */ > >=20 > > +enum { > > + UMIDI_TX_TRANSFER, > > + UMIDI_RX_TRANSFER, > > + UMIDI_N_TRANSFER, > > +}; > > + > >=20 > > struct umidi_sub_chan { > > =20 > > struct usb_fifo_sc fifo; > > uint8_t *temp_cmd; > >=20 > > @@ -224,10 +229,6 @@ > >=20 > > uint8_t iface_index; > > uint8_t iface_alt_index; > >=20 > > - uint8_t flags; > > -#define UMIDI_FLAG_READ_STALL 0x01 > > -#define UMIDI_FLAG_WRITE_STALL 0x02 > > - > >=20 > > uint8_t read_open_refcount; > > uint8_t write_open_refcount; > >=20 > > @@ -336,9 +337,7 @@ > >=20 > > static usb_callback_t uaudio_chan_play_callback; > > static usb_callback_t uaudio_chan_record_callback; > > static usb_callback_t uaudio_mixer_write_cfg_callback; > >=20 > > -static usb_callback_t umidi_read_clear_stall_callback; > >=20 > > static usb_callback_t umidi_bulk_read_callback; > >=20 > > -static usb_callback_t umidi_write_clear_stall_callback; > >=20 > > static usb_callback_t umidi_bulk_write_callback; > > =20 > > static void uaudio_chan_fill_info_sub(struct uaudio_softc *, > >=20 > > @@ -493,7 +492,7 @@ > >=20 > > static const struct usb_config > > =20 > > umidi_config[UMIDI_N_TRANSFER] =3D { > >=20 > > - [0] =3D { > > + [UMIDI_TX_TRANSFER] =3D { > >=20 > > .type =3D UE_BULK, > > .endpoint =3D UE_ADDR_ANY, > > .direction =3D UE_DIR_OUT, > >=20 > > @@ -502,7 +501,7 @@ > >=20 > > .callback =3D &umidi_bulk_write_callback, > > =09 > > }, > >=20 > > - [1] =3D { > > + [UMIDI_RX_TRANSFER] =3D { > >=20 > > .type =3D UE_BULK, > > .endpoint =3D UE_ADDR_ANY, > > .direction =3D UE_DIR_IN, > >=20 > > @@ -510,26 +509,6 @@ > >=20 > > .flags =3D {.pipe_bof =3D 1,.short_xfer_ok =3D 1,.proxy_buffer =3D 1= ,}, > > .callback =3D &umidi_bulk_read_callback, > > =09 > > }, > >=20 > > - > > - [2] =3D { > > - .type =3D UE_CONTROL, > > - .endpoint =3D 0x00, /* Control pipe */ > > - .direction =3D UE_DIR_ANY, > > - .bufsize =3D sizeof(struct usb_device_request), > > - .callback =3D &umidi_write_clear_stall_callback, > > - .timeout =3D 1000, /* 1 second */ > > - .interval =3D 50, /* 50ms */ > > - }, > > - > > - [3] =3D { > > - .type =3D UE_CONTROL, > > - .endpoint =3D 0x00, /* Control pipe */ > > - .direction =3D UE_DIR_ANY, > > - .bufsize =3D sizeof(struct usb_device_request), > > - .callback =3D &umidi_read_clear_stall_callback, > > - .timeout =3D 1000, /* 1 second */ > > - .interval =3D 50, /* 50ms */ > > - }, > >=20 > > }; > > =20 > > static devclass_t uaudio_devclass; > >=20 > > @@ -1577,10 +1556,10 @@ > >=20 > > uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct > > uaudio_mixer_node *mc) { > > =20 > > struct uaudio_mixer_node *p_mc_new =3D > >=20 > > - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); > > + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); > >=20 > > - if (p_mc_new) { > > - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); > > + if (p_mc_new !=3D NULL) { > > + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); > >=20 > > p_mc_new->next =3D sc->sc_mixer_root; > > sc->sc_mixer_root =3D p_mc_new; > > sc->sc_mixer_count++; > >=20 > > @@ -1722,7 +1701,7 @@ > >=20 > > DPRINTFN(3, "ichs=3D%d ochs=3D%d\n", ichs, ochs); > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > > uaudio_mixer_determine_class(&iot[id], &mix); > >=20 > > @@ -1782,7 +1761,7 @@ > >=20 > > if (d->bNrInPins =3D=3D 0) { > > =09 > > return; > > =09 > > } > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); > > mix.wValue[0] =3D MAKE_WORD(0, 0); > >=20 > > @@ -1852,7 +1831,7 @@ > >=20 > > if (d->bControlSize =3D=3D 0) { > > =09 > > return; > > =09 > > } > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > nchan =3D (d->bLength - 7) / d->bControlSize; > > mmask =3D uaudio_mixer_feature_get_bmaControls(d, 0); > >=20 > > @@ -1986,7 +1965,7 @@ > >=20 > > DPRINTF("no mode select\n"); > > return; > > =09 > > } > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > > mix.nchan =3D 1; > >=20 > > @@ -2012,7 +1991,7 @@ > >=20 > > struct uaudio_mixer_node mix; > > uint16_t ptype; > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > ptype =3D UGETW(d0->wProcessType); > >=20 > > @@ -2067,7 +2046,7 @@ > >=20 > > } > > if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > > mix.nchan =3D 1; > >=20 > > @@ -2294,7 +2273,7 @@ > >=20 > > } > > =20 > > error: > > DPRINTF("bad data\n"); > >=20 > > - bzero(&r, sizeof(r)); > > + memset(&r, 0, sizeof(r)); > >=20 > > done: > > return (r); > > =20 > > } > >=20 > > @@ -3284,25 +3263,12 @@ > >=20 > > *=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > =3D=3D*/ > > =20 > > static void > >=20 > > -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t > > error) -{ > > - struct umidi_chan *chan =3D usbd_xfer_softc(xfer); > > - struct usb_xfer *xfer_other =3D chan->xfer[1]; > > - > > - if (usbd_clear_stall_callback(xfer, xfer_other)) { > > - DPRINTF("stall cleared\n"); > > - chan->flags &=3D ~UMIDI_FLAG_READ_STALL; > > - usbd_transfer_start(xfer_other); > > - } > > -} > > - > > -static void > >=20 > > umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) > > { > > =20 > > struct umidi_chan *chan =3D usbd_xfer_softc(xfer); > > struct umidi_sub_chan *sub; > > struct usb_page_cache *pc; > >=20 > > - uint8_t buf[1]; > > + uint8_t buf[5]; > >=20 > > uint8_t cmd_len; > > uint8_t cn; > > uint16_t pos; > >=20 > > @@ -3320,60 +3286,66 @@ > >=20 > > while (actlen >=3D 4) { > >=20 > > - usbd_copy_out(pc, pos, buf, 1); > > - > > - cmd_len =3D umidi_cmd_to_len[buf[0] & 0xF]; /* command length=20 */ > > - cn =3D buf[0] >> 4; /* cable number */ > > + /* copy out the MIDI data */ > > + usbd_copy_out(pc, pos, buf, 4); > > + /* command length */ > > + cmd_len =3D umidi_cmd_to_len[buf[0] & 0xF]; > > + /* cable number */ > > + cn =3D buf[0] >> 4; > > + /* > > + * Lookup sub-channel. The index is range > > + * checked below. > > + */ > >=20 > > sub =3D &chan->sub[cn]; > >=20 > > - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { > > - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, > > - pos + 1, cmd_len, 1); > > - } else { > > - /* ignore the command */ > > - } > > + if ((cmd_len !=3D 0) && > > + (cn < chan->max_cable) && > > + (sub->read_open !=3D 0)) { > >=20 > > + /* re-pack into a 4-byte array */ > > + /* zero unused bytes */ > > + if (cmd_len =3D=3D 1) { > > + buf[2] =3D 0; > > + buf[3] =3D 0; > > + buf[4] =3D 0; > > + } else if (cmd_len =3D=3D 2) { > > + buf[3] =3D 0; > > + buf[4] =3D 0; > > + } else { > > + buf[4] =3D 0; > > + } > > + > > + /* > > + * Send data in 4-byte chunks to the > > + * application: > > + */ > > + usb_fifo_put_data_linear( > > + sub->fifo.fp[USB_FIFO_RX], > > + buf + 1, 4, 1); > > + } > >=20 > > actlen -=3D 4; > > pos +=3D 4; > > =09 > > } > > =09 > > case USB_ST_SETUP: > > DPRINTF("start\n"); > >=20 > > - > > - if (chan->flags & UMIDI_FLAG_READ_STALL) { > > - usbd_transfer_start(chan->xfer[3]); > > - return; > > - } > >=20 > > +tr_setup: > > usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); > > usbd_transfer_submit(xfer); > >=20 > > - return; > > + break; > >=20 > > default: > > DPRINTF("error=3D%s\n", usbd_errstr(error)); > > =09 > > if (error !=3D USB_ERR_CANCELLED) { > > =09 > > /* try to clear stall first */ > >=20 > > - chan->flags |=3D UMIDI_FLAG_READ_STALL; > > - usbd_transfer_start(chan->xfer[3]); > > + usbd_xfer_set_stall(xfer); > > + goto tr_setup; > >=20 > > } > >=20 > > - return; > > - > > + break; > >=20 > > } > > =20 > > } > >=20 > > -static void > > -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t > > error) -{ > > - struct umidi_chan *chan =3D usbd_xfer_softc(xfer); > > - struct usb_xfer *xfer_other =3D chan->xfer[0]; > > - > > - if (usbd_clear_stall_callback(xfer, xfer_other)) { > > - DPRINTF("stall cleared\n"); > > - chan->flags &=3D ~UMIDI_FLAG_WRITE_STALL; > > - usbd_transfer_start(xfer_other); > > - } > > -} > > - > >=20 > > /* > > =20 > > * The following statemachine, that converts MIDI commands to > > * USB MIDI packets, derives from Linux's usbmidi.c, which > >=20 > > @@ -3502,6 +3474,8 @@ > >=20 > > sub->temp_cmd =3D sub->temp_1; > > sub->state =3D UMIDI_ST_SYSEX_0; > > return (1); > >=20 > > + default: > > + break; > >=20 > > } > > =09 > > } > > return (0); > >=20 > > @@ -3527,13 +3501,9 @@ > >=20 > > DPRINTF("actlen=3D%d bytes\n", len); > > =09 > > case USB_ST_SETUP: > > - > >=20 > > +tr_setup: > > DPRINTF("start\n"); > >=20 > > - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { > > - usbd_transfer_start(chan->xfer[2]); > > - return; > > - } > >=20 > > total_length =3D 0; /* reset */ > > start_cable =3D chan->curr_cable; > > tr_any =3D 0; > >=20 > > @@ -3593,7 +3563,7 @@ > >=20 > > usbd_xfer_set_frame_len(xfer, 0, total_length); > > usbd_transfer_submit(xfer); > > =09 > > } > >=20 > > - return; > > + break; > >=20 > > default: /* Error */ > >=20 > > @@ -3601,11 +3571,10 @@ > >=20 > > if (error !=3D USB_ERR_CANCELLED) { > > =09 > > /* try to clear stall first */ > >=20 > > - chan->flags |=3D UMIDI_FLAG_WRITE_STALL; > > - usbd_transfer_start(chan->xfer[2]); > > + usbd_xfer_set_stall(xfer); > > + goto tr_setup; > >=20 > > } > >=20 > > - return; > > - > > + break; > >=20 > > } > > =20 > > } > >=20 > > @@ -3635,7 +3604,7 @@ > >=20 > > { > > =20 > > struct umidi_chan *chan =3D usb_fifo_softc(fifo); > >=20 > > - usbd_transfer_start(chan->xfer[1]); > > + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > } > > =20 > > static void > >=20 > > @@ -3662,7 +3631,7 @@ > >=20 > > { > > =20 > > struct umidi_chan *chan =3D usb_fifo_softc(fifo); > >=20 > > - usbd_transfer_start(chan->xfer[0]); > > + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); > >=20 > > } > > =20 > > static void > >=20 > > @@ -3677,8 +3646,7 @@ > >=20 > > if (--(chan->write_open_refcount) =3D=3D 0) { > > =09 > > DPRINTF("(stopping write transfer)\n"); > >=20 > > - usbd_transfer_stop(chan->xfer[2]); > > - usbd_transfer_stop(chan->xfer[0]); > > + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); > >=20 > > } > > =20 > > } > >=20 > > @@ -3703,7 +3671,7 @@ > >=20 > > } > > /* clear stall first */ > > mtx_lock(&chan->mtx); > >=20 > > - chan->flags |=3D UMIDI_FLAG_WRITE_STALL; > > + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); > >=20 > > chan->write_open_refcount++; > > sub->write_open =3D 1; > >=20 > > @@ -3769,7 +3737,8 @@ > >=20 > > DPRINTF("setting of alternate index failed!\n"); > > goto detach; > > =09 > > } > >=20 > > - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, > > sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, > > chan->iface_index, > > + sc->sc_mixer_iface_index); > >=20 > > error =3D usbd_transfer_setup(uaa->device, &chan->iface_index, > > =09 > > chan->xfer, umidi_config, UMIDI_N_TRANSFER, > >=20 > > @@ -3799,13 +3768,15 @@ > >=20 > > mtx_lock(&chan->mtx); > > =09 > > /* clear stall first */ > >=20 > > - chan->flags |=3D UMIDI_FLAG_READ_STALL; > > + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > /* > >=20 > > - * NOTE: at least one device will not work properly unless > > - * the BULK pipe is open all the time. > > + * NOTE: At least one device will not work properly unless the > > + * BULK IN pipe is open all the time. This might have to do > > + * about that the internal queues of the device overflow if we > > + * don't read them regularly. > >=20 > > */ > >=20 > > - usbd_transfer_start(chan->xfer[1]); > > + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > mtx_unlock(&chan->mtx); > >=20 > > @@ -3828,8 +3799,7 @@ > >=20 > > mtx_lock(&chan->mtx); > >=20 > > - usbd_transfer_stop(chan->xfer[3]); > > - usbd_transfer_stop(chan->xfer[1]); > > + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > mtx_unlock(&chan->mtx); >=20 > Hi Hans Peter, >=20 > On my laptop The first patch coredump, but not the second. > without the patch, my little soft runs fine, > i.e. using the mutexes part of code from ssynth. > With the second patch: > in the same conditions of testing, all notes stick, and make some jam. > It seems that the performances are degraded here. > what i do is simple: > the master keyboard sends the notes, the soft does some transformations a= nd > resends the notes to the two modules. >=20 > Do you need something else? > feel free to ask, of course. Could you try this third patch? =2D-HPS --Boundary-00=_bkZXNBbphpH84ED Content-Type: text/plain; charset="iso-8859-15"; name="umidi_patch_003.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="umidi_patch_003.txt" === uaudio.c ================================================================== --- uaudio.c (revision 218769) +++ uaudio.c (local) @@ -191,10 +191,15 @@ uint8_t iface_alt_index; }; -#define UMIDI_N_TRANSFER 4 /* units */ #define UMIDI_CABLES_MAX 16 /* units */ #define UMIDI_BULK_SIZE 1024 /* bytes */ +enum { + UMIDI_TX_TRANSFER, + UMIDI_RX_TRANSFER, + UMIDI_N_TRANSFER, +}; + struct umidi_sub_chan { struct usb_fifo_sc fifo; uint8_t *temp_cmd; @@ -224,10 +229,6 @@ uint8_t iface_index; uint8_t iface_alt_index; - uint8_t flags; -#define UMIDI_FLAG_READ_STALL 0x01 -#define UMIDI_FLAG_WRITE_STALL 0x02 - uint8_t read_open_refcount; uint8_t write_open_refcount; @@ -336,9 +337,7 @@ static usb_callback_t uaudio_chan_play_callback; static usb_callback_t uaudio_chan_record_callback; static usb_callback_t uaudio_mixer_write_cfg_callback; -static usb_callback_t umidi_read_clear_stall_callback; static usb_callback_t umidi_bulk_read_callback; -static usb_callback_t umidi_write_clear_stall_callback; static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, @@ -493,7 +492,7 @@ static const struct usb_config umidi_config[UMIDI_N_TRANSFER] = { - [0] = { + [UMIDI_TX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -502,7 +501,7 @@ .callback = &umidi_bulk_write_callback, }, - [1] = { + [UMIDI_RX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -510,26 +509,6 @@ .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, .callback = &umidi_bulk_read_callback, }, - - [2] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_write_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, - - [3] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_read_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, }; static devclass_t uaudio_devclass; @@ -1577,10 +1556,10 @@ uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc) { struct uaudio_mixer_node *p_mc_new = - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); - if (p_mc_new) { - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); + if (p_mc_new != NULL) { + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); p_mc_new->next = sc->sc_mixer_root; sc->sc_mixer_root = p_mc_new; sc->sc_mixer_count++; @@ -1722,7 +1701,7 @@ DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); uaudio_mixer_determine_class(&iot[id], &mix); @@ -1782,7 +1761,7 @@ if (d->bNrInPins == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); mix.wValue[0] = MAKE_WORD(0, 0); @@ -1852,7 +1831,7 @@ if (d->bControlSize == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); nchan = (d->bLength - 7) / d->bControlSize; mmask = uaudio_mixer_feature_get_bmaControls(d, 0); @@ -1986,7 +1965,7 @@ DPRINTF("no mode select\n"); return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2012,7 +1991,7 @@ struct uaudio_mixer_node mix; uint16_t ptype; - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); ptype = UGETW(d0->wProcessType); @@ -2067,7 +2046,7 @@ } if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2294,7 +2273,7 @@ } error: DPRINTF("bad data\n"); - bzero(&r, sizeof(r)); + memset(&r, 0, sizeof(r)); done: return (r); } @@ -3284,25 +3263,12 @@ *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[1]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - } -} - -static void umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct umidi_chan *chan = usbd_xfer_softc(xfer); struct umidi_sub_chan *sub; struct usb_page_cache *pc; - uint8_t buf[1]; + uint8_t buf[4]; uint8_t cmd_len; uint8_t cn; uint16_t pos; @@ -3320,60 +3286,50 @@ while (actlen >= 4) { - usbd_copy_out(pc, pos, buf, 1); - - cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */ - cn = buf[0] >> 4; /* cable number */ + /* copy out the MIDI data */ + usbd_copy_out(pc, pos, buf, 4); + /* command length */ + cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; + /* cable number */ + cn = buf[0] >> 4; + /* + * Lookup sub-channel. The index is range + * checked below. + */ sub = &chan->sub[cn]; - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, - pos + 1, cmd_len, 1); - } else { - /* ignore the command */ - } + if ((cmd_len != 0) && + (cn < chan->max_cable) && + (sub->read_open != 0)) { + /* Send data to the application */ + usb_fifo_put_data_linear( + sub->fifo.fp[USB_FIFO_RX], + buf + 1, cmd_len, 1); + } actlen -= 4; pos += 4; } case USB_ST_SETUP: DPRINTF("start\n"); - - if (chan->flags & UMIDI_FLAG_READ_STALL) { - usbd_transfer_start(chan->xfer[3]); - return; - } +tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - return; + break; default: DPRINTF("error=%s\n", usbd_errstr(error)); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; - usbd_transfer_start(chan->xfer[3]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } -static void -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[0]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - } -} - /* * The following statemachine, that converts MIDI commands to * USB MIDI packets, derives from Linux's usbmidi.c, which @@ -3502,6 +3458,8 @@ sub->temp_cmd = sub->temp_1; sub->state = UMIDI_ST_SYSEX_0; return (1); + default: + break; } } return (0); @@ -3527,13 +3485,9 @@ DPRINTF("actlen=%d bytes\n", len); case USB_ST_SETUP: - +tr_setup: DPRINTF("start\n"); - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { - usbd_transfer_start(chan->xfer[2]); - return; - } total_length = 0; /* reset */ start_cable = chan->curr_cable; tr_any = 0; @@ -3593,7 +3547,7 @@ usbd_xfer_set_frame_len(xfer, 0, total_length); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ @@ -3601,11 +3555,10 @@ if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(chan->xfer[2]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } @@ -3635,7 +3588,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); } static void @@ -3662,7 +3615,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); } static void @@ -3677,8 +3630,7 @@ if (--(chan->write_open_refcount) == 0) { DPRINTF("(stopping write transfer)\n"); - usbd_transfer_stop(chan->xfer[2]); - usbd_transfer_stop(chan->xfer[0]); + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); } } @@ -3703,7 +3655,7 @@ } /* clear stall first */ mtx_lock(&chan->mtx); - chan->flags |= UMIDI_FLAG_WRITE_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); chan->write_open_refcount++; sub->write_open = 1; @@ -3769,7 +3721,8 @@ DPRINTF("setting of alternate index failed!\n"); goto detach; } - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, chan->iface_index, + sc->sc_mixer_iface_index); error = usbd_transfer_setup(uaa->device, &chan->iface_index, chan->xfer, umidi_config, UMIDI_N_TRANSFER, @@ -3799,13 +3752,15 @@ mtx_lock(&chan->mtx); /* clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); /* - * NOTE: at least one device will not work properly unless - * the BULK pipe is open all the time. + * NOTE: At least one device will not work properly unless the + * BULK IN pipe is open all the time. This might have to do + * about that the internal queues of the device overflow if we + * don't read them regularly. */ - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); @@ -3828,8 +3783,7 @@ mtx_lock(&chan->mtx); - usbd_transfer_stop(chan->xfer[3]); - usbd_transfer_stop(chan->xfer[1]); + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); --Boundary-00=_bkZXNBbphpH84ED-- From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 22:49:12 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AFDD1065698 for ; Thu, 17 Feb 2011 22:49:12 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id 05C238FC1A for ; Thu, 17 Feb 2011 22:49:11 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=118a5bn0tGnRZbUa9ClBty6BTuM1bA5mUZqmf2RHYp4= c=1 sm=1 a=nrtpgiN_JOIA:10 a=IkcTkHD0fZMA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=bdxF9I95OMj02LIzxPsA:9 a=XGyJoPjdyjxBEl7F67anNeEzz3IA:4 a=QEXdDO2ut3YA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89542227; Thu, 17 Feb 2011 23:49:10 +0100 From: Hans Petter Selasky To: Raoul =?utf-8?q?M=EF=BF=BDg=EF=BF=BDlas?= Date: Thu, 17 Feb 2011 23:48:59 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <20110217223852.74638A622E@smtp3-g21.free.fr> In-Reply-To: <20110217223852.74638A622E@smtp3-g21.free.fr> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?utf-8?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?utf-8?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201102172348.59534.hselasky@c2i.net> Cc: freebsd-multimedia@freebsd.org Subject: Re: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 22:49:12 -0000 On Thursday 17 February 2011 23:38:55 Raoul M=EF=BF=BDg=EF=BF=BDlas wrote: > On Thu, 17 Feb 2011 22:54:35 +0100 Thanks for testing! =2D-HPS From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 17 22:55:37 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5BD2106567A for ; Thu, 17 Feb 2011 22:55:37 +0000 (UTC) (envelope-from root@free.fr) Received: from smtpfb1-g21.free.fr (smtpfb1-g21.free.fr [212.27.42.9]) by mx1.freebsd.org (Postfix) with ESMTP id EC5638FC21 for ; Thu, 17 Feb 2011 22:55:35 +0000 (UTC) Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id 8A70B77CFC1 for ; Thu, 17 Feb 2011 23:38:58 +0100 (CET) Received: from free.fr (unknown [88.172.40.194]) by smtp3-g21.free.fr (Postfix) with ESMTP id 74638A622E; Thu, 17 Feb 2011 23:38:52 +0100 (CET) To: freebsd-multimedia@freebsd.org From: Raoul =?utf-8?q?M=EF=BF=BDg=EF=BF=BDlas?= Date: Thu, 17 Feb 2011 23:38:55 +0100 Sender: root@free.fr Message-Id: <20110217223852.74638A622E@smtp3-g21.free.fr> Cc: Subject: Re: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 22:55:37 -0000 On Thu, 17 Feb 2011 22:54:35 +0100 Hans Petter Selasky wrote: > On Thursday 17 February 2011 22:12:16 Raoul M=EF=BF=BDg=EF=BF=BDlas wrote: > > on Thu, 17 Feb 2011 11:18:40 +0100 > > Hans Petter Selasky wrote: >> ... > > > cd /usr/src/sys/dev/sound/usb/ > > > cat umidi_patch_001.txt | patch > > >=20 > > > A short summary of what the changes are about: > > >=20 > > > - Make the USB MIDI driver more OSS compliant by implementing the > > > correct data format for the /dev/umidiX.Y character devices. Also > > > implement some missing OSS MIDI ioctls. > > > - Use the USB stack's builtin clear-stall feature. > > > - Wrap some long lines. > > > - Use memcpy() instead of bcopy(). > > >=20 > > > --HPS > > > > > Some demo tunes: > >=20 > > fluidsynth + zynaddsubfx + audacity + midipp: > >=20 > > http://www.selasky.org/hans_petter/synth_test_new.mp3 > >=20 > > zynaddsubfx + midipp: > >=20 > > http://www.selasky.org/hans_petter/synth_test.mp3 > >=20 > > --HPS > >=20 > > --Boundary-00=3D_AYPXNgVCRizMd8n > > Content-Type: text/plain; > >=20 > > charset=3D"us-ascii"; > > name=3D"umidi_patch_001.txt" > >=20 > > Content-Transfer-Encoding: 7bit > > Content-Disposition: inline; > >=20 > > filename=3D"umidi_patch_001.txt" > >=20 > > =3D=3D=3D uaudio.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- uaudio.c (revision 218769) > > +++ uaudio.c (local) > > @@ -191,10 +191,15 @@ > >=20 > > uint8_t iface_alt_index; > > =20 > > }; > >=20 > > -#define UMIDI_N_TRANSFER 4 /* units */ > >=20 > > #define UMIDI_CABLES_MAX 16 /* units */ > > #define UMIDI_BULK_SIZE 1024 /* bytes */ > >=20 > > +enum { > > + UMIDI_TX_TRANSFER, > > + UMIDI_RX_TRANSFER, > > + UMIDI_N_TRANSFER, > > +}; > > + > >=20 > > struct umidi_sub_chan { > > =20 > > struct usb_fifo_sc fifo; > > uint8_t *temp_cmd; > >=20 > > @@ -224,10 +229,6 @@ > >=20 > > uint8_t iface_index; > > uint8_t iface_alt_index; > >=20 > > - uint8_t flags; > > -#define UMIDI_FLAG_READ_STALL 0x01 > > -#define UMIDI_FLAG_WRITE_STALL 0x02 > > - > >=20 > > uint8_t read_open_refcount; > > uint8_t write_open_refcount; > >=20 > > @@ -336,9 +337,7 @@ > >=20 > > static usb_callback_t uaudio_chan_play_callback; > > static usb_callback_t uaudio_chan_record_callback; > > static usb_callback_t uaudio_mixer_write_cfg_callback; > >=20 > > -static usb_callback_t umidi_read_clear_stall_callback; > >=20 > > static usb_callback_t umidi_bulk_read_callback; > >=20 > > -static usb_callback_t umidi_write_clear_stall_callback; > >=20 > > static usb_callback_t umidi_bulk_write_callback; > > =20 > > static void uaudio_chan_fill_info_sub(struct uaudio_softc *, > >=20 > > @@ -493,7 +492,7 @@ > >=20 > > static const struct usb_config > > =20 > > umidi_config[UMIDI_N_TRANSFER] =3D { > >=20 > > - [0] =3D { > > + [UMIDI_TX_TRANSFER] =3D { > >=20 > > .type =3D UE_BULK, > > .endpoint =3D UE_ADDR_ANY, > > .direction =3D UE_DIR_OUT, > >=20 > > @@ -502,7 +501,7 @@ > >=20 > > .callback =3D &umidi_bulk_write_callback, > > =09 > > }, > >=20 > > - [1] =3D { > > + [UMIDI_RX_TRANSFER] =3D { > >=20 > > .type =3D UE_BULK, > > .endpoint =3D UE_ADDR_ANY, > > .direction =3D UE_DIR_IN, > >=20 > > @@ -510,26 +509,6 @@ > >=20 > > .flags =3D {.pipe_bof =3D 1,.short_xfer_ok =3D 1,.proxy_buffer =3D 1= ,}, > > .callback =3D &umidi_bulk_read_callback, > > =09 > > }, > >=20 > > - > > - [2] =3D { > > - .type =3D UE_CONTROL, > > - .endpoint =3D 0x00, /* Control pipe */ > > - .direction =3D UE_DIR_ANY, > > - .bufsize =3D sizeof(struct usb_device_request), > > - .callback =3D &umidi_write_clear_stall_callback, > > - .timeout =3D 1000, /* 1 second */ > > - .interval =3D 50, /* 50ms */ > > - }, > > - > > - [3] =3D { > > - .type =3D UE_CONTROL, > > - .endpoint =3D 0x00, /* Control pipe */ > > - .direction =3D UE_DIR_ANY, > > - .bufsize =3D sizeof(struct usb_device_request), > > - .callback =3D &umidi_read_clear_stall_callback, > > - .timeout =3D 1000, /* 1 second */ > > - .interval =3D 50, /* 50ms */ > > - }, > >=20 > > }; > > =20 > > static devclass_t uaudio_devclass; > >=20 > > @@ -1577,10 +1556,10 @@ > >=20 > > uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct > > uaudio_mixer_node *mc) { > > =20 > > struct uaudio_mixer_node *p_mc_new =3D > >=20 > > - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); > > + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); > >=20 > > - if (p_mc_new) { > > - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); > > + if (p_mc_new !=3D NULL) { > > + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); > >=20 > > p_mc_new->next =3D sc->sc_mixer_root; > > sc->sc_mixer_root =3D p_mc_new; > > sc->sc_mixer_count++; > >=20 > > @@ -1722,7 +1701,7 @@ > >=20 > > DPRINTFN(3, "ichs=3D%d ochs=3D%d\n", ichs, ochs); > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > > uaudio_mixer_determine_class(&iot[id], &mix); > >=20 > > @@ -1782,7 +1761,7 @@ > >=20 > > if (d->bNrInPins =3D=3D 0) { > > =09 > > return; > > =09 > > } > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); > > mix.wValue[0] =3D MAKE_WORD(0, 0); > >=20 > > @@ -1852,7 +1831,7 @@ > >=20 > > if (d->bControlSize =3D=3D 0) { > > =09 > > return; > > =09 > > } > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > nchan =3D (d->bLength - 7) / d->bControlSize; > > mmask =3D uaudio_mixer_feature_get_bmaControls(d, 0); > >=20 > > @@ -1986,7 +1965,7 @@ > >=20 > > DPRINTF("no mode select\n"); > > return; > > =09 > > } > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > > mix.nchan =3D 1; > >=20 > > @@ -2012,7 +1991,7 @@ > >=20 > > struct uaudio_mixer_node mix; > > uint16_t ptype; > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > ptype =3D UGETW(d0->wProcessType); > >=20 > > @@ -2067,7 +2046,7 @@ > >=20 > > } > > if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { > >=20 > > - bzero(&mix, sizeof(mix)); > > + memset(&mix, 0, sizeof(mix)); > >=20 > > mix.wIndex =3D MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); > > mix.nchan =3D 1; > >=20 > > @@ -2294,7 +2273,7 @@ > >=20 > > } > > =20 > > error: > > DPRINTF("bad data\n"); > >=20 > > - bzero(&r, sizeof(r)); > > + memset(&r, 0, sizeof(r)); > >=20 > > done: > > return (r); > > =20 > > } > >=20 > > @@ -3284,25 +3263,12 @@ > >=20 > > *=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > =3D=3D*/ > > =20 > > static void > >=20 > > -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t > > error) -{ > > - struct umidi_chan *chan =3D usbd_xfer_softc(xfer); > > - struct usb_xfer *xfer_other =3D chan->xfer[1]; > > - > > - if (usbd_clear_stall_callback(xfer, xfer_other)) { > > - DPRINTF("stall cleared\n"); > > - chan->flags &=3D ~UMIDI_FLAG_READ_STALL; > > - usbd_transfer_start(xfer_other); > > - } > > -} > > - > > -static void > >=20 > > umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) > > { > > =20 > > struct umidi_chan *chan =3D usbd_xfer_softc(xfer); > > struct umidi_sub_chan *sub; > > struct usb_page_cache *pc; > >=20 > > - uint8_t buf[1]; > > + uint8_t buf[5]; > >=20 > > uint8_t cmd_len; > > uint8_t cn; > > uint16_t pos; > >=20 > > @@ -3320,60 +3286,66 @@ > >=20 > > while (actlen >=3D 4) { > >=20 > > - usbd_copy_out(pc, pos, buf, 1); > > - > > - cmd_len =3D umidi_cmd_to_len[buf[0] & 0xF]; /* command length=20 */ > > - cn =3D buf[0] >> 4; /* cable number */ > > + /* copy out the MIDI data */ > > + usbd_copy_out(pc, pos, buf, 4); > > + /* command length */ > > + cmd_len =3D umidi_cmd_to_len[buf[0] & 0xF]; > > + /* cable number */ > > + cn =3D buf[0] >> 4; > > + /* > > + * Lookup sub-channel. The index is range > > + * checked below. > > + */ > >=20 > > sub =3D &chan->sub[cn]; > >=20 > > - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { > > - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, > > - pos + 1, cmd_len, 1); > > - } else { > > - /* ignore the command */ > > - } > > + if ((cmd_len !=3D 0) && > > + (cn < chan->max_cable) && > > + (sub->read_open !=3D 0)) { > >=20 > > + /* re-pack into a 4-byte array */ > > + /* zero unused bytes */ > > + if (cmd_len =3D=3D 1) { > > + buf[2] =3D 0; > > + buf[3] =3D 0; > > + buf[4] =3D 0; > > + } else if (cmd_len =3D=3D 2) { > > + buf[3] =3D 0; > > + buf[4] =3D 0; > > + } else { > > + buf[4] =3D 0; > > + } > > + > > + /* > > + * Send data in 4-byte chunks to the > > + * application: > > + */ > > + usb_fifo_put_data_linear( > > + sub->fifo.fp[USB_FIFO_RX], > > + buf + 1, 4, 1); > > + } > >=20 > > actlen -=3D 4; > > pos +=3D 4; > > =09 > > } > > =09 > > case USB_ST_SETUP: > > DPRINTF("start\n"); > >=20 > > - > > - if (chan->flags & UMIDI_FLAG_READ_STALL) { > > - usbd_transfer_start(chan->xfer[3]); > > - return; > > - } > >=20 > > +tr_setup: > > usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); > > usbd_transfer_submit(xfer); > >=20 > > - return; > > + break; > >=20 > > default: > > DPRINTF("error=3D%s\n", usbd_errstr(error)); > > =09 > > if (error !=3D USB_ERR_CANCELLED) { > > =09 > > /* try to clear stall first */ > >=20 > > - chan->flags |=3D UMIDI_FLAG_READ_STALL; > > - usbd_transfer_start(chan->xfer[3]); > > + usbd_xfer_set_stall(xfer); > > + goto tr_setup; > >=20 > > } > >=20 > > - return; > > - > > + break; > >=20 > > } > > =20 > > } > >=20 > > -static void > > -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t > > error) -{ > > - struct umidi_chan *chan =3D usbd_xfer_softc(xfer); > > - struct usb_xfer *xfer_other =3D chan->xfer[0]; > > - > > - if (usbd_clear_stall_callback(xfer, xfer_other)) { > > - DPRINTF("stall cleared\n"); > > - chan->flags &=3D ~UMIDI_FLAG_WRITE_STALL; > > - usbd_transfer_start(xfer_other); > > - } > > -} > > - > >=20 > > /* > > =20 > > * The following statemachine, that converts MIDI commands to > > * USB MIDI packets, derives from Linux's usbmidi.c, which > >=20 > > @@ -3502,6 +3474,8 @@ > >=20 > > sub->temp_cmd =3D sub->temp_1; > > sub->state =3D UMIDI_ST_SYSEX_0; > > return (1); > >=20 > > + default: > > + break; > >=20 > > } > > =09 > > } > > return (0); > >=20 > > @@ -3527,13 +3501,9 @@ > >=20 > > DPRINTF("actlen=3D%d bytes\n", len); > > =09 > > case USB_ST_SETUP: > > - > >=20 > > +tr_setup: > > DPRINTF("start\n"); > >=20 > > - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { > > - usbd_transfer_start(chan->xfer[2]); > > - return; > > - } > >=20 > > total_length =3D 0; /* reset */ > > start_cable =3D chan->curr_cable; > > tr_any =3D 0; > >=20 > > @@ -3593,7 +3563,7 @@ > >=20 > > usbd_xfer_set_frame_len(xfer, 0, total_length); > > usbd_transfer_submit(xfer); > > =09 > > } > >=20 > > - return; > > + break; > >=20 > > default: /* Error */ > >=20 > > @@ -3601,11 +3571,10 @@ > >=20 > > if (error !=3D USB_ERR_CANCELLED) { > > =09 > > /* try to clear stall first */ > >=20 > > - chan->flags |=3D UMIDI_FLAG_WRITE_STALL; > > - usbd_transfer_start(chan->xfer[2]); > > + usbd_xfer_set_stall(xfer); > > + goto tr_setup; > >=20 > > } > >=20 > > - return; > > - > > + break; > >=20 > > } > > =20 > > } > >=20 > > @@ -3635,7 +3604,7 @@ > >=20 > > { > > =20 > > struct umidi_chan *chan =3D usb_fifo_softc(fifo); > >=20 > > - usbd_transfer_start(chan->xfer[1]); > > + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > } > > =20 > > static void > >=20 > > @@ -3662,7 +3631,7 @@ > >=20 > > { > > =20 > > struct umidi_chan *chan =3D usb_fifo_softc(fifo); > >=20 > > - usbd_transfer_start(chan->xfer[0]); > > + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); > >=20 > > } > > =20 > > static void > >=20 > > @@ -3677,8 +3646,7 @@ > >=20 > > if (--(chan->write_open_refcount) =3D=3D 0) { > > =09 > > DPRINTF("(stopping write transfer)\n"); > >=20 > > - usbd_transfer_stop(chan->xfer[2]); > > - usbd_transfer_stop(chan->xfer[0]); > > + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); > >=20 > > } > > =20 > > } > >=20 > > @@ -3703,7 +3671,7 @@ > >=20 > > } > > /* clear stall first */ > > mtx_lock(&chan->mtx); > >=20 > > - chan->flags |=3D UMIDI_FLAG_WRITE_STALL; > > + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); > >=20 > > chan->write_open_refcount++; > > sub->write_open =3D 1; > >=20 > > @@ -3769,7 +3737,8 @@ > >=20 > > DPRINTF("setting of alternate index failed!\n"); > > goto detach; > > =09 > > } > >=20 > > - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, > > sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, > > chan->iface_index, > > + sc->sc_mixer_iface_index); > >=20 > > error =3D usbd_transfer_setup(uaa->device, &chan->iface_index, > > =09 > > chan->xfer, umidi_config, UMIDI_N_TRANSFER, > >=20 > > @@ -3799,13 +3768,15 @@ > >=20 > > mtx_lock(&chan->mtx); > > =09 > > /* clear stall first */ > >=20 > > - chan->flags |=3D UMIDI_FLAG_READ_STALL; > > + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > /* > >=20 > > - * NOTE: at least one device will not work properly unless > > - * the BULK pipe is open all the time. > > + * NOTE: At least one device will not work properly unless the > > + * BULK IN pipe is open all the time. This might have to do > > + * about that the internal queues of the device overflow if we > > + * don't read them regularly. > >=20 > > */ > >=20 > > - usbd_transfer_start(chan->xfer[1]); > > + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > mtx_unlock(&chan->mtx); > >=20 > > @@ -3828,8 +3799,7 @@ > >=20 > > mtx_lock(&chan->mtx); > >=20 > > - usbd_transfer_stop(chan->xfer[3]); > > - usbd_transfer_stop(chan->xfer[1]); > > + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); > >=20 > > mtx_unlock(&chan->mtx); >=20 > Hi Hans Peter, >=20 > On my laptop The first patch coredump, but not the second. > without the patch, my little soft runs fine, > i.e. using the mutexes part of code from ssynth. > With the second patch: > in the same conditions of testing, all notes stick, and make some jam. > It seems that the performances are degraded here. > what i do is simple: > the master keyboard sends the notes, the soft does some transformations a= nd > resends the notes to the two modules. >=20 > Do you need something else? > feel free to ask, of course. > Could you try this third patch? =.-HPS Oh! this one works perfectly for me. thanks. Raoul --Boundary-00=_bkZXNBbphpH84ED Content-Type: text/plain; charset="iso-8859-15"; name="umidi_patch_003.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="umidi_patch_003.txt" === uaudio.c ================================================================== --- uaudio.c (revision 218769) +++ uaudio.c (local) @@ -191,10 +191,15 @@ uint8_t iface_alt_index; }; -#define UMIDI_N_TRANSFER 4 /* units */ #define UMIDI_CABLES_MAX 16 /* units */ #define UMIDI_BULK_SIZE 1024 /* bytes */ +enum { + UMIDI_TX_TRANSFER, + UMIDI_RX_TRANSFER, + UMIDI_N_TRANSFER, +}; + struct umidi_sub_chan { struct usb_fifo_sc fifo; uint8_t *temp_cmd; @@ -224,10 +229,6 @@ uint8_t iface_index; uint8_t iface_alt_index; - uint8_t flags; -#define UMIDI_FLAG_READ_STALL 0x01 -#define UMIDI_FLAG_WRITE_STALL 0x02 - uint8_t read_open_refcount; uint8_t write_open_refcount; @@ -336,9 +337,7 @@ static usb_callback_t uaudio_chan_play_callback; static usb_callback_t uaudio_chan_record_callback; static usb_callback_t uaudio_mixer_write_cfg_callback; -static usb_callback_t umidi_read_clear_stall_callback; static usb_callback_t umidi_bulk_read_callback; -static usb_callback_t umidi_write_clear_stall_callback; static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, @@ -493,7 +492,7 @@ static const struct usb_config umidi_config[UMIDI_N_TRANSFER] = { - [0] = { + [UMIDI_TX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -502,7 +501,7 @@ .callback = &umidi_bulk_write_callback, }, - [1] = { + [UMIDI_RX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -510,26 +509,6 @@ .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, .callback = &umidi_bulk_read_callback, }, - - [2] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_write_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, - - [3] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_read_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, }; static devclass_t uaudio_devclass; @@ -1577,10 +1556,10 @@ uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc) { struct uaudio_mixer_node *p_mc_new = - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); - if (p_mc_new) { - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); + if (p_mc_new != NULL) { + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); p_mc_new->next = sc->sc_mixer_root; sc->sc_mixer_root = p_mc_new; sc->sc_mixer_count++; @@ -1722,7 +1701,7 @@ DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); uaudio_mixer_determine_class(&iot[id], &mix); @@ -1782,7 +1761,7 @@ if (d->bNrInPins == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); mix.wValue[0] = MAKE_WORD(0, 0); @@ -1852,7 +1831,7 @@ if (d->bControlSize == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); nchan = (d->bLength - 7) / d->bControlSize; mmask = uaudio_mixer_feature_get_bmaControls(d, 0); @@ -1986,7 +1965,7 @@ DPRINTF("no mode select\n"); return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2012,7 +1991,7 @@ struct uaudio_mixer_node mix; uint16_t ptype; - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); ptype = UGETW(d0->wProcessType); @@ -2067,7 +2046,7 @@ } if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2294,7 +2273,7 @@ } error: DPRINTF("bad data\n"); - bzero(&r, sizeof(r)); + memset(&r, 0, sizeof(r)); done: return (r); } @@ -3284,25 +3263,12 @@ *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[1]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - } -} - -static void umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct umidi_chan *chan = usbd_xfer_softc(xfer); struct umidi_sub_chan *sub; struct usb_page_cache *pc; - uint8_t buf[1]; + uint8_t buf[4]; uint8_t cmd_len; uint8_t cn; uint16_t pos; @@ -3320,60 +3286,50 @@ while (actlen >= 4) { - usbd_copy_out(pc, pos, buf, 1); - - cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */ - cn = buf[0] >> 4; /* cable number */ + /* copy out the MIDI data */ + usbd_copy_out(pc, pos, buf, 4); + /* command length */ + cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; + /* cable number */ + cn = buf[0] >> 4; + /* + * Lookup sub-channel. The index is range + * checked below. + */ sub = &chan->sub[cn]; - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, - pos + 1, cmd_len, 1); - } else { - /* ignore the command */ - } + if ((cmd_len != 0) && + (cn < chan->max_cable) && + (sub->read_open != 0)) { + /* Send data to the application */ + usb_fifo_put_data_linear( + sub->fifo.fp[USB_FIFO_RX], + buf + 1, cmd_len, 1); + } actlen -= 4; pos += 4; } case USB_ST_SETUP: DPRINTF("start\n"); - - if (chan->flags & UMIDI_FLAG_READ_STALL) { - usbd_transfer_start(chan->xfer[3]); - return; - } +tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - return; + break; default: DPRINTF("error=%s\n", usbd_errstr(error)); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; - usbd_transfer_start(chan->xfer[3]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } -static void -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[0]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); - } -} - /* * The following statemachine, that converts MIDI commands to * USB MIDI packets, derives from Linux's usbmidi.c, which @@ -3502,6 +3458,8 @@ sub->temp_cmd = sub->temp_1; sub->state = UMIDI_ST_SYSEX_0; return (1); + default: + break; } } return (0); @@ -3527,13 +3485,9 @@ DPRINTF("actlen=%d bytes\n", len); case USB_ST_SETUP: - +tr_setup: DPRINTF("start\n"); - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { - usbd_transfer_start(chan->xfer[2]); - return; - } total_length = 0; /* reset */ start_cable = chan->curr_cable; tr_any = 0; @@ -3593,7 +3547,7 @@ usbd_xfer_set_frame_len(xfer, 0, total_length); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ @@ -3601,11 +3555,10 @@ if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(chan->xfer[2]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } @@ -3635,7 +3588,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); } static void @@ -3662,7 +3615,7 @@ { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); } static void @@ -3677,8 +3630,7 @@ if (--(chan->write_open_refcount) == 0) { DPRINTF("(stopping write transfer)\n"); - usbd_transfer_stop(chan->xfer[2]); - usbd_transfer_stop(chan->xfer[0]); + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); } } @@ -3703,7 +3655,7 @@ } /* clear stall first */ mtx_lock(&chan->mtx); - chan->flags |= UMIDI_FLAG_WRITE_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); chan->write_open_refcount++; sub->write_open = 1; @@ -3769,7 +3721,8 @@ DPRINTF("setting of alternate index failed!\n"); goto detach; } - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, chan->iface_index, + sc->sc_mixer_iface_index); error = usbd_transfer_setup(uaa->device, &chan->iface_index, chan->xfer, umidi_config, UMIDI_N_TRANSFER, @@ -3799,13 +3752,15 @@ mtx_lock(&chan->mtx); /* clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); /* - * NOTE: at least one device will not work properly unless - * the BULK pipe is open all the time. + * NOTE: At least one device will not work properly unless the + * BULK IN pipe is open all the time. This might have to do + * about that the internal queues of the device overflow if we + * don't read them regularly. */ - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); @@ -3828,8 +3783,7 @@ mtx_lock(&chan->mtx); - usbd_transfer_stop(chan->xfer[3]); - usbd_transfer_stop(chan->xfer[1]); + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); --Boundary-00=_bkZXNBbphpH84ED-- From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 12:53:22 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8791B106566C; Sat, 19 Feb 2011 12:53:22 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.c2i.net [212.247.154.130]) by mx1.freebsd.org (Postfix) with ESMTP id E47CC8FC16; Sat, 19 Feb 2011 12:53:21 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=O4luLtK3s/BI/ZI2MixGyL7hJC8Dk2jKRuc55HZ6Kk0= c=1 sm=1 a=nrtpgiN_JOIA:10 a=IkcTkHD0fZMA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=OdR5sfXFAAAA:8 a=h23m0YT2WAFcJETSTLQA:9 a=ZehnQznpf4njnLnwp2dvDSMzeGQA:4 a=QEXdDO2ut3YA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe05.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89052419; Sat, 19 Feb 2011 13:53:20 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org, Edward Tomasz =?utf-8?q?Napiera=C5=82a?= Date: Sat, 19 Feb 2011 13:53:07 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <20110217223852.74638A622E@smtp3-g21.free.fr> <201102172348.59534.hselasky@c2i.net> In-Reply-To: <201102172348.59534.hselasky@c2i.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?utf-8?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?utf-8?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201102191353.07854.hselasky@c2i.net> Cc: Subject: Re: USB MIDI patch for FreeBSD 8/9 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 12:53:22 -0000 Hi again, I've noticed the many MIDI applications now use JACK, so I've spent some time today to write up a program called jack_umidi. This programs allows you to import /dev/umidiX.Y instances into the JACK system. Comments are welcome. Sources are available from: svn --username anonsvn --password anonsvn \ checkout svn://svn.turbocat.net/i4b/trunk/jack_umidi When the port freeze is over I hope to create a port for this for FreeBSD 8+. After download: cd jack_umidi make all install clean man jack_umidi jackd -d oss jack_umidi -d /dev/umidi0.0 Now you can use: /usr/ports/audio/jack-keyboard for example! --HPS From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 16:04:14 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40EAC106566C for ; Sat, 19 Feb 2011 16:04:14 +0000 (UTC) (envelope-from gabor@zahemszky.hu) Received: from origmail.integrity.hu (origmail.integrity.hu [195.56.44.40]) by mx1.freebsd.org (Postfix) with SMTP id CBF028FC16 for ; Sat, 19 Feb 2011 16:04:13 +0000 (UTC) Received: (qmail 3475 invoked by uid 89); 19 Feb 2011 16:37:31 +0100 Message-ID: <20110219153731.3473.qmail@origmail.integrity.hu> From: "Zahemszky Gabor" To: freebsd-multimedia@freebsd.org Date: Sat, 19 Feb 2011 16:37:31 +0100 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2"; format=flowed Content-Transfer-Encoding: quoted-printable X-Sender: gabor@zahemszky.hu Subject: Midi and FreeBSD X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 16:04:14 -0000 Hi!=20 My children have got a drum-machine, which - of course - can speak MIDI. = If=20 I buy a "MIDI-USB" communication cable to connect it to my PC, will it=20 possible to use it? Do I need to buy a special cable (made-by-XYZ), are=20 there any specific drivers, or programs, with what I can play with it. I'= ve=20 seen eg OpenBSD's midish CLI program, but it isn't ported to FreeBSD (yet= ).=20 (I use FreeBSD8 on both i386 and Amd64.)=20 Thanks G=E1bor < Gabor at Zahemszky dot HU > From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 16:56:43 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7046D106566B for ; Sat, 19 Feb 2011 16:56:43 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 02C7B8FC0C for ; Sat, 19 Feb 2011 16:56:42 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=LfWZgthhXpRoR/5kSLoV97TeOFxNHdDd5OkOatCv3DI= c=1 sm=1 a=-CRmgG0JhlAA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6PjjKc_AaRZfIN87Z1QA:9 a=8BJzYPMaOeZH0AkYIIsA:7 a=MPXFdEU6mxIB9dtErlH-Ngj-heUA:4 a=jiObf9B0YAUA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89481666; Sat, 19 Feb 2011 17:56:40 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Sat, 19 Feb 2011 17:56:28 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <20110219153731.3473.qmail@origmail.integrity.hu> In-Reply-To: <20110219153731.3473.qmail@origmail.integrity.hu> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?iso-8859-1?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?iso-8859-1?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit Message-Id: <201102191756.28268.hselasky@c2i.net> Cc: Zahemszky Gabor Subject: Re: Midi and FreeBSD X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 16:56:43 -0000 On Saturday 19 February 2011 16:37:31 Zahemszky Gabor wrote: > Hi! > > My children have got a drum-machine, which - of course - can speak MIDI. If > I buy a "MIDI-USB" communication cable to connect it to my PC, will it > possible to use it? Do I need to buy a special cable (made-by-XYZ), are > there any specific drivers, or programs, with what I can play with it. I've > seen eg OpenBSD's midish CLI program, but it isn't ported to FreeBSD (yet). > > (I use FreeBSD8 on both i386 and Amd64.) Hi, Yes, there exists plenty of USB MIDI software for FreeBSD, but not all is in ports. The USB MIDI solution in FreeBSD is part of snd_uaudio. Do you see any devices like /dev/umidiX.Y ? --HPS From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 17:37:00 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8F75106566B for ; Sat, 19 Feb 2011 17:37:00 +0000 (UTC) (envelope-from Gabor@Zahemszky.HU) Received: from relay03.digicable.hu (relay03.digicable.hu [92.249.128.185]) by mx1.freebsd.org (Postfix) with ESMTP id 9BCA68FC1C for ; Sat, 19 Feb 2011 17:37:00 +0000 (UTC) Received: from [94.21.15.20] (helo=Picasso.Zahemszky.HU) by relay03.digicable.hu with esmtpa id 1Pqqjq-0007tQ-Pd for ; Sat, 19 Feb 2011 18:36:59 +0100 Date: Sat, 19 Feb 2011 18:36:58 +0100 From: Zahemszky =?ISO-8859-2?Q?G=E1bor?= To: freebsd-multimedia@freebsd.org Message-ID: <20110219183658.6ff05b78@Picasso.Zahemszky.HU> Organization: Zahemszky Bt. X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.1; amd64-portbld-freebsd8.1) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Original: 94.21.15.20 Subject: configuring snd_hda X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 17:37:00 -0000 Hi! I've got an Intel DG965SS mainboard, on it I run 8.2-RC3 - amd64. The mainb= oard has a built-in sound device, which is known to snd_hda: # sysctl hw.snd.verbose=3D2 # cat /dev/sndstat FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64) Installed devices: pcm0: at cad 2 nid 1 on hdac0 kld sn= d_hda (1p:1v/1r:1v) default snddev flags=3D0x2e2 [pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x000000= 04 interrupts 929, underruns 0, feed 929, ready 0 [b:4096/2048/2|bs:4096/2048= /2] channel flags=3D0x2100 {userland} -> feeder_mixer(0x00200010) -> {hardware} pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 44100/48000, fmt 0x00100010/= 0x00200010, flags 0x10000000, 0x00000069 interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:32768/1024/32] channel flags=3D0x10000000 {userland} -> feeder_root(0x00100010) -> feeder_rate(0x00100010 q:1 44100 = -> 48000) -> feeder_matrix(1.0 -> 2.0) -> feeder_volume(0x00200010) -> {har= dware} [pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x0000= 0005 interrupts 0, overruns 0, feed 0, hfree 4096, sfree 4096 [b:4096/2048/2|bs= :4096/2048/2] channel flags=3D0x2100 {hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {user= land} pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 8000, fmt 0x00100008, flag= s 0x10000000, 0x00000000 interrupts 0, overruns 0, feed 0, hfree 0, sfree 0 [b:0/0/0|bs:0/0/0] channel flags=3D0x10000000 {hardware} -> feeder_root(0x00000000) -> {userland} I can use the back panel speaker connector, it works. But: I cannot use the other connectors: neither back panel microphone connector nor the front panel audio connectors work. On the front, there are a green (line-out/speaker) and a pink (microphone) connectors, but neither of them work. I've just found this information in the mainboard's manual: "NOTE Some chassis still use a front panel audio solution based on the AC '97 aud= io specification. Refer to Table 7 below to connect an AC '97 front panel solu= tion to the front panel audio header on the board. The front panel audio jacks will nee= d to be manually configured for microphone or line out functionality in the Intel= =C2=AE Audio Studio application." I've read man snd_hda, and found the info about reconfiguring snd_hda, but = - I'm so sorry - I cannot understand, how can I make this soundcard to use my microphone. (I t= ested it on my laptops, and the microphone is good on these machines.) I'd like to use the muting f= unction, too: if I push the headset into the front connector, it would be better to switch o= ff the speakers in the back connectors -). I don't know, does it need, but here is the actual pindump: # sysctl dev.hdac.0.pindump=3D1 =3D=3D=3D dump =3D=3D=3D=3D hdac0: Dumping AFG cad=3D2 nid=3D1 pins: hdac0: nid 10 0x0221401f as 1 seq 15 Headphones Jack jack 1 loc 2 c= olor Green misc 0 hdac0: Caps: IN OUT HP VREF Sense: 0x00002710 delay 10us hdac0: nid 11 0x02a19040 as 4 seq 0 Mic Jack jack 1 loc 2 c= olor Pink misc 0 hdac0: Caps: IN OUT HP VREF Sense: 0x7fffffff delay 100000us hdac0: nid 12 0x400000fd as 15 seq 13 Line-out None jack 0 loc 0 c= olor Unknown misc 0 [DISABLED] hdac0: Caps: IN OUT VREF Sense: 0x00002710 delay 10us hdac0: nid 13 0x01114010 as 1 seq 0 Speaker Jack jack 1 loc 1 c= olor Green misc 0 hdac0: Caps: IN OUT HP VREF Sense: 0xffffffff delay 100000us hdac0: nid 14 0x01119012 as 1 seq 2 Speaker Jack jack 1 loc 1 c= olor Pink misc 0 hdac0: Caps: IN OUT VREF Sense: 0x0000012c delay 10us hdac0: nid 15 0x01113011 as 1 seq 1 Speaker Jack jack 1 loc 1 c= olor Blue misc 0 hdac0: Caps: IN OUT VREF Sense: 0x7fffffff delay 100000us hdac0: nid 16 0x400000fc as 15 seq 12 Line-out None jack 0 loc 0 c= olor Unknown misc 0 [DISABLED] hdac0: Caps: IN OUT Sense: 0x00002710 delay 20us hdac0: nid 17 0x400000fb as 15 seq 11 Line-out None jack 0 loc 0 c= olor Unknown misc 0 [DISABLED] hdac0: Caps: IN OUT Sense: 0x7fffffff delay 100000us hdac0: nid 18 0x400000fa as 15 seq 10 Line-out None jack 0 loc 0 c= olor Unknown misc 0 [DISABLED] hdac0: Caps: IN =20 hdac0: nid 33 0x400000f9 as 15 seq 9 Line-out None jack 0 loc 0 c= olor Unknown misc 0 [DISABLED] hdac0: Caps: OUT =20 hdac0: nid 34 0x400000ff as 15 seq 15 Line-out None jack 0 loc 0 c= olor Unknown misc 0 [DISABLED] hdac0: Caps: IN EAPD Sense: 0x00000000 hdac0: NumGPIO=3D3 NumGPO=3D0 NumGPI=3D0 GPIWake=3D1 GPIUnsol=3D1 hdac0: GPIO: data=3D0x00000000 enable=3D0x00000000 direction=3D0x00000000 hdac0: wake=3D0x00000000 unsol=3D0x00000000 sticky=3D0x00000000 =3D=3D=3D=3D Thanks G=C3=A1bor < Gabor at Zahemszky dot HU > --=20 #!/bin/ksh # # See my GPG key at http://www.Zahemszky.HU # Z=3D'21N16I25C25E30, 40M30E33E25T15U!'; IFS=3D' ABCDEFGHIJKLMNOPQRSTUVWXYZ '; set -- $Z;for i;{ [[ $i =3D ? ]]&&print $i&&break; [[ $i =3D ??? ]]&&j=3D$i&&i=3D${i%?}; typeset -i40 i=3D8#$i;print -n ${i#???}; [[ "$j" =3D ??? ]]&&print -n "${j#??} "&&j=3D;typeset +i i;}; IFS=3D' 0123456789 ';set -- $Z;for i;{ [[ $i =3D , ]]&&i=3D2; [[ $i =3D ?? ]]||typeset -l i;j=3D"$j $i";typeset +l i;};print "$j" From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 17:38:24 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A25C106564A for ; Sat, 19 Feb 2011 17:38:24 +0000 (UTC) (envelope-from Gabor@Zahemszky.HU) Received: from relay03.digicable.hu (relay03.digicable.hu [92.249.128.185]) by mx1.freebsd.org (Postfix) with ESMTP id DE4618FC0A for ; Sat, 19 Feb 2011 17:38:23 +0000 (UTC) Received: from [94.21.15.20] (helo=Picasso.Zahemszky.HU) by relay03.digicable.hu with esmtpa id 1PqqVw-0006zG-P1 for ; Sat, 19 Feb 2011 18:22:36 +0100 Date: Sat, 19 Feb 2011 18:22:33 +0100 From: Zahemszky =?ISO-8859-2?Q?G=E1bor?= To: freebsd-multimedia@freebsd.org Message-ID: <20110219182233.3cfdbbbc@Picasso.Zahemszky.HU> In-Reply-To: <201102191756.28268.hselasky@c2i.net> References: <20110219153731.3473.qmail@origmail.integrity.hu> <201102191756.28268.hselasky@c2i.net> Organization: Zahemszky Bt. X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.1; amd64-portbld-freebsd8.1) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable X-Original: 94.21.15.20 Subject: Re: Midi and FreeBSD X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 17:38:24 -0000 Hi! > > If I buy a "MIDI-USB" communication cable to connect it to my (*) > > PC, will it possible to use it? Do I need to buy a special cable > > (made-by-XYZ), are there any specific drivers, or programs, with > > what I can play with it. I've seen eg OpenBSD's midish CLI program, > > but it isn't ported to FreeBSD (yet). > >=20 > > (I use FreeBSD8 on both i386 and Amd64.) >=20 > Hi, >=20 > Yes, there exists plenty of USB MIDI software for FreeBSD, but not > all is in ports. The USB MIDI solution in FreeBSD is part of > snd_uaudio. Do you see any devices like /dev/umidiX.Y ? As I've written in my first mail (*), I haven't got the USB-MIDI cable yet (as I don't know, do I have to buy some specific, or any of them will be good.) So if I understand you correctly, after buying that cable, I only have to "kldload snd_uaudio", connect the drum-machine to the PC with that cable, and I'll see (OK, I have to) /dev/umidiX.Y devices? It'll be great. (I think one of the umidi device - eg. umidi0.0 - will be the MIDI-OUT/PASSTHROUGH and the other - umidi0.1 will be MIDI-IN?) Or if not, are there any documentation about it as I hadn't find it in man snd_uaudio. By the way, nowhere in "man -k midi". Does this snd_uaudio driver will give us the original Linux-like /dev/sequencer OSS-device? Or how can I use these /dev/umidi devices? And where are those "plenty of MIDI software"? (I hope, I can download and install them by hand, but of course, I'd like better them from ports.) Thanks for your quick answer! G=E1bor < Gabor at Zahemszky dot HU > --=20 #!/bin/ksh # # See my GPG key at http://www.Zahemszky.HU # Z=3D'21N16I25C25E30, 40M30E33E25T15U!'; IFS=3D' ABCDEFGHIJKLMNOPQRSTUVWXYZ '; set -- $Z;for i;{ [[ $i =3D ? ]]&&print $i&&break; [[ $i =3D ??? ]]&&j=3D$i&&i=3D${i%?}; typeset -i40 i=3D8#$i;print -n ${i#???}; [[ "$j" =3D ??? ]]&&print -n "${j#??} "&&j=3D;typeset +i i;}; IFS=3D' 0123456789 ';set -- $Z;for i;{ [[ $i =3D , ]]&&i=3D2; [[ $i =3D ?? ]]||typeset -l i;j=3D"$j $i";typeset +l i;};print "$j" From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 17:47:42 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CFBC1065672 for ; Sat, 19 Feb 2011 17:47:42 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 851AB8FC1B for ; Sat, 19 Feb 2011 17:47:41 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=LfWZgthhXpRoR/5kSLoV97TeOFxNHdDd5OkOatCv3DI= c=1 sm=1 a=-CRmgG0JhlAA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=OdR5sfXFAAAA:8 a=p6vgIpTt_5xSk_obWPEA:9 a=FxL9F01iepkg85DjQkkA:7 a=9ION_YK454qLFB2qxWytECqmKP8A:4 a=jiObf9B0YAUA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89493620; Sat, 19 Feb 2011 18:47:40 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Sat, 19 Feb 2011 18:47:28 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <20110219153731.3473.qmail@origmail.integrity.hu> <201102191756.28268.hselasky@c2i.net> <20110219182233.3cfdbbbc@Picasso.Zahemszky.HU> In-Reply-To: <20110219182233.3cfdbbbc@Picasso.Zahemszky.HU> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?iso-8859-1?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?iso-8859-1?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Message-Id: <201102191847.28112.hselasky@c2i.net> Cc: Zahemszky =?iso-8859-2?q?G=E1bor?= Subject: Re: Midi and FreeBSD X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 17:47:42 -0000 On Saturday 19 February 2011 18:22:33 Zahemszky G=E1bor wrote: > Hi! >=20 > > > If I buy a "MIDI-USB" communication cable to connect it to my >=20 > (*) >=20 Hi, > > > PC, will it possible to use it?=20 Most USB MIDI cables use the same protocol. Should be compatible with USB M= IDI=20 spec. v 1.0. Good sign: Works on Mac and no drivers requires. > > > Do I need to buy a special cable > > > (made-by-XYZ), are there any specific drivers, or programs, with > > > what I can play with it. I've seen eg OpenBSD's midish CLI program, > > > but it isn't ported to FreeBSD (yet). > > >=20 > > > (I use FreeBSD8 on both i386 and Amd64.) > >=20 > > Hi, > >=20 > > Yes, there exists plenty of USB MIDI software for FreeBSD, but not > > all is in ports. The USB MIDI solution in FreeBSD is part of > > snd_uaudio. Do you see any devices like /dev/umidiX.Y ? >=20 > As I've written in my first mail (*), I haven't got the USB-MIDI cable > yet (as I don't know, do I have to buy some specific, or any of them > will be good.) >=20 > So if I understand you correctly, after buying that cable, I > only have to "kldload snd_uaudio", connect the drum-machine to the > PC with that cable, and I'll see (OK, I have to) /dev/umidiX.Y > devices?=20 Depending on how many ports your device has, you'll see /dev/umidi0.{0..15} > It'll be great. (I think one of the umidi device - eg. > umidi0.0 - will be the MIDI-OUT/PASSTHROUGH and the other - umidi0.1 > will be MIDI-IN?)=20 umidi0.0 is read+write. RAW MIDI. > Or if not, are there any documentation about it as I > hadn't find it in man snd_uaudio. By the way, nowhere in "man -k midi". > Does this snd_uaudio driver will give us the original > Linux-like /dev/sequencer OSS-device?=20 No, this device does not exist for USB MIDI adapters. You'll need to use a= =20 program called jack_umidi, which convert the /dev/umidiX.Y instance into a= =20 TCP-based jack instance, which is a more popular choice. > Or how can I use these /dev/umidi > devices? Loopback: dd if=3D/dev/umidi0.0 of=3D/dev/umidi0.0 bs=3D1 Read+write like any other file. >=20 > And where are those "plenty of MIDI software"? (I hope, I can > download and install them by hand, but of course, I'd like better them > from ports.) Currently what I use is: /usr/ports/audio/{rosegarden,zynaddsubfx,fluidsynth,jack-keyboard,jack} zynaddsubfx and fluidsynth should be compiled from GIT/SVN. I have some=20 patches for these software packages to improve usability. fluidsynth is mos= t=20 suitable for drums. Then there is libumidi20, midipp (depends on QT4.x from ports) and the=20 recently added jack_umidi: svn --username anonsvn --password anonsvn \ checkout svn://svn.turbocat.net/i4b/trunk/libumidi20 svn --username anonsvn --password anonsvn \ checkout svn://svn.turbocat.net/i4b/trunk/midipp svn --username anonsvn --password anonsvn \ checkout svn://svn.turbocat.net/i4b/trunk/jack_umidi And I also have some scripts to set the correct permissions on the MIDI- adapters as you plug them. =2D-HPS From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 18:31:39 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A5D5106566B for ; Sat, 19 Feb 2011 18:31:39 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id DB6BF8FC0C for ; Sat, 19 Feb 2011 18:31:38 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=6QwXiDozn7Gnsf2tGidwH+ndAwLlGixx7JAIKZICKmI= c=1 sm=1 a=D-fooTgaQu4A:10 a=Q9fys5e9bTEA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=OdR5sfXFAAAA:8 a=NBoPaohmYJiPtLCfSSkA:9 a=4Jp9rOe_2BzVv_VMZR8A:7 a=crBUWc6dSUFyrDYs1BEE8FVxIJ0A:4 a=PUjeQqilurYA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 90090286; Sat, 19 Feb 2011 19:31:36 +0100 From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Sat, 19 Feb 2011 19:31:24 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: In-Reply-To: X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201102191931.24581.hselasky@c2i.net> Cc: Subject: Re: [patch] webcamd support for TerraTec Cinergy TStick RC MK2 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 18:31:39 -0000 > Little tutorial: > > % svn --username anonsvn --password anonsvn checkout \ > svn://svn.turbocat.net/i4b/trunk/usbcam/ulinux > % cd ulinux > % make fetch > % cd patches > % ./do_patch.sh > % cd .. > % patch < webcamd_r1724.diff > % patch < cinergy_rc_mk2.diff > % make -j4 Hi, Your patches have been committed with webcamd SVN r1743. Please: svn up make fetch_clean And repeat the rest of the instructions from "make fetch" and verify that the driver is still working. --HPS From owner-freebsd-multimedia@FreeBSD.ORG Sat Feb 19 21:10:40 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA6891065670 for ; Sat, 19 Feb 2011 21:10:40 +0000 (UTC) (envelope-from rmgls@free.fr) Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by mx1.freebsd.org (Postfix) with ESMTP id B7A128FC1A for ; Sat, 19 Feb 2011 21:10:38 +0000 (UTC) Received: from free.fr (unknown [88.172.40.194]) by smtp3-g21.free.fr (Postfix) with ESMTP id AFD47A622C; Sat, 19 Feb 2011 22:10:34 +0100 (CET) From: Raoul To: freebsd-multimedia@freebsd.org Date: Sat, 19 Feb 2011 22:10:37 +0100 Sender: rmgls@free.fr Message-Id: <20110219211034.AFD47A622C@smtp3-g21.free.fr> Cc: Subject: libumidi port X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 21:10:41 -0000 Hi Hans Peter and all, Freebsd has no usb midi library at least in the port tree at my knowledge. i am aware that Hans Peter Selasky has written a libumidi20 which would be more than valuable for freebsd. Perhaps now it is time to make a port with some words of doc to use it. I hope than the author who has created and enhanced this library for some years (?) will find the time to port it? Thanks for your time and your patience. best regards. Raoul rmgls@free.fr