summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-01-18 10:32:04 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-01-28 15:38:58 +0100
commit524ad81cd52d52555d0e6cbaf865f6bb6cfecb25 (patch)
treea3f9a06869231d6a88671f494ac09729fb6e819f /4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
parent9ea8f82f17fa57a0648eb9b16d24957bba22f9f2 (diff)
Create 'halmap' ALSA controls events earlier
Create 'halmap' ALSA controls events earlier to avoid errors at 4a-hal-generic binder startup. Change-Id: I5976f5d4c358b21108ec136f791841b4ea15c666 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c')
-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",