diff options
-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); |