summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alsa-binding/Alsa-ApiHat.h1
-rw-r--r--alsa-binding/Alsa-SetGet.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/alsa-binding/Alsa-ApiHat.h b/alsa-binding/Alsa-ApiHat.h
index f5feacd..50337db 100644
--- a/alsa-binding/Alsa-ApiHat.h
+++ b/alsa-binding/Alsa-ApiHat.h
@@ -70,6 +70,7 @@ typedef struct {
// use to store crl numid user request
typedef struct {
unsigned int numId;
+ const char *tag;
json_object *jToken;
json_object *valuesJ;
int used;
diff --git a/alsa-binding/Alsa-SetGet.c b/alsa-binding/Alsa-SetGet.c
index 6681415..9ed316c 100644
--- a/alsa-binding/Alsa-SetGet.c
+++ b/alsa-binding/Alsa-SetGet.c
@@ -64,6 +64,13 @@ PUBLIC void NumidsListParse(ActionSetGetT action, queryValuesT *queryValues, ctl
} else
break;
+ case json_type_string:
+ if(action == ACTION_GET) {
+ ctlRequest[idx].tag = json_object_get_string(ctlRequest[idx].jToken);
+ ctlRequest[idx].numId = 0;
+ }
+ break;
+
case json_type_array:
// NUMID is an array 1st slot should be numid, optionally values may come after
length = json_object_array_length(ctlRequest[idx].jToken);
@@ -726,6 +733,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
case json_type_int:
case json_type_object:
+ case json_type_string:
queryValues.count = 1;
queryValues.numidsJ = numidsJ;
break;
@@ -780,13 +788,15 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
jdx = ctlIndex; // map all existing ctl as requested
} else {
int numid = snd_ctl_elem_list_get_numid(ctlList, ctlIndex);
+ const char *tag = snd_ctl_elem_list_get_name(ctlList, ctlIndex);
if (numid < 0) {
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) {
+ if (numid == ctlRequest[jdx].numId || ! strcasecmp(tag, ctlRequest[jdx].tag)) {
+ ctlRequest[jdx].numId = numid;
selected = 1;
break;
}