public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* [PATCH/alsa-lib] amixer: fix 'cset' operation to set several channels
@ 2015-04-06  2:30 Takashi Sakamoto
  2015-04-06  2:33 ` [PATCH/alsa-utils] " Takashi Sakamoto
  2015-04-06  7:13 ` [PATCH/alsa-lib] " Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2015-04-06  2:30 UTC (permalink / raw)
  To: tiwai, perex; +Cc: alsa-devel

For an enumerated element with several channels, when given comma-separated
string values, 'cset' operation sets these values just to the first channel,
instead of corresponding channels.

This commit adds missing-increment to fix this bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 amixer/amixer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/amixer/amixer.c b/amixer/amixer.c
index 36c92eb..e9fe735 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -1290,8 +1290,10 @@ static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
 			if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0)
 				check_flag = 1;
 			/* skip separators */
-			while (*ptr == ',' || isspace(*ptr))
+			while (*ptr == ',' || isspace(*ptr)) {
 				ptr++;
+				chn++;
+			}
 		}
 	}
 	return check_flag;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH/alsa-utils] amixer: fix 'cset' operation to set several channels
  2015-04-06  2:30 [PATCH/alsa-lib] amixer: fix 'cset' operation to set several channels Takashi Sakamoto
@ 2015-04-06  2:33 ` Takashi Sakamoto
  2015-04-06  7:13 ` [PATCH/alsa-lib] " Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2015-04-06  2:33 UTC (permalink / raw)
  To: tiwai, perex; +Cc: alsa-devel

 > [PATCH/alsa-lib] amixer: fix 'cset' operation to set several channels

Oops. This patch is for alsa-utils, sorry...

On Apr 06 2015 11:30, Takashi Sakamoto wrote:
> For an enumerated element with several channels, when given comma-separated
> string values, 'cset' operation sets these values just to the first channel,
> instead of corresponding channels.
>
> This commit adds missing-increment to fix this bug.
>
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
>   amixer/amixer.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/amixer/amixer.c b/amixer/amixer.c
> index 36c92eb..e9fe735 100644
> --- a/amixer/amixer.c
> +++ b/amixer/amixer.c
> @@ -1290,8 +1290,10 @@ static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
>   			if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0)
>   				check_flag = 1;
>   			/* skip separators */
> -			while (*ptr == ',' || isspace(*ptr))
> +			while (*ptr == ',' || isspace(*ptr)) {
>   				ptr++;
> +				chn++;
> +			}
>   		}
>   	}
>   	return check_flag;
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/alsa-lib] amixer: fix 'cset' operation to set several channels
  2015-04-06  2:30 [PATCH/alsa-lib] amixer: fix 'cset' operation to set several channels Takashi Sakamoto
  2015-04-06  2:33 ` [PATCH/alsa-utils] " Takashi Sakamoto
@ 2015-04-06  7:13 ` Takashi Iwai
  2015-04-06  7:42   ` [PATCH/alsa-utils] " Takashi Sakamoto
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2015-04-06  7:13 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel

At Mon,  6 Apr 2015 11:30:50 +0900,
Takashi Sakamoto wrote:
> 
> For an enumerated element with several channels, when given comma-separated
> string values, 'cset' operation sets these values just to the first channel,
> instead of corresponding channels.
> 
> This commit adds missing-increment to fix this bug.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Did you really test this patch...?

amixer.c: In function ‘sset_enum’:
amixer.c:1295:5: error: ‘chn’ undeclared (first use in this function)
	  

Takashi

> ---
>  amixer/amixer.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/amixer/amixer.c b/amixer/amixer.c
> index 36c92eb..e9fe735 100644
> --- a/amixer/amixer.c
> +++ b/amixer/amixer.c
> @@ -1290,8 +1290,10 @@ static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
>  			if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0)
>  				check_flag = 1;
>  			/* skip separators */
> -			while (*ptr == ',' || isspace(*ptr))
> +			while (*ptr == ',' || isspace(*ptr)) {
>  				ptr++;
> +				chn++;
> +			}
>  		}
>  	}
>  	return check_flag;
> -- 
> 2.1.0
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/alsa-utils] amixer: fix 'cset' operation to set several channels
  2015-04-06  7:13 ` [PATCH/alsa-lib] " Takashi Iwai
@ 2015-04-06  7:42   ` Takashi Sakamoto
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2015-04-06  7:42 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Apr 06 2015 16:13, Takashi Iwai wrote:
> At Mon,  6 Apr 2015 11:30:50 +0900,
> Takashi Sakamoto wrote:
>>
>> For an enumerated element with several channels, when given comma-separated
>> string values, 'cset' operation sets these values just to the first channel,
>> instead of corresponding channels.
>>
>> This commit adds missing-increment to fix this bug.
>>
>> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
>
> Did you really test this patch...?
>
> amixer.c: In function ‘sset_enum’:
> amixer.c:1295:5: error: ‘chn’ undeclared (first use in this function)

I workd on 6f9835f. After testing, rebase to current master. Then I 
missed 1a19ec1. I should have compile again in this tree. (missing 
enough caution...)

Well, I think the 1a19ec1 still includes a bug. It cannot parse this 
option correctly.

$ amixer sset enum-element-13,1019 A,B,,D

In this case, no values should be set to the third channel of the 
element. But current implementation set D to the channel and the last 
channel is not changed.

I'll post a new patch, later.


Thanks for your indication.

Takashi Sakamoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-06  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-06  2:30 [PATCH/alsa-lib] amixer: fix 'cset' operation to set several channels Takashi Sakamoto
2015-04-06  2:33 ` [PATCH/alsa-utils] " Takashi Sakamoto
2015-04-06  7:13 ` [PATCH/alsa-lib] " Takashi Iwai
2015-04-06  7:42   ` [PATCH/alsa-utils] " Takashi Sakamoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox