All of lore.kernel.org
 help / color / mirror / Atom feed
* usb-audio: I'd like to change two things in usb audio, but I'm not sure if it's right
@ 2014-11-24 21:16 Johan Aires Rastén
  2014-11-25  7:39 ` Johan Aires Rastén
  2014-12-05 17:01 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Aires Rastén @ 2014-11-24 21:16 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, clemens, Daniel Mack

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: usb-audio: I'd like to change two things in usb audio, but I'm not sure if it's right
  2014-11-24 21:16 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
@ 2014-11-25  7:39 ` Johan Aires Rastén
  2014-12-05 17:01 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Aires Rastén @ 2014-11-25  7:39 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, clemens, Daniel Mack

Managed to misspell Clemens' address in my previous mail.

On 24 November 2014 at 22:16, Johan Aires Rastén <johan@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
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: usb-audio: I'd like to change two things in usb audio, but I'm not sure if it's right
  2014-11-24 21:16 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
  2014-11-25  7:39 ` Johan Aires Rastén
@ 2014-12-05 17:01 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2014-12-05 17:01 UTC (permalink / raw)
  To: Johan Aires Rastén; +Cc: alsa-devel, clemens, Daniel Mack

At Mon, 24 Nov 2014 22:16:37 +0100,
Johan Aires Rastén 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.

Both points you suggested can't be changed unconditionally,
unfortunately.  These would break the existing configuration.  So, if
any, doing it with some flags or a bit more cleverly.

I guess the latter one should be changed to list_add_tail() as
default, but use list_add() for the dedicated device (Audiophile) so
that it'll keep working with the current alsa-lib config.

The former one is difficult to say; I guess it rather depends on the
firmware which one to pick up.  We may compare two strings and pick up
a better one, too...


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-05 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 21:16 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
2014-11-25  7:39 ` Johan Aires Rastén
2014-12-05 17:01 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.