From: Takashi Iwai Subject: Re: [RFC][PATCH] snd-usb-audio and audiophile usb analog capture Date: Wed, 08 Mar 2006 13:05:05 +0100 Message-ID: References: <062401c6420c$e0cb2bd0$a578e4a0@supelec.fr> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <062401c6420c$e0cb2bd0$a578e4a0@supelec.fr> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Thibault LE MEUR Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Tue, 7 Mar 2006 18:30:44 +0100, Thibault LE MEUR wrote: > > Hi, > > (I've sent this mail yesterday and it seems to have been lost somewhere... > Thus, I repost it now). > > Here is the patch I've developped for audiophile usb: It solves bug id 1801. > > Sorry for the long post, but I prefer to give as much information as > possible in order to explain the patch and maybe update the docs for this > device. > > You'll find in this mail: > - The patch ;-) > - A Short and long (very long) description of it Could you include it in the patch as a document put in Documentation directory? Also don't forget to update ALSA-Configuration.txt when an option is added/modified. > Takashi, > I've not added a "true" quirk (function pointer parameter) to the > "parse_audio_endpoints" function. Instead I've just made the quirk fit into > a simple function so that parse_audio_enpoints needs only 2 lines of patch. > - Do you still think it's necessary to implement a "true" quirk? The patch itself is small and clean enough to include. But I still think it'd be better to split it off to another module so that more intuitive options could be used rather than a magical number. About the patch: Could you fix the following? > --- usbaudio.c 2006-03-05 21:41:48.000000000 +0100 > +++ /usr/src/alsa/alsa-cvs-02282006.patched/alsa-driver/usb/usbaudio.c 2006-03-05 21:52:14.000000000 +0100 > @@ -76,6 +76,7 @@ > #else > 0; /* disabled as default for buggy async-unlink handling */ > #endif > +static int device_setup = 0x00; /* device specific setup (parameter's meaning depends on the physical devicer) */ You don't need zero-initialization here. A static variable is guaranteed to be zero-initialized. Also, try not to exeed 80 columns in general :) > /* > @@ -2547,6 +2550,7 @@ > return 0; > } > > +int audiophile_skip_setting_quirk(int iface, int altno); Please make it a static function. > @@ -2585,6 +2589,10 @@ > stream = (get_endpoint(alts, 0)->bEndpointAddress & USB_DIR_IN) ? > SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; > altno = altsd->bAlternateSetting; > + > + /* quirk for audiophile usb: skip AltSets not corresponding to device_setup */ > + if (chip->usb_id == USB_ID(0x0763, 0x2003) && > + audiophile_skip_setting_quirk(iface_no,altno)) continue; Put continue to the next line. @@ -3112,6 +3120,35 @@ return 0; } > +int audiophile_skip_setting_quirk(int iface, int altno) { > + if (device_setup & AUDIOPHILE_SET) { > + if ((device_setup & AUDIOPHILE_SET_DTS) && altno != 6) return 1; Put return to the next line (in other places, too). Thanks, Takashi ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642