diff options
Diffstat (limited to 'alsa-binding/Alsa-SetGet.c')
-rw-r--r-- | alsa-binding/Alsa-SetGet.c | 12 |
1 files changed, 11 insertions, 1 deletions
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; } |