alsa/0021-control-Allow-cset-ing-specific-values-in-the-multi-.patch
Stanislav Brabec 8cda421087 Accepting request 312533 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes: fix bogus assert() in hw_params, a few
  PCM dmix/dshare/dsnoop fixes, enhacement of amixer, etc:
  0017-test-pcm-Fix-generated-values-with-float-PCM-format.patch
  0018-test-pcm_min-Fix-error-messages.patch
  0019-pcm-Don-t-assert-in-_snd_pcm_hw_params_internal.patch
  0020-pcm-Fix-snd_pcm_status-for-dmix-co.patch
  0021-control-Allow-cset-ing-specific-values-in-the-multi-.patch
  0022-PCM-snd_pcm_xxxx_drain-maybe-blocked-after-suspend-a.patch

OBS-URL: https://build.opensuse.org/request/show/312533
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=183
2015-06-18 18:33:24 +00:00

41 lines
1.2 KiB
Diff

From 2fd098b587e8e5137c05ea6248c2aa87294e13c2 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 10 Jun 2015 11:56:23 +0200
Subject: [PATCH] control: Allow cset'ing specific values in the multi-value
case
Improve the parser to allow empty elements followed by a comma.
Now amixer works like below for setting only the third element.
% amixer cset 'IIR1 Band1' ,,200
Reported-and-tested-by: Arun Raghavan <arun@accosted.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/control/ctlparse.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c
index 8d6c3859bec4..877a05e3a1f1 100644
--- a/src/control/ctlparse.c
+++ b/src/control/ctlparse.c
@@ -325,6 +325,8 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
snd_ctl_elem_value_set_id(dst, myid);
for (idx = 0; idx < count && idx < 128 && ptr && *ptr; idx++) {
+ if (*ptr == ',')
+ goto skip;
switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
tmp = 0;
@@ -375,6 +377,7 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
default:
break;
}
+ skip:
if (!strchr(value, ','))
ptr = value;
else if (*ptr == ',')
--
2.4.3