* [PATCH] alsa-utils: amixer: Fix SND_CTL_TLVT_DB_RANGE handling
@ 2011-06-16 12:19 Lars-Peter Clausen
2011-06-16 12:58 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2011-06-16 12:19 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Lars-Peter Clausen
Current support for handling SND_CTL_TLVT_DB_RANGE in amixer is completely
broken. This patch fixes it.
Reported-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
amixer/amixer.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/amixer/amixer.c b/amixer/amixer.c
index a177288..9d2855d 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -517,20 +517,20 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
#ifdef SND_CTL_TLVT_DB_RANGE
case SND_CTL_TLVT_DB_RANGE:
printf("dBrange-\n");
- if ((size / (6 * sizeof(unsigned int))) != 0) {
+ if ((size % (6 * sizeof(unsigned int))) != 0) {
while (size > 0) {
printf("0x%08x,", tlv[idx++]);
size -= sizeof(unsigned int);
}
break;
}
- idx = 0;
- while (idx < size) {
+ while (size > 0) {
print_spaces(spaces + 2);
- printf("rangemin=%i,", tlv[0]);
- printf(",rangemax=%i\n", tlv[1]);
- decode_tlv(spaces + 4, tlv + 2, 6 * sizeof(unsigned int));
- idx += 6 * sizeof(unsigned int);
+ printf("rangemin=%i,", tlv[idx++]);
+ printf(",rangemax=%i\n", tlv[idx++]);
+ decode_tlv(spaces + 4, tlv + idx, 4 * sizeof(unsigned int));
+ idx += 4;
+ size -= 6 * sizeof(unsigned int);
}
break;
#endif
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] alsa-utils: amixer: Fix SND_CTL_TLVT_DB_RANGE handling
2011-06-16 12:19 [PATCH] alsa-utils: amixer: Fix SND_CTL_TLVT_DB_RANGE handling Lars-Peter Clausen
@ 2011-06-16 12:58 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-06-16 12:58 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel
At Thu, 16 Jun 2011 14:19:18 +0200,
Lars-Peter Clausen wrote:
>
> Current support for handling SND_CTL_TLVT_DB_RANGE in amixer is completely
> broken. This patch fixes it.
>
> Reported-by: Daniel Mack <zonque@gmail.com>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Thanks, applied now.
Takashi
> ---
> amixer/amixer.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/amixer/amixer.c b/amixer/amixer.c
> index a177288..9d2855d 100644
> --- a/amixer/amixer.c
> +++ b/amixer/amixer.c
> @@ -517,20 +517,20 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
> #ifdef SND_CTL_TLVT_DB_RANGE
> case SND_CTL_TLVT_DB_RANGE:
> printf("dBrange-\n");
> - if ((size / (6 * sizeof(unsigned int))) != 0) {
> + if ((size % (6 * sizeof(unsigned int))) != 0) {
> while (size > 0) {
> printf("0x%08x,", tlv[idx++]);
> size -= sizeof(unsigned int);
> }
> break;
> }
> - idx = 0;
> - while (idx < size) {
> + while (size > 0) {
> print_spaces(spaces + 2);
> - printf("rangemin=%i,", tlv[0]);
> - printf(",rangemax=%i\n", tlv[1]);
> - decode_tlv(spaces + 4, tlv + 2, 6 * sizeof(unsigned int));
> - idx += 6 * sizeof(unsigned int);
> + printf("rangemin=%i,", tlv[idx++]);
> + printf(",rangemax=%i\n", tlv[idx++]);
> + decode_tlv(spaces + 4, tlv + idx, 4 * sizeof(unsigned int));
> + idx += 4;
> + size -= 6 * sizeof(unsigned int);
> }
> break;
> #endif
> --
> 1.7.2.5
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-16 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-16 12:19 [PATCH] alsa-utils: amixer: Fix SND_CTL_TLVT_DB_RANGE handling Lars-Peter Clausen
2011-06-16 12:58 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox