diff options
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-alsacore-link.c | 5 | ||||
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-alsacore-link.h | 15 | ||||
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-cb.c | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-alsacore-link.c b/src/4a-internals-hal/4a-internals-hal-alsacore-link.c index 130cea5..bb1c4c9 100644 --- a/src/4a-internals-hal/4a-internals-hal-alsacore-link.c +++ b/src/4a-internals-hal/4a-internals-hal-alsacore-link.c @@ -110,7 +110,10 @@ int InternalHalSubscribeToAlsaCardEvent(afb_api_t apiHandle, char *cardId) json_object *subscribeQueryJ, *responseJ = NULL; - wrapRet = wrap_json_pack(&subscribeQueryJ, "{s:s}", "devid", cardId); + wrapRet = wrap_json_pack(&subscribeQueryJ, + "{s:s, s:s}", + "event", ALSACORE_CARD_CONTROL_EVENT_NAME, + "devid", cardId); if(wrapRet) { AFB_API_ERROR(apiHandle, "Didn't succeed to allocate subscription query json object"); return -1; diff --git a/src/4a-internals-hal/4a-internals-hal-alsacore-link.h b/src/4a-internals-hal/4a-internals-hal-alsacore-link.h index 03af081..dccf266 100644 --- a/src/4a-internals-hal/4a-internals-hal-alsacore-link.h +++ b/src/4a-internals-hal/4a-internals-hal-alsacore-link.h @@ -30,12 +30,15 @@ #include "4a-hal-utilities-alsa-data.h" -#define ALSACORE_API "alsacore" -#define ALSACORE_SUBSCRIBE_VERB "subscribe" -#define ALSACORE_GETINFO_VERB "infoget" -#define ALSACORE_CTLGET_VERB "ctlget" -#define ALSACORE_CTLSET_VERB "ctlset" -#define ALSACORE_ADDCTL_VERB "addcustomctl" +#define ALSACORE_API "alsacore" + +#define ALSACORE_SUBSCRIBE_VERB "subscribe" +#define ALSACORE_GETINFO_VERB "infoget" +#define ALSACORE_CTLGET_VERB "ctlget" +#define ALSACORE_CTLSET_VERB "ctlset" +#define ALSACORE_ADDCTL_VERB "addcustomctl" + +#define ALSACORE_CARD_CONTROL_EVENT_NAME "controls" // Alsa control types map from string function snd_ctl_elem_type_t InternalHalMapsAlsaTypeToEnum(const char *label); diff --git a/src/4a-internals-hal/4a-internals-hal-cb.c b/src/4a-internals-hal/4a-internals-hal-cb.c index cc8fea5..a81871c 100644 --- a/src/4a-internals-hal/4a-internals-hal-cb.c +++ b/src/4a-internals-hal/4a-internals-hal-cb.c @@ -67,7 +67,7 @@ void InternalHalDispatchApiEvent(afb_api_t apiHandle, const char *evtLabel, json if(evtLabel[idx] != '\0' && (sscanf(&evtLabel[idx + 1], "%d", &cardidx) == 1)) { - if(wrap_json_unpack(eventJ, "{s:i s:o !}", "id", &numid, "val", &valuesJ)) { + if(wrap_json_unpack(eventJ, "{s:i s:o}", "id", &numid, "val", &valuesJ)) { AFB_API_ERROR(apiHandle, "Invalid alsacore event received label=%s value=%s", evtLabel, |