diff options
-rw-r--r-- | AlsaSound/CoreBinding/AlsaCtlSetGet.c | 11 | ||||
-rw-r--r-- | README.md | 13 |
2 files changed, 16 insertions, 8 deletions
diff --git a/AlsaSound/CoreBinding/AlsaCtlSetGet.c b/AlsaSound/CoreBinding/AlsaCtlSetGet.c index cd21724..a41e390 100644 --- a/AlsaSound/CoreBinding/AlsaCtlSetGet.c +++ b/AlsaSound/CoreBinding/AlsaCtlSetGet.c @@ -579,9 +579,11 @@ STATIC int alsaGetSingleCtl (snd_ctl_t *ctlDev, snd_ctl_elem_id_t *elemId, ctlRe snd_ctl_elem_value_alloca(&elemData); snd_ctl_elem_value_set_id(elemData, elemId); // map ctlInfo to ctlId elemInfo is updated !!! if (snd_ctl_elem_read(ctlDev, elemData) < 0) goto OnErrorExit; + + int numid= snd_ctl_elem_info_get_numid(elemInfo); ctlRequest->jValues= json_object_new_object(); - json_object_object_add (ctlRequest->jValues,"id" , ctlRequest->jToken); + json_object_object_add (ctlRequest->jValues,"id" , json_object_new_int(numid)); if (quiet < 2) json_object_object_add (ctlRequest->jValues,"name" , json_object_new_string(snd_ctl_elem_id_get_name (elemId))); if (quiet < 1) json_object_object_add (ctlRequest->jValues,"iface" , json_object_new_string(snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(elemId)))); if (quiet < 3) json_object_object_add (ctlRequest->jValues,"actif", json_object_new_boolean(!snd_ctl_elem_info_is_inactive(elemInfo))); @@ -723,14 +725,14 @@ PUBLIC void alsaSetGetCtls (struct afb_req request, ActionSetGetT action) { } else { ctlRequest= alloca (sizeof(ctlRequestT)*(queryValues.count)); NumidsListParse (&queryValues, ctlRequest); - } - + } + // Loop on all ctlDev controls for (int ctlIndex=0; ctlIndex < ctlCount; ctlIndex++) { unsigned int selected=0; int jdx; - if (queryValues.count == 0) { + if (queryValues.count == 0 && action == ACTION_GET) { selected=1; // check is this numid is selected within query jdx = ctlIndex; // map all existing ctl as requested } else { @@ -795,6 +797,7 @@ PUBLIC void alsaSetGetCtls (struct afb_req request, ActionSetGetT action) { } if (json_object_array_length(warnings)) warmsg=json_object_to_json_string_ext(warnings, JSON_C_TO_STRING_PLAIN); + else json_object_put(warnings); // send response+warning if any afb_req_success (request, sndctls, warmsg); @@ -1,23 +1,28 @@ ------------------------------------------------------------------------ AGL-AudioBindings expose ALSA, Pulse & Most APIs through AGL framework ------------------------------------------------------------------------ - +http://www.linuxjournal.com/node/6735/print +http://equalarea.com/paul/alsa-audio.html +http://mpd.wikia.com/wiki/Alsa +http://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume AFB_daemon dependency on Standard Linux Distributions ------------------------------------------------------- # handle dependencies > (OpenSuse-42.2, Fedora-25, Ubuntu 16.04.2LTS) gcc > 4.8 systemd-devel (libsystemd-dev>=222) - libopenssl-devel uuid-devel - file-devel (libmagic-dev) + file-devel(OpenSuSe) or libmagic-dev(Ubuntu) libjson-c-devel alsa-devel ElectricFence (BUG should not be mandatory) + libopenssl-devel libgcrypt-devel libgnutls-devel (optional but requested by libmicrohttpd for https) OpenSuse >=42.2 - zypper in gcc5 gdb gcc5-c++ cmake ElectricFence systemd-devel libopenssl-devel uuid-devel file-devel alsa-devel + zypper in gcc5 gdb gcc5-c++ cmake ElectricFence systemd-devel libopenssl-devel uuid-devel alsa-devel libgcrypt-devel libgnutls-devel libjson-c-devel file-devel + Ubuntu >= 16.4 + apt-get install cmake electric-fence libsystemd-dev libssl-dev uuid-dev libasound2-dev libgcrypt20-dev libgnutls-dev libgnutls-dev libjson-c-dev libmagic-dev libmicrohttpd with AGL patches http://iot.bzh/download/public/2016/appfw/libmicrohttpd-0.9.49-agl.tgz afb-daemon from AGL Gerrit git clone https://gerrit.automotivelinux.org/gerrit/src/app-framework-binder |