2010/6/17 Takashi Iwai tiwai@suse.de
At Thu, 17 Jun 2010 08:35:54 +0800, Raymond Yau wrote:
2010/5/25 Clemens Ladisch clemens@ladisch.de
James Courtier-Dutton wrote:
On 25 May 2010 09:38, Clemens Ladisch clemens@ladisch.de wrote:
All the others seem to be mistakes:
soc/codecs/stac9766.c:... soc/codecs/wm8350.c:... soc/codecs/wm8400.c:... soc/codecs/wm8990.c:...
Could this maybe explain why pulseaudio was having such problems with alsa with regards to gain controls????
Only if it happens on embedded hardware that uses these particular codecs.
Regards, Clemens
http://git.alsa-project.org/?p=alsa-utils.git;a=commit;h=c9b86f49a8a1a8c337b...
your patch did not fix the buggy driver (e.g. alsa-pulse plugin) which return volume outside the alllowed range
amixer -D pulse Simple mixer control 'Master',0 Capabilities: pvolume pswitch pswitch-joined Playback channels: Front Left - Front Right Limits: Playback 0 - 65536 Mono: Front Left: Playback 98304 [150%] [on] Front Right: Playback 98304 [150%] [on]
Should snd_mixer_selem_get_playback_volume() perform range check ?
tatic int get_volume_ops(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value) { selem_none_t *s = snd_mixer_elem_get_private(elem); if (s->selem.caps & SM_CAP_GVOLUME) dir = SM_PLAY; if ((unsigned int) channel >= s->str[dir].channels) return -EINVAL; *value = s->str[dir].vol[channel];
if (*value > s->str[dir].max)
return -EINVAL;
if (*value < s->str[dir].min)
return 0;return -EINVAL;
Some sanity check would be nice, but returning -EINVAL here isn't correct, at least. -EINVAL should be returned when the caller gives a wrong value (e.g. a wrong channel value).
-ERANGE "result too large" seem to be the correct error code when value > max
amixer like the other mixer application assume snd_mixer_selem_get_playback_volume() won't fail so it is still cannot solve the problem
since the bug is PA server return a value which is outside the range declared by ctl_pulse.c