aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alsa-binding/Alsa-SetGet.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/alsa-binding/Alsa-SetGet.c b/alsa-binding/Alsa-SetGet.c
index 9ed316c..a755b02 100644
--- a/alsa-binding/Alsa-SetGet.c
+++ b/alsa-binding/Alsa-SetGet.c
@@ -42,6 +42,7 @@ PUBLIC void NumidsListParse(ActionSetGetT action, queryValuesT *queryValues, ctl
for (int idx = 0; idx < queryValues->count; idx++) {
json_object *jId, *valuesJ;
ctlRequest[idx].used = 0;
+ ctlRequest[idx].tag = NULL;
ctlRequest[idx].valuesJ = NULL;
// when only one NUMID is provided it might not be encapsulated in a JSON array
@@ -101,7 +102,7 @@ PUBLIC void NumidsListParse(ActionSetGetT action, queryValuesT *queryValues, ctl
AFB_NOTICE("Invalid Json=%s missing 'val'", json_object_get_string(ctlRequest[idx].jToken));
ctlRequest[idx].used = -1;
} else
- ctlRequest[idx].valuesJ = valuesJ;
+ ctlRequest[idx].valuesJ = valuesJ;
}
}
break;
@@ -720,7 +721,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
queryJ = alsaCheckQuery(request, &queryValues);
if (!queryJ) goto OnErrorExit;
- // Prase Numids + optional values
+ // Phrase Numids + optional values
done = json_object_object_get_ex(queryJ, "ctl", &numidsJ);
if (!done) queryValues.count = 0;
else {
@@ -769,6 +770,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
ctlCount = snd_ctl_elem_list_get_used(ctlList);
if (queryValues.count == 0) {
ctlRequest = alloca(sizeof (ctlRequestT)*(ctlCount));
+ ctlRequest->tag = NULL;
} else {
ctlRequest = alloca(sizeof (ctlRequestT)*(queryValues.count));
NumidsListParse(action, &queryValues, ctlRequest);
@@ -793,9 +795,14 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
AFB_NOTICE("snd_ctl_elem_list_get_numid index=%d fail", ctlIndex);
continue;
}
+
// check if current control was requested in query numids list
for (jdx = 0; jdx < queryValues.count; jdx++) {
- if (numid == ctlRequest[jdx].numId || ! strcasecmp(tag, ctlRequest[jdx].tag)) {
+
+ if (numid == ctlRequest[jdx].numId ||
+ (ctlRequest[jdx].tag != NULL &&
+ !strcasecmp(tag, ctlRequest[jdx].tag))
+ ) {
ctlRequest[jdx].numId = numid;
selected = 1;
break;