From: Takashi Iwai Subject: Re: Patch usb-audio: I need guidelines Date: Fri, 24 Feb 2006 19:39:13 +0100 Message-ID: References: <012201c63709$bcfd0650$a578e4a0@supelec.fr> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mx1.suse.de (mx1.suse.de [195.135.220.2]) by alsa.jcu.cz (ALSA's E-mail Delivery System) with ESMTP id B7E7F1CE for ; Fri, 24 Feb 2006 19:39:23 +0100 (MET) In-Reply-To: <012201c63709$bcfd0650$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@alsa-project.org List-Id: alsa-devel@alsa-project.org At Tue, 21 Feb 2006 18:10:34 +0100, Thibault LE MEUR wrote: > > Hi Alsa-Gurus, > > I've found how to patch the snd-usb-audio driver in order to get the > Audiophile_USB analog capture to work. This device uses different > synchronization methods whether the the SPDIF input is connected or not. > > This information should be given by the user at driver-loading-time and thus > I need a new init parameter for the snd-usb-audio module: I know that this > could be a blocking point, but please read below in order to see how I try > to make this patch "non-intrusive". > > I've already designed an ugly patch that is working but I'd like to make it > clean before publishing it. Could you please give me comments and/or advice > on the following description ? > > This is how I think things _could_ be done: > * add a new parameter called "device_setup" (integer) > - this parameter uses a generic name, so that it could be used by any > subsequent devices (well..., only if needed of course) > - the parameter bits signification depends on the USB_ID for the device > > * if this parameter is not given, the _default_value_0x00_does_nothing_new_ > (returns to previous behaviour) > - This will ensure that no setup modification is needed for current happy > Audiophile_USB users ;-) > > * use constants to name each significant bit of this parameter > - "#defines" could go to "usbquirks.h" (for instance "#define > AUDIOPHILE_SET_DIGITAL_INPUT 0x04"). Or is there a better include file? > - Are they any naming convention for these device specific constants? > > * I am currently only using the least significant 8bits of the "int" value, > do you think an 'int' is enough to cover _would-be_ future needs? (I know > that this question seems stupid since no one but me has asked for such a > parameter ;-) but anyway I think it is worth asking) > > * for Audiophile_USB, I need to patch "parse-audio-endpoints": > - I have seen a "case USB_ID" section with existing quirks and would > integrate my patch in the already existing Audiophile_USB subsection > > Is everything described above sounds good? Reading the above, I feel creating a new driver would be cleaner rather than adding tons of workarounds for special cases. It could use most of functions in usb*.c. I don't know what change you need in parse_audio_endpoints(), but if it's complicated, it'd be better to make a change more generic. For example, we can add a hook as the argument to this function. It's a function pointer which is called in the place where many USB_ID checks are for overriding with device-speicific values. Just my $0.02. 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