[alsa-devel] usb-audio: I'd like to change two things in usb audio, but I'm not sure if it's right

Johan Aires Rastén johan at oljud.se
Tue Nov 25 08:39:47 CET 2014


Managed to misspell Clemens' address in my previous mail.

On 24 November 2014 at 22:16, Johan Aires Rastén <johan at oljud.se> wrote:

> So I'll try again, this time with the proper cc:s and a second question.
>
> I've come across two issues in the usb audio module that are causing
> problems with my sound card, but I'm thinking that changing them might
> break something for some other card.
>
> In sound/usb/mixer.c function check_input_term(...), for the case
> UAC_INPUT_TERMINAL and UAC_VERSION_2:
>
> The recursive call to get clock selectors messes up the naming of my
> terminals. At this stage the terminals are already properly named Mic and
> Line but the call overwrites them both with the unnamed clock selector
> "Unit 22". Are other UAC2 cards different, so that the clock selector
> contains the correct terminal name, or is there some other reasoning here
> that I'm not seeing?
>
> Could the call be removed, or perhaps only done if no terminal name has
> been found yet?
>
> In sound/usb/stream.c function snd_usb_add_audio_stream(...), near the end
> of the function:
>
> A newly created pcm is added with "list_add(&as->list, &chip->pcm_list);"
> which causes devices to be listed in reverse order, i.e. device 0 will be
> at the end of the list, and this leads to that capture streams end up in
> the wrong device under certain circumstances.
>
> The problem arises when the code under "look for an empty stream" earlier
> in the same function executes. It will attach the capture stream to the
> first compatible existing stream, but since they are reversed it will find
> the highest numbered device. In my case analog input will be grouped with
> digital out (device 1) instead of analog out (device 0).
>
> This is assuming that playback streams are defined before capture streams
> but it could happen in the other direction as long as there are several
> streams of one type.
>
> I also suspect that this is what causes the M-Audio Audiophile USB to have
> swapped inputs, for which there's a fix in USB-Audio.conf (
> http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/USB-Audio.conf#l70
> ). Thanks to debianuser on IRC for helping me find it.
>
> I would like to change this call to use list_add_tail for adding new items
> instead, but I'm worried that there are quirks or other fixes that expect
> the current behaviour. There are very few other references to pcm_list and
> none of them seem to care about ordering.
>
> Sorry for being bad at referencing code, I'm new at this.
>
> //Johan Rastén
>


More information about the Alsa-devel mailing list