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

Takashi Sakamoto o-takashi at sakamocchi.jp
Mon Apr 6 04:30:50 CEST 2015


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 at 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



More information about the Alsa-devel mailing list