[alsa-devel] [PATCH] ALSA: usb-audio: Recurse before saving terminal properties

Johan Aires Rastén johan at oljud.se
Sun Sep 6 17:34:23 CEST 2015


On 14 August 2015 at 15:06, Takashi Iwai <tiwai at suse.de> wrote:
> On Wed, 12 Aug 2015 22:14:59 +0200,
> Julian Scheel wrote:
>>
>> When the descriptor parser recurses into the clock source descriptor, the
>> terminals properties, like name and type, are set to the values of the clock
>> selector as check_input_term overwrites term->name and others in the recursive
>> call. As we want to only fill missing values using the descriptors higher in
>> the recursion tree the properties taken from the actual descriptor must be
>> applied after recursing.
>>
>> Signed-off-by: Julian Scheel <julian at jusst.de>
>
> Thanks for the patch.  I vaguely remember of a similar patch, maybe
> you who already sent.  One thing I find uncertain is whether this
> breaks the current logic completely, namely:
>

Maybe that vague memory relates to me asking about this code a while
ago. I never sent any patch though because I couldn't figure out what
the correct behaviour should be. Hats off to Julian for fixing it,
this is a step on the way to get the Asus U7 fully working.

>> @@ -715,15 +715,16 @@ static int check_input_term(struct mixer_build *state, int id,
>>                               term->name = d->iTerminal;
>>                       } else { /* UAC_VERSION_2 */
>>                               struct uac2_input_terminal_descriptor *d = p1;
>> -                             term->type = le16_to_cpu(d->wTerminalType);
>> -                             term->channels = d->bNrChannels;
>> -                             term->chconfig = le32_to_cpu(d->bmChannelConfig);
>> -                             term->name = d->iTerminal;
>>
>>                               /* call recursively to get the clock selectors */
>>                               err = check_input_term(state, d->bCSourceID, term);
>>                               if (err < 0)
>>                                       return err;
>> +
>> +                             term->type = le16_to_cpu(d->wTerminalType);
>> +                             term->channels = d->bNrChannels;
>> +                             term->chconfig = le32_to_cpu(d->bmChannelConfig);
>> +                             term->name = d->iTerminal;
>
> ... by this override, essentially all fields except for id are
> restored.  Then what's the point to call check_input_term() for the
> clock source?
>
> Maybe Daniel can answer better how the original code is supposed to
> work.  Daniel?
>
>
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


More information about the Alsa-devel mailing list