Skip to content

Commit

Permalink
ALSA: usb-audio - Check the dB-range validity in the later read, too
Browse files Browse the repository at this point in the history
commit 9fcd0ab upstream.

When the initial check of dB-range failed due to the read error, try to
check again at the later read, too.  When an invalid dB range is found,
remove TLV flags and notify the mixer info change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Takashi Iwai authored and Greg Kroah-Hartman committed Nov 21, 2011
1 parent d047c6e commit 3485c04
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sound/usb/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3485c04

Please sign in to comment.