summaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-06 10:15:23 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:57:27 +0200
commitf410a02a35b565de39f247c8ee48e7b98ff78432 (patch)
tree1564e3b44e18472076fcb33fe0c58b421b56074e /4a-hal
parent6adfd2cf4db2da2b1c1ce5b2931d38bbfc05c87e (diff)
Force hals init before ending hal-manager init
Force launched hals initialization before ending hal-manager initialization. This way, external api requiring 'hal-manager' will be sure that all launched hals are initialized. Change-Id: I00b9b14da623828d7cf7bc507873ad6de8ba2391 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c3
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
index 7e771e5..c6fc4d6 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
@@ -95,7 +95,6 @@ static int HalCtlsInitOneApi(AFB_ApiT apiHandle)
// Fill SpecificHalDatadata structure
currentCtlHalData->internal = 1;
- currentCtlHalData->apiName = (char *) ctrlConfig->api;
currentCtlHalData->sndCardPath = (char *) ctrlConfig->uid;
currentCtlHalData->info = (char *) ctrlConfig->info;
@@ -183,6 +182,8 @@ int HalCtlsCreateApi(AFB_ApiT apiHandle, char *path, struct HalMgrData *HalMgrGl
if(! currentCtlHalData)
return -4;
+ currentCtlHalData->apiName = (char *) ctrlConfig->api;
+
// Stores current hal controller data in controller config
ctrlConfig->external = (void *) currentCtlHalData;
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index 19f8e8a..0a75923 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -69,6 +69,7 @@ struct SpecificHalData **HalMngGetFirstHalData(void)
static int HalMgrInitApi(AFB_ApiT apiHandle)
{
+ struct SpecificHalData *currentCtlHalData;
struct HalMgrData *HalMgrGlobalData;
if(! apiHandle)
@@ -85,6 +86,17 @@ static int HalMgrInitApi(AFB_ApiT apiHandle)
if(HalUtlInitializeHalMgrData(apiHandle, HalMgrGlobalData, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO))
return -3;
+ currentCtlHalData = HalMgrGlobalData->first;
+
+ while(currentCtlHalData) {
+ if(! currentCtlHalData->apiName)
+ return -4;
+ else if(AFB_RequireApi(apiHandle, currentCtlHalData->apiName, 1))
+ return -5;
+
+ currentCtlHalData = currentCtlHalData->next;
+ }
+
return 0;
}