aboutsummaryrefslogtreecommitdiffstats
path: root/Controller-afb
diff options
context:
space:
mode:
Diffstat (limited to 'Controller-afb')
-rw-r--r--Controller-afb/CMakeLists.txt5
-rw-r--r--Controller-afb/README.md2
-rw-r--r--Controller-afb/ctl-binding.c7
-rw-r--r--Controller-afb/ctl-dispatch.c4
-rw-r--r--Controller-afb/ctl-lua.c7
5 files changed, 15 insertions, 10 deletions
diff --git a/Controller-afb/CMakeLists.txt b/Controller-afb/CMakeLists.txt
index d1eb886..c7602f8 100644
--- a/Controller-afb/CMakeLists.txt
+++ b/Controller-afb/CMakeLists.txt
@@ -16,7 +16,7 @@
# limitations under the License.
###########################################################################
-ADD_COMPILE_OPTIONS(-DCONTROL_ONLOAD_DEFAULT="onload-default")
+ADD_COMPILE_OPTIONS(-DCONTROL_ONLOAD_PROFILE="onload-default-profile")
ADD_COMPILE_OPTIONS(-DCONTROL_DOSCRIPT_PRE="doscript")
ADD_COMPILE_OPTIONS(-DCONTROL_CONFIG_PRE="onload")
@@ -57,9 +57,6 @@ PROJECT_TARGET_ADD(control-afb)
${link_libraries}
)
- # installation directory
- INSTALL(TARGETS ${TARGET_NAME}
- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} )
PROJECT_TARGET_ADD(audio-plugin-sample)
diff --git a/Controller-afb/README.md b/Controller-afb/README.md
index e6cab72..9bab485 100644
--- a/Controller-afb/README.md
+++ b/Controller-afb/README.md
@@ -30,7 +30,7 @@ Each bloc in the configuration file are defined with
* info: optional used for documentation purpose only
Note by default controller config search path is defined at compilation time, but path might be overloaded with CONTROL_CONFIG_PATH
-environment variable.
+environment variable. Setenv 'CONTROL_ONLOAD_PROFILE'=xxxx to overload 'onload-default-profile' initialisation sequence.
### Config is organised in 4 sections:
diff --git a/Controller-afb/ctl-binding.c b/Controller-afb/ctl-binding.c
index 8771fc0..ec33f82 100644
--- a/Controller-afb/ctl-binding.c
+++ b/Controller-afb/ctl-binding.c
@@ -55,9 +55,12 @@ PUBLIC int CtlBindingInit () {
errcount += LuaLibInit();
#endif
+ const char *profile= getenv("CONTROL_ONLOAD_PROFILE");
+ if (!profile) profile=CONTROL_ONLOAD_PROFILE;
+
// now that everything is initialised execute the onload action
- if (!errcount)
- errcount += DispatchOnLoad(CONTROL_ONLOAD_DEFAULT);
+ if (!errcount)
+ errcount += DispatchOnLoad(CONTROL_ONLOAD_PROFILE);
AFB_DEBUG ("Audio Policy Control Binding Done errcount=%d", errcount);
return errcount;
diff --git a/Controller-afb/ctl-dispatch.c b/Controller-afb/ctl-dispatch.c
index 1708204..0104229 100644
--- a/Controller-afb/ctl-dispatch.c
+++ b/Controller-afb/ctl-dispatch.c
@@ -178,6 +178,8 @@ PUBLIC void DispatchOneEvent(const char *evtLabel, json_object *eventJ) {
// Event name is mapped on control label and executed as a standard control
PUBLIC int DispatchOnLoad(const char *onLoadLabel) {
+ if (!configHandle) return 1;
+
DispatchHandleT **onloads = configHandle->onloads;
int err = DispatchOneControl(CTL_SOURCE_ONLOAD, onloads, onLoadLabel, NULL, NULL_AFBREQ);
@@ -650,7 +652,7 @@ PUBLIC int DispatchInit() {
// no dispatch config found remove control API from binder
if (!luaLoaded) {
- AFB_WARNING("DISPATCH-INIT:WARNING Not Found Control dispatch file [%s]", controlFile);
+ AFB_WARNING("DISPATCH-INIT:WARNING (setenv CONTROL_CONFIG_PATH) No Config '%s-*.json' in '%s'", controlFile, dirList);
}
AFB_NOTICE("DISPATCH-INIT:SUCCES: Audio Control Dispatch Init");
diff --git a/Controller-afb/ctl-lua.c b/Controller-afb/ctl-lua.c
index 4ef6b65..3f45055 100644
--- a/Controller-afb/ctl-lua.c
+++ b/Controller-afb/ctl-lua.c
@@ -965,7 +965,10 @@ PUBLIC int LuaLibInit () {
strncat (fullprefix, GetBinderName(), sizeof(fullprefix));
strncat (fullprefix, "-", sizeof(fullprefix));
- json_object *luaScriptPathJ = ScanForConfig(CONTROL_LUA_PATH , CTL_SCAN_RECURSIVE, fullprefix, "lua");
+ const char *dirList= getenv("CONTROL_LUA_PATH");
+ if (!dirList) dirList=CONTROL_LUA_PATH;
+
+ json_object *luaScriptPathJ = ScanForConfig(dirList , CTL_SCAN_RECURSIVE, fullprefix, "lua");
// open a new LUA interpretor
luaState = luaL_newstate();
@@ -1021,7 +1024,7 @@ PUBLIC int LuaLibInit () {
// no policy config found remove control API from binder
if (index == 0) {
- AFB_WARNING ("POLICY-INIT:WARNING No Control LUA file in path=[%s]", CONTROL_LUA_PATH);
+ AFB_WARNING ("POLICY-INIT:WARNING (setenv CONTROL_LUA_PATH) No LUA '%s*.lua' in '%s'", fullprefix, dirList);
}
AFB_DEBUG ("Audio control-LUA Init Done");