diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-04-18 11:56:09 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-05-24 16:35:06 +0200 |
commit | f64a7ebc9bd85a2bfefd1e966a4f726d3ed48cdc (patch) | |
tree | cb708a2cf7259def1a6b7fd57446f8a17cb05a8c | |
parent | 95e6e5e48296b9fc5e5ded973db125ca34d673c8 (diff) |
Add 'haldependencies' section support.halibut_7.99.1halibut/7.99.17.99.1
Add 'haldependencies' section into handled section table.
Also, add a function to redirect to 'processing' and
to 'handling' functions depending hal initialization stage.
BUG-AGL: SPEC-2329
Change-Id: I4fa09493fecf48844bff171e2e8ca764f9fe8f18
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-api-loader.c | 1 | ||||
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-cb.c | 27 | ||||
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-cb.h | 1 |
3 files changed, 29 insertions, 0 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-api-loader.c b/src/4a-internals-hal/4a-internals-hal-api-loader.c index 839b3a7..68e3bb7 100644 --- a/src/4a-internals-hal/4a-internals-hal-api-loader.c +++ b/src/4a-internals-hal/4a-internals-hal-api-loader.c @@ -39,6 +39,7 @@ // Config Section definition static CtlSectionT ctrlSectionsDefault[] = { + { .key = "haldependencies", .loadCB = InternalHalHalDependenciesConfig }, { .key = "resources", .loadCB = PluginConfig }, { .key = "halmixer", .loadCB = InternalHalHalMixerConfig }, { .key = "onload", .loadCB = OnloadConfig }, diff --git a/src/4a-internals-hal/4a-internals-hal-cb.c b/src/4a-internals-hal/4a-internals-hal-cb.c index f0becf5..ff916ff 100644 --- a/src/4a-internals-hal/4a-internals-hal-cb.c +++ b/src/4a-internals-hal/4a-internals-hal-cb.c @@ -955,6 +955,33 @@ int InternalHalHandleAllHalDependencies(afb_api_t apiHandle, struct InternalHalP return 0; } +int InternalHalHalDependenciesConfig(afb_api_t apiHandle, CtlSectionT *section, json_object *DependenciesJ) +{ + CtlConfigT *ctrlConfig; + struct HalData *currentHalData; + + ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle); + if(! ctrlConfig) + return -1; + + currentHalData = (struct HalData *) getExternalData(ctrlConfig); + if(! currentHalData) + return -2; + + if(DependenciesJ && + InternalHalProcessAllHalDependencies(apiHandle, DependenciesJ, ¤tHalData->internalHalData->probedDevicesList)) { + AFB_API_ERROR(apiHandle, "Failed to process 'haldependencies' section"); + return -3; + } + else if(! DependenciesJ && + (InternalHalHandleAllHalDependencies(apiHandle, ¤tHalData->internalHalData->probedDevicesList)) < 0) { + AFB_API_ERROR(apiHandle, "Failed to handle 'haldependencies' section"); + return -4; + } + + return 0; +} + /******************************************************************************* * Internals HAL verbs functions * ******************************************************************************/ diff --git a/src/4a-internals-hal/4a-internals-hal-cb.h b/src/4a-internals-hal/4a-internals-hal-cb.h index ff35656..bc4979a 100644 --- a/src/4a-internals-hal/4a-internals-hal-cb.h +++ b/src/4a-internals-hal/4a-internals-hal-cb.h @@ -36,6 +36,7 @@ void InternalHalDispatchApiEvent(afb_api_t apiHandle, const char *evtLabel, json // Internals HAL sections parsing functions int InternalHalHalMixerConfig(afb_api_t apiHandle, CtlSectionT *section, json_object *MixerJ); int InternalHalHalMapConfig(afb_api_t apiHandle, CtlSectionT *section, json_object *AlsaMapJ); +int InternalHalHalDependenciesConfig(afb_api_t apiHandle, CtlSectionT *section, json_object *DependenciesJ); // Internals HAL verbs functions void InternalHalInfo(afb_req_t request); |