summaryrefslogtreecommitdiffstats
path: root/alsa-binding
diff options
context:
space:
mode:
Diffstat (limited to 'alsa-binding')
-rw-r--r--alsa-binding/Alsa-SetGet.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/alsa-binding/Alsa-SetGet.c b/alsa-binding/Alsa-SetGet.c
index 29c82b3..b23e8d7 100644
--- a/alsa-binding/Alsa-SetGet.c
+++ b/alsa-binding/Alsa-SetGet.c
@@ -66,10 +66,8 @@ PUBLIC void NumidsListParse(ActionSetGetT action, queryValuesT *queryValues, ctl
break;
case json_type_string:
- if(action == ACTION_GET) {
- ctlRequest[idx].tag = json_object_get_string(ctlRequest[idx].jToken);
- ctlRequest[idx].numId = 0;
- }
+ ctlRequest[idx].tag = json_object_get_string(ctlRequest[idx].jToken);
+ ctlRequest[idx].numId = 0;
break;
case json_type_array:
@@ -435,25 +433,26 @@ PUBLIC void alsaGetInfo(afb_req_t request) {
json_object *ctlDev, *ctlDevs;
char devid[32];
+ json_object *rqtJ = afb_req_json(request);
const char *rqtSndId = afb_req_value(request, "devid");
const char *rqtDevPath = afb_req_value(request, "devpath");
// if no specific card requested loop on all
- if (rqtSndId != NULL) {
+ if (rqtSndId) {
// only one card was requested let's probe it
ctlDev = alsaCardProbe(rqtSndId, INFO_BY_DEVID);
if (ctlDev != NULL) afb_req_success(request, ctlDev, NULL);
else afb_req_fail_f(request, "sndscard-notfound", "SndCard '%s' Not Found", rqtSndId);
}
- else if (rqtDevPath != NULL) {
+ else if (rqtDevPath) {
// only one card was requested let's probe it
ctlDev = alsaCardProbe(rqtDevPath, INFO_BY_PATH);
if (ctlDev != NULL) afb_req_success(request, ctlDev, NULL);
else afb_req_fail_f(request, "sndscard-notfound", "SndCard '%s' Not Found", rqtSndId);
}
- else {
+ else if (!rqtJ) {
// return an array of ctlDev
ctlDevs = json_object_new_array();
@@ -472,6 +471,9 @@ PUBLIC void alsaGetInfo(afb_req_t request) {
}
afb_req_success(request, ctlDevs, NULL);
}
+ else {
+ afb_req_fail_f(request, "sndscard-notfound", "Invalid request json '%s'", json_object_get_string(rqtJ));
+ }
}
// pack Alsa element's ACL into a JSON object