summaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
index f44ea6f..cfe921d 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -242,15 +242,23 @@ int HalCtlsHandleOneHalMapObject(AFB_ApiT apiHandle, char *cardId, struct CtlHal
json_object *valueJ, *convertedValueJ = NULL;
+ alsaMap->alsaControlEvent = AFB_EventMake(apiHandle, alsaMap->uid);
+ if(! AFB_EventIsValid(alsaMap->alsaControlEvent)) {
+ AFB_ApiError(apiHandle,
+ "Didn't succeed to create event for halmap ALSA control '%s'",
+ alsaMap->uid);
+ return -1;
+ }
+
if(alsaMap->ctl.alsaCtlCreation) {
if(HalCtlsCreateAlsaCtl(apiHandle, cardId, &alsaMap->ctl)) {
AFB_ApiError(apiHandle, "An error happened when trying to create a new alsa control");
- return -1;
+ return -2;
}
}
else if(HalCtlsUpdateAlsaCtlProperties(apiHandle, cardId, &alsaMap->ctl)) {
AFB_ApiError(apiHandle, "An error happened when trying to get existing alsa control info");
- return -2;
+ return -3;
}
if(alsaMap->ctl.value) {
@@ -260,7 +268,7 @@ int HalCtlsHandleOneHalMapObject(AFB_ApiT apiHandle, char *cardId, struct CtlHal
if(HalCtlsConvertJsonValues(apiHandle, &alsaMap->ctl.alsaCtlProperties, valueJ, &convertedValueJ, CONVERSION_NORMALIZED_TO_ALSACORE)) {
AFB_ApiError(apiHandle, "Error when trying to convert initiate value json '%s'", json_object_get_string(valueJ));
- err = -3;
+ err = -4;
}
else if(HalCtlsSetAlsaCtlValue(apiHandle, cardId, alsaMap->ctl.numid, convertedValueJ)) {
AFB_ApiError(apiHandle,
@@ -268,7 +276,7 @@ int HalCtlsHandleOneHalMapObject(AFB_ApiT apiHandle, char *cardId, struct CtlHal
alsaMap->ctl.numid,
cardId,
json_object_get_string(valueJ));
- err = -4;
+ err = -5;
}
json_object_put(valueJ);
@@ -286,18 +294,10 @@ int HalCtlsHandleOneHalMapObject(AFB_ApiT apiHandle, char *cardId, struct CtlHal
AFB_ApiError(apiHandle,
"Didn't succeed to load action using alsa object:\n-- %s",
json_object_get_string(alsaMap->actionJ));
- return -5;
+ return -6;
}
}
- alsaMap->alsaControlEvent = AFB_EventMake(apiHandle, alsaMap->uid);
- if(! AFB_EventIsValid(alsaMap->alsaControlEvent)) {
- AFB_ApiError(apiHandle,
- "Didn't succeed to create event for current alsa control to load action using alsa object:\n-- %s",
- json_object_get_string(alsaMap->actionJ));
- return -6;
- }
-
if(AFB_ApiAddVerb(apiHandle, alsaMap->uid, alsaMap->info, HalCtlsActionOnAlsaCtl, (void *) alsaMap, NULL, 0, 0)) {
AFB_ApiError(apiHandle,
"Didn't succeed to create verb for current alsa control to load action using alsa object:\n-- %s",