[alsa-devel] Lost dB volumes on USB headset between 2.6.38 and 3.0

Raymond Yau superquad.vortex2 at gmail.com
Tue Aug 23 05:02:23 CEST 2011


2011/8/19 Takashi Iwai <tiwai at suse.de>:
> At Fri, 19 Aug 2011 07:53:44 +0200,
> Takashi Iwai wrote:
>>
>>
>> Yeah, that's a known problem.  The dB-test is missing when reading dB
>> failed at probing time and later it gives a wrong value.
>>
>> We can add another dB-test later, and remove TLV bit from
>> kcontrol.access on the fly.  But for that, we'd need to notify via
>> SNDRV_CTL_EVENT_MASK_INFO, too.
>
> I meant something like below.
>
>
> Takashi
>
> ---
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index cdd19d7..78a5abd 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -881,8 +881,17 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
>                uinfo->value.integer.min = 0;
>                uinfo->value.integer.max = 1;
>        } else {
> -               if (! cval->initialized)
> -                       get_min_max(cval,  0);
> +               if (!cval->initialized) {
> +                       get_min_max(cval, 0);
> +                       if (cval->initialized && cval->dBmin >= cval->dBmax) {
> +                               kcontrol->vd[0].access &=
> +                                       ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ |
> +                                         SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK);
> +                               snd_ctl_notify(cval->mixer->chip->card,
> +                                              SNDRV_CTL_EVENT_MASK_INFO,
> +                                              &kcontrol->id);
> +                       }
> +               }
>                uinfo->value.integer.min = 0;
>                uinfo->value.integer.max =
>                        (cval->max - cval->min + cval->res - 1) / cval->res;
>

I have doubt about this removal of tlv is enough since values of dB
scale are calculated from min and max of the control , as dBmin >=
dBmax imply min >= max and the control already has a invalid range and
unusable


More information about the Alsa-devel mailing list