From owner-freebsd-usb@FreeBSD.ORG Sat Jan 1 13:48:54 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 26A9D16A4CE for ; Sat, 1 Jan 2005 13:48:54 +0000 (GMT) Received: from dastardly.newsbastards.org.72.27.172.IN-addr.ARPA.NOSPAM.dyndns.dk (84-72-30-72.dclient.hispeed.ch [84.72.30.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B78643D39 for ; Sat, 1 Jan 2005 13:48:52 +0000 (GMT) (envelope-from bounce@NOSPAM.dyndns.dk) Received: from Mail.NOSPAM.DynDNS.dK (ipv6.NOSPAM.dyndns.dk [2002:5448:1e48:0:210:60ff:fe25:f1e5]) (8.11.6/8.11.6-SPAMMERS-DeLiGHt) with ESMTP id j01Dmje80456 verified NO) for ; Sat, 1 Jan 2005 14:48:49 +0100 (CET) (envelope-from bounce@NOSPAM.dyndns.dk) Received: (from beer@localhost) by Mail.NOSPAM.DynDNS.dK (8.11.6/FNORD) id j01Dmi180455; Sat, 1 Jan 2005 14:48:44 +0100 (CET) (envelope-from bounce@NOSPAM.dyndns.dk) Date: Sat, 1 Jan 2005 14:48:44 +0100 (CET) Message-Id: <200501011348.j01Dmi180455@Mail.NOSPAM.DynDNS.dK> X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: beer set sender to bounce@NOSPAM.dyndns.dk using -f X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: Processed from queue /tmp X-Authentication-Warning: localhost.newsbastards.org.72.27.172.IN-addr.A: Processed by beer with -C /etc/mail/sendmail.cf-LOCAL From: Barry Bouwsma To: freebsd-usb@freebsd.org References: <41B8C7A9.3080306@elischer.org> <20041224.182917.607958849.kazuhito@ph.noda.tus.ac.jp> <41CD00B1.9040502@elischer.org> <20041225.230115.422452498.kazuhito@ph.noda.tus.ac.jp> <41CE5C91.5060104@elischer.org> Mail-Followup-To: freebsd-usb@freebsd.org Subject: Re: Hacking usb/uaudio code X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Barry Bouwsma List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jan 2005 13:48:54 -0000 > >>>kern/75274 for merging > >>>kern/75276 for volumes > >>>kern/75311 for recording > >>>kern/75316 for selection of a recording sound source > >> > >>how much have you tested these patches? > >>do they break other audio devices? > > > > I usually use those patches almost every day. > > But I have tested those patches by `Sound Blaster Digital Music' only. > > So those patches require many test, test, test, and test > > by various USB audio devices. > > > > I'm afraid that those patches have problems with simple devices e.g. > > USB microphone or with complicated devices > > which have add-processing or extension units. > I am led to believe that those cases were not well supported > before your patches and that your patches probably do not break > them more than they were already broken. Hi, Sorry for the delay in giving my feedback to this. I just want to say that I applied your patches to my usb audio source in 4.x, and it works without greater problems than the original 4.x code. I've done this as follows: 1) Take the mid-december -current uaudio source files. 2) Apply the following patches to make -current source compile with my 4.x (no guarantees that I don't have patches elsewhere to make this work for me, so please try it out first) --- /stand/FreeBSD4-src/source-hacks/sys/dev/sound/usb/uaudio_pcm.c-current Thu Dec 9 22:35:41 2004 +++ /stand/FreeBSD4-src/source-hacks/sys/dev/sound/usb/uaudio_pcm.c-built-from-current Thu Dec 30 23:06:53 2004 @@ -307,8 +307,10 @@ /*filter*/NULL, /*filterarg*/NULL, /*maxsize*/bufsz, /*nsegments*/1, /*maxsegz*/0x3fff, /*flags*/0, +#if __FreeBSD_version >= 500000 /* XXXX HACK */ /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, +#endif &ua->parent_dmat) != 0) { device_printf(dev, "unable to create dma tag\n"); goto bad; @@ -373,8 +375,15 @@ PCM_SOFTC_SIZE, }; +#if __FreeBSD_version < 500000 /* XXX HACK */ +static devclass_t pcm_devclass; +#endif DRIVER_MODULE(ua_pcm, uaudio, ua_pcm_driver, pcm_devclass, 0, 0); MODULE_DEPEND(ua_pcm, uaudio, 1, 1, 1); +#if __FreeBSD_version < 500000 /* XXX HACK -- should be something else */ +MODULE_DEPEND(ua_pcm, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER); +#else MODULE_DEPEND(ua_pcm, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); +#endif /* XXXX HACK */ MODULE_VERSION(ua_pcm, 1); --- /stand/FreeBSD4-src/source-hacks/sys/dev/sound/usb/uaudio.c-current Thu Dec 9 22:35:36 2004 +++ /stand/FreeBSD4-src/source-hacks/sys/dev/sound/usb/uaudio.c-built-from-current Thu Dec 30 23:01:40 2004 @@ -57,7 +57,9 @@ #include /* for bootverbose */ #include #include +#if __FreeBSD_version >= 500000 /* XXX HACK */ #include +#endif #if defined(__NetBSD__) || defined(__OpenBSD__) #include #elif defined(__FreeBSD__) 3) At this point, I built the kernel module to verify -current source would still work with 4.x, loaded it, and played with success. 4) Then apply the four patches you submitted as PRs. I don't recall any failures which had to be fixed by hand, apart from the first unimportant part of the patch (the RCS IDs). Then I've built a module (also I built modules at each step of applying the four patches), and loaded that, and used it with my simple uaudio soundcard (HID plus playback/record). Playback is no problem at 48kHz; now if I try to playback at a different rate, I get an error, when earlier the device played back with noted distortion, but did play back. This is to be expected from what you wrote. Recording seems to work with no source, giving me hum on the mic input and the sound of connecting to the line input. No panics or crashes. All my recording or playback is done at the professional 48kHz sample rate. The mixer device now has something: bash-2.05a$ mixer -f /dev/mixer1 Mixer speaker is currently set to 75:75 Mixer line is currently set to 0:0 Mixer mic is currently set to 0:0 There is no default device to be set, but the `speaker' control adjusts both line-out and speaker-out playback levels. bash-2.05a$ mixer -f /dev/mixer1 90 Setting the mixer vol to 90:90. mixer: WRITE_MIXER: Device not configured bash-2.05a$ mixer -f /dev/mixer1 speaker 90 Setting the mixer speaker to 90:90. Recording source input selection now works (yay), as does setting levels for them. (This sound hardware is somewhat noisy, as usual) So far, no problems noted in playback. With the code I had been using, I would experience that after some time, starting a new playback, that the device would go silent for no obvious reason -- usually after a few dozen times starting/stopping playback, although it appeared that data was being sent to the device, from what little I could see. Unplugging and replugging the USB connector would be enough to make the device play again. Obviously, I need to try quite a bit more to see if this recurs, and also check again whether NetBSD suffers the same, if it does. This is the only USB audio device I have at the moment, but now it is very tempting for me to break down and acquire more. I also see that `mpg123' includes the option to set an output sample rate, so I'm able to playback layer 3 audio files which have a different sample rate without the need for any external assistance. (mpg123 starts *fast* here as only a single sample rate is supported, and it's not spending all its time going through a list of them as it is with a different soundcard.) Not every playback program I've tried has gracefully handled the return code it gets when the output rate doesn't match the device capabilities. Thanks! barry bouwsma