From 32b4b5c0c5e4193dc215898814b6d9ff0c1059b7 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Wed, 31 Oct 2018 17:08:41 +0100 Subject: Force each hal to have its own ctl section data Force each hal api to have its own controller section data, it is very usefull if different hals don't have the same onload/events/... actions. Change-Id: Iaf3c2059a774ef8ec4f7262064d1cfa8d8159d91 Signed-off-by: Jonathan Aillet --- 4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to '4a-hal/4a-hal-controllers') 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 7baa22c..292bcd8 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 @@ -42,7 +42,7 @@ AFB_ApiT AFB_default; ******************************************************************************/ // Config Section definition -static CtlSectionT ctrlSections[] = +static CtlSectionT ctrlSectionsDefault[] = { { .key = "resources", .loadCB = PluginConfig }, { .key = "halmixer", .loadCB = HalCtlsHalMixerConfig }, @@ -121,6 +121,7 @@ static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle) { int err; CtlConfigT *ctrlConfig; + CtlSectionT *ctrlCurrentSections; if(! cbdata || ! apiHandle) return -1; @@ -136,8 +137,11 @@ static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle) return 1; } + ctrlCurrentSections = malloc(sizeof(ctrlSectionsDefault)); + memcpy(ctrlCurrentSections, ctrlSectionsDefault, sizeof(ctrlSectionsDefault)); + // Load section for corresponding Api - if((err = CtlLoadSections(apiHandle, ctrlConfig, ctrlSections))) + if((err = CtlLoadSections(apiHandle, ctrlConfig, ctrlCurrentSections))) return err; // Declare an event manager for this Api -- cgit 1.2.3-korg