From 524ad81cd52d52555d0e6cbaf865f6bb6cfecb25 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Fri, 18 Jan 2019 10:32:04 +0100 Subject: 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 --- 4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) (limited to '4a-hal/4a-hal-controllers') 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", -- cgit 1.2.3-korg