From c13952824e2cc110b9405e1bc9017801dd938ac0 Mon Sep 17 00:00:00 2001 From: fulup Date: Fri, 11 Aug 2017 08:18:05 +0200 Subject: Update to new Tempate --- Controler-afb/CMakeLists.txt | 6 +- Controler-afb/ctl-binding.h | 7 +- Controler-afb/ctl-dispatch.c | 71 +++++----- Controler-afb/ctl-lua.c | 106 +++++++-------- Controler-afb/ctl-plugin-sample.c | 40 +++--- conf.d/CMakeLists.txt | 26 ++++ conf.d/alsa-sample/asoundrc.sample | 160 +++++++++++++++++++++++ conf.d/alsa-sample/ucm.sample/HDA Intel PCH.conf | 6 + conf.d/alsa-sample/ucm.sample/HiFi.conf | 84 ++++++++++++ conf.d/alsa-sample/ucm.sample/README | 2 + conf.d/alsa/asoundrc.sample | 160 ----------------------- conf.d/alsa/ucm.sample/HDA Intel PCH.conf | 6 - conf.d/alsa/ucm.sample/HiFi.conf | 84 ------------ conf.d/alsa/ucm.sample/README | 2 - conf.d/app-templates | 2 +- conf.d/cmake/config.cmake | 12 +- conf.d/ctl-rules/CMakeLists.txt | 44 +++++++ conf.d/ctl-rules/helloworld-lua-script.lua | 41 ++++++ conf.d/ctl-rules/onload-control-policy.json | 99 ++++++++++++++ conf.d/ctl-rules/onload-control-script.lua | 95 ++++++++++++++ data/CMakeLists.txt | 46 ------- data/helloworld-lua-script.lua | 41 ------ data/onload-control-policy.json | 99 -------------- data/onload-control-script.lua | 95 -------------- htdocs/CMakeLists.txt | 15 +-- nbproject/configurations.xml | 100 +++++++------- 26 files changed, 754 insertions(+), 695 deletions(-) create mode 100644 conf.d/CMakeLists.txt create mode 100644 conf.d/alsa-sample/asoundrc.sample create mode 100644 conf.d/alsa-sample/ucm.sample/HDA Intel PCH.conf create mode 100644 conf.d/alsa-sample/ucm.sample/HiFi.conf create mode 100644 conf.d/alsa-sample/ucm.sample/README delete mode 100644 conf.d/alsa/asoundrc.sample delete mode 100644 conf.d/alsa/ucm.sample/HDA Intel PCH.conf delete mode 100644 conf.d/alsa/ucm.sample/HiFi.conf delete mode 100644 conf.d/alsa/ucm.sample/README create mode 100644 conf.d/ctl-rules/CMakeLists.txt create mode 100644 conf.d/ctl-rules/helloworld-lua-script.lua create mode 100644 conf.d/ctl-rules/onload-control-policy.json create mode 100644 conf.d/ctl-rules/onload-control-script.lua delete mode 100644 data/CMakeLists.txt delete mode 100644 data/helloworld-lua-script.lua delete mode 100644 data/onload-control-policy.json delete mode 100644 data/onload-control-script.lua diff --git a/Controler-afb/CMakeLists.txt b/Controler-afb/CMakeLists.txt index 08bc377..64ea5e1 100644 --- a/Controler-afb/CMakeLists.txt +++ b/Controler-afb/CMakeLists.txt @@ -33,8 +33,7 @@ endmacro(SET_TARGET_GENSKEL) PROJECT_TARGET_ADD(control-afb) # Define project Targets - ADD_LIBRARY(${TARGET_NAME} MODULE ctl-binding.c ctl-events.c ctl-dispatch.c ctl-lua.c -) + ADD_LIBRARY(${TARGET_NAME} MODULE ctl-binding.c ctl-events.c ctl-dispatch.c ctl-lua.c) # Generate API-v2 hat from OpenAPI json definition SET_TARGET_GENSKEL(${TARGET_NAME} ctl-apidef) @@ -64,7 +63,8 @@ PROJECT_TARGET_ADD(ctl-plugin-sample) # Alsa Plugin properties SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES - PREFIX "audio-" + PREFIX ${CTL_PLUGIN_PRE} + SUFFIX ${CTL_PLUGIN_EXT} OUTPUT_NAME ${TARGET_NAME} ) diff --git a/Controler-afb/ctl-binding.h b/Controler-afb/ctl-binding.h index 77d1b6e..abcb2f4 100644 --- a/Controler-afb/ctl-binding.h +++ b/Controler-afb/ctl-binding.h @@ -28,6 +28,7 @@ #endif #define STATIC static + // polctl-binding.c PUBLIC int CtlBindingInit (); @@ -50,6 +51,10 @@ typedef enum { CTL_NONE=-1 } DispatchCtlEnumT; +typedef enum { + CTL_SCAN_FLAT=0, + CTL_SCAN_RECURSIVE=1, +} CtlScanDirModeT; typedef enum { CTL_MODE_NONE=0, @@ -74,7 +79,7 @@ PUBLIC void ctlapi_dispatch (DispatchCtlEnumT control, afb_req request); // ctl-lua.c PUBLIC int LuaLibInit (); -PUBLIC json_object* ScanForConfig (char* searchPath, char * pre, char *ext); +PUBLIC json_object* ScanForConfig (char* searchPath, CtlScanDirModeT mode, char *pre, char *ext); PUBLIC void ctlapi_lua_docall (afb_req request); PUBLIC void ctlapi_lua_dostring (afb_req request); PUBLIC void ctlapi_lua_doscript (afb_req request); diff --git a/Controler-afb/ctl-dispatch.c b/Controler-afb/ctl-dispatch.c index cda3431..4fa1844 100644 --- a/Controler-afb/ctl-dispatch.c +++ b/Controler-afb/ctl-dispatch.c @@ -23,12 +23,10 @@ #include #include - -#include - #include "wrap-json.h" #include "ctl-binding.h" +typedef void*(*DispatchPluginInstallCbT)(const char* label, const char*version, const char*info); typedef struct { const char* label; @@ -37,11 +35,11 @@ typedef struct { DispatchActionT *actions; } DispatchHandleT; - typedef struct { const char* label; const char *info; const char *version; + void *context; char *plugin; void *dlHandle; DispatchHandleT *onload; @@ -56,8 +54,7 @@ PUBLIC void ctlapi_dispatch (DispatchCtlEnumT control, afb_req request) { json_object* argsJ= afb_req_json(request); int done=json_object_object_get_ex(argsJ, "closing", &tmpJ); - if (done) return; - + if (done) return; } // List Avaliable Configuration Files @@ -69,15 +66,15 @@ PUBLIC void ctlapi_config (struct afb_req request) { if (argsJ && json_object_object_get_ex (argsJ, "cfgpath" , &tmpJ)) { dirList = strdup (json_object_get_string(tmpJ)); } else { - dirList = strdup (CONTROL_DISPATCH_PATH); - AFB_NOTICE ("CONFIG-MISSING: use default CONTROL_DISPATCH_PATH=%s", CONTROL_DISPATCH_PATH); + dirList = strdup (CONTROL_CONFIG_PATH); + AFB_NOTICE ("CONFIG-MISSING: use default CONTROL_CONFIG_PATH=%s", CONTROL_CONFIG_PATH); } // get list of config file - struct json_object *responseJ = ScanForConfig(dirList, "onload", "json"); + struct json_object *responseJ = ScanForConfig(dirList, CTL_SCAN_RECURSIVE, "onload", "json"); if (json_object_array_length(responseJ) == 0) { - afb_req_fail(request, "CONFIGPATH:EMPTY", "No Config Found in CONTROL_DISPATCH_PATH"); + afb_req_fail(request, "CONFIGPATH:EMPTY", "No Config Found in CONTROL_CONFIG_PATH"); } else { afb_req_success(request, responseJ, NULL); } @@ -166,6 +163,7 @@ STATIC DispatchActionT *DispatchLoadActions (json_object *actionsJ) { } + STATIC DispatchConfigT *DispatchLoadConfig (const char* filepath) { json_object *dispatchConfigJ, *ignoreJ; int err; @@ -185,7 +183,7 @@ STATIC DispatchConfigT *DispatchLoadConfig (const char* filepath) { DispatchConfigT *dispatchConfig = calloc (1, sizeof(DispatchConfigT)); if (metadataJ) { - err= wrap_json_unpack(metadataJ, "{so,s?s,ss !}", "label", &dispatchConfig->label, "info",&dispatchConfig->info, "version",&dispatchConfig->version); + err= wrap_json_unpack(metadataJ, "{ss,s?s,ss !}", "label", &dispatchConfig->label, "info",&dispatchConfig->info, "version",&dispatchConfig->version); if (err) { AFB_ERROR ("DISPATCH-LOAD-CONFIG:METADATA Missing something label|version|[label] in %s", json_object_get_string(metadataJ)); goto OnErrorExit; @@ -205,33 +203,44 @@ STATIC DispatchConfigT *DispatchLoadConfig (const char* filepath) { if (dispatchConfig->plugin) { // search for default policy config file - json_object *pluginPathJ = ScanForConfig(CONTROL_PLUGIN_PATH , dispatchConfig->plugin, NULL); + json_object *pluginPathJ = ScanForConfig(CONTROL_PLUGIN_PATH , CTL_SCAN_RECURSIVE, dispatchConfig->plugin, NULL); if (!pluginPathJ || json_object_array_length(pluginPathJ) == 0) { AFB_ERROR ("DISPATCH-LOAD-CONFIG:PLUGIN Missing plugin=%s in path=%s", dispatchConfig->plugin, CONTROL_PLUGIN_PATH); goto OnErrorExit; } - char *filename; char*dirpath; - err= wrap_json_unpack (json_object_array_get_idx(pluginPathJ,1), "{s:s, s:s !}", "dirpath", &dirpath,"filename", &filename); + char *filename; char*fullpath; + err= wrap_json_unpack (json_object_array_get_idx(pluginPathJ,0), "{s:s, s:s !}", "fullpath", &fullpath,"filename", &filename); if (err) { AFB_ERROR ("DISPATCH-LOAD-CONFIG:PLUGIN HOOPs invalid plugin file path = %s", json_object_get_string(pluginPathJ)); goto OnErrorExit; } if (json_object_array_length(pluginPathJ) > 1) { - AFB_WARNING ("DISPATCH-LOAD-CONFIG:PLUGIN plugin multiple instances in searchpath will use %s/%s", dirpath, filepath); + AFB_WARNING ("DISPATCH-LOAD-CONFIG:PLUGIN plugin multiple instances in searchpath will use %s/%s", fullpath, filepath); } - - char filepath[255]; - strncpy(filepath, dirpath, sizeof(filepath)); - strncat(filepath, "/", sizeof(filepath)); - strncat(filepath, filename, sizeof(filepath)); - dispatchConfig->dlHandle = dlopen(filepath, RTLD_NOW); + + char pluginpath[CONTROL_MAXPATH_LEN]; + strncpy(pluginpath, fullpath, sizeof(pluginpath)); + strncat(pluginpath, "/", sizeof(pluginpath)); + strncat(pluginpath, filename, sizeof(pluginpath)); + dispatchConfig->dlHandle = dlopen(pluginpath, RTLD_NOW); if (!dispatchConfig->dlHandle) { - AFB_ERROR ("DISPATCH-LOAD-CONFIG:PLIUGIN Fail to load filepath=%s err= %s", filepath, dlerror()); + AFB_ERROR ("DISPATCH-LOAD-CONFIG:PLIUGIN Fail to load pluginpath=%s err= %s", pluginpath, dlerror()); goto OnErrorExit; } - } + + ulong *ctlPluginMagic = (ulong*)dlsym(dispatchConfig->dlHandle, "CtlPluginMagic"); + if (!ctlPluginMagic || *ctlPluginMagic != CTL_PLUGIN_MAGIC) { + AFB_ERROR("DISPATCH-LOAD-CONFIG:PLIUGIN symbol'CtlPluginMagic' missing or != CTL_PLUGIN_MAGIC plugin=%s", pluginpath); + goto OnErrorExit; + } + + DispatchPluginInstallCbT ctlPluginInstall = dlsym(dispatchConfig->dlHandle, "CtlPluginOnload"); + if (ctlPluginInstall) { + dispatchConfig->context = (*ctlPluginInstall) (dispatchConfig->label, dispatchConfig->version, dispatchConfig->info); + } + } dispatchHandle->actions= DispatchLoadActions(actionsJ); dispatchConfig->onload= dispatchHandle; @@ -275,21 +284,21 @@ PUBLIC int DispatchInit () { // search for default dispatch config file - json_object* responseJ = ScanForConfig(CONTROL_DISPATCH_PATH, "onload", "json"); + json_object* responseJ = ScanForConfig(CONTROL_CONFIG_PATH, CTL_SCAN_RECURSIVE,"onload", "json"); for (index=0; index < json_object_array_length(responseJ); index++) { json_object *entryJ=json_object_array_get_idx(responseJ, index); - char *filename; char*dirpath; - err= wrap_json_unpack (entryJ, "{s:s, s:s !}", "dirpath", &dirpath,"filename", &filename); + char *filename; char*fullpath; + err= wrap_json_unpack (entryJ, "{s:s, s:s !}", "fullpath", &fullpath,"filename", &filename); if (err) { - AFB_ERROR ("DISPATCH-INIT HOOPs invalid config file path = %s", json_object_get_string(entryJ)); + AFB_ERROR ("DISPATCH-INIT HOOPs invalid JSON entry= %s", json_object_get_string(entryJ)); goto OnErrorExit; } - if (strcasestr(filename, CONTROL_DISPATCH_FILE)) { - char filepath[255]; - strncpy(filepath, dirpath, sizeof(filepath)); + if (strcasestr(filename, CONTROL_CONFIG_FILE)) { + char filepath[CONTROL_MAXPATH_LEN]; + strncpy(filepath, fullpath, sizeof(filepath)); strncat(filepath, "/", sizeof(filepath)); strncat(filepath, filename, sizeof(filepath)); ctlHandle = DispatchLoadConfig (filepath); @@ -303,7 +312,7 @@ PUBLIC int DispatchInit () { // no dispatch config found remove control API from binder if (index == 0) { - AFB_WARNING ("DISPATCH-INIT:WARNING No Control dispatch file [%s]", CONTROL_DISPATCH_FILE); + AFB_WARNING ("DISPATCH-INIT:WARNING No Control dispatch file [%s]", CONTROL_CONFIG_FILE); } AFB_NOTICE ("DISPATCH-INIT:SUCCES: Audio Control Dispatch Init"); diff --git a/Controler-afb/ctl-lua.c b/Controler-afb/ctl-lua.c index 8b40e38..38a3d5f 100644 --- a/Controler-afb/ctl-lua.c +++ b/Controler-afb/ctl-lua.c @@ -70,66 +70,35 @@ typedef enum { * https://stackoverflow.com/questions/45596493/lua-using-lua-newuserdata-from-lua-pcall */ -STATIC LuaAfbContextT *LuaCtxCheck (lua_State *luaState, int index) { - LuaAfbContextT *afbContext; - //luaL_checktype(luaState, index, LUA_TUSERDATA); - //afbContext = (LuaAfbContextT *)luaL_checkudata(luaState, index, CTX_TOKEN); - luaL_checktype(luaState, index, LUA_TLIGHTUSERDATA); - afbContext = (LuaAfbContextT *) lua_touserdata(luaState, index); - if (afbContext == NULL && afbContext->ctxMagic != CTX_MAGIC) { - luaL_error(luaState, "Fail to retrieve user data context=%s", CTX_TOKEN); - AFB_ERROR ("afbContextCheck error retrieving afbContext"); - return NULL; - } - return afbContext; -} - -STATIC LuaAfbContextT *LuaCtxPush (lua_State *luaState, afb_req request, const char* info) { - // LuaAfbContextT *afbContext = (LuaAfbContextT *)lua_newuserdata(luaState, sizeof(LuaAfbContextT)); - // luaL_setmetatable(luaState, CTX_TOKEN); - LuaAfbContextT *afbContext = (LuaAfbContextT *)calloc(1, sizeof(LuaAfbContextT)); - lua_pushlightuserdata(luaState, afbContext); - if (!afbContext) { - AFB_ERROR ("LuaCtxPush fail to allocate user data context"); - return NULL; - } - afbContext->ctxMagic=CTX_MAGIC; - afbContext->info=strdup(info); - afbContext->request= request; - return afbContext; -} - -STATIC void LuaCtxFree (LuaAfbContextT *afbContext) { - free (afbContext->info); -} - // List Avaliable Configuration Files -PUBLIC json_object* ScanForConfig (char* searchPath, char *pre, char *ext) { +PUBLIC json_object* ScanForConfig (char* searchPath, CtlScanDirModeT mode, char *pre, char *ext) { json_object *responseJ; - DIR *dirHandle; char *dirPath; char* dirList= strdup(searchPath); size_t extLen=0; - void ScanDir (char *dirpath) { + void ScanDir (char *searchPath) { + DIR *dirHandle; struct dirent *dirEnt; - dirHandle = opendir (dirPath); + dirHandle = opendir (searchPath); if (!dirHandle) { - AFB_NOTICE ("CONFIG-SCANNING dir=%s not readable", dirPath); + AFB_NOTICE ("CONFIG-SCANNING dir=%s not readable", searchPath); return; } - AFB_NOTICE ("CONFIG-SCANNING:ctl_listconfig scanning: %s", dirPath); + //AFB_NOTICE ("CONFIG-SCANNING:ctl_listconfig scanning: %s", searchPath); while ((dirEnt = readdir(dirHandle)) != NULL) { // recursively search embedded directories ignoring any directory starting by '.' or '_' - if (dirEnt->d_type == DT_DIR) { + if (dirEnt->d_type == DT_DIR && mode == CTL_SCAN_RECURSIVE) { char newpath[CONTROL_MAXPATH_LEN]; if (dirEnt->d_name[0]=='.' || dirEnt->d_name[0]=='_') continue; - strncpy(newpath, dirpath, sizeof(newpath)); + strncpy(newpath, searchPath, sizeof(newpath)); strncat(newpath, "/", sizeof(newpath)); strncat(newpath, dirEnt->d_name, sizeof(newpath)); + ScanDir(newpath); + continue; } // Unknown type is accepted to support dump filesystems @@ -142,12 +111,12 @@ PUBLIC json_object* ScanForConfig (char* searchPath, char *pre, char *ext) { if (ext && strcasecmp (ext, &dirEnt->d_name[extIdx])) continue; struct json_object *pathJ = json_object_new_object(); - json_object_object_add(pathJ, "dirpath", json_object_new_string(dirPath)); + json_object_object_add(pathJ, "fullpath", json_object_new_string(searchPath)); json_object_object_add(pathJ, "filename", json_object_new_string(dirEnt->d_name)); json_object_array_add(responseJ, pathJ); } - closedir(dirHandle); } + closedir(dirHandle); } if (ext) extLen=strlen(ext); @@ -162,6 +131,39 @@ PUBLIC json_object* ScanForConfig (char* searchPath, char *pre, char *ext) { return (responseJ); } +STATIC LuaAfbContextT *LuaCtxCheck (lua_State *luaState, int index) { + LuaAfbContextT *afbContext; + //luaL_checktype(luaState, index, LUA_TUSERDATA); + //afbContext = (LuaAfbContextT *)luaL_checkudata(luaState, index, CTX_TOKEN); + luaL_checktype(luaState, index, LUA_TLIGHTUSERDATA); + afbContext = (LuaAfbContextT *) lua_touserdata(luaState, index); + if (afbContext == NULL && afbContext->ctxMagic != CTX_MAGIC) { + luaL_error(luaState, "Fail to retrieve user data context=%s", CTX_TOKEN); + AFB_ERROR ("afbContextCheck error retrieving afbContext"); + return NULL; + } + return afbContext; +} + +STATIC LuaAfbContextT *LuaCtxPush (lua_State *luaState, afb_req request, const char* info) { + // LuaAfbContextT *afbContext = (LuaAfbContextT *)lua_newuserdata(luaState, sizeof(LuaAfbContextT)); + // luaL_setmetatable(luaState, CTX_TOKEN); + LuaAfbContextT *afbContext = (LuaAfbContextT *)calloc(1, sizeof(LuaAfbContextT)); + lua_pushlightuserdata(luaState, afbContext); + if (!afbContext) { + AFB_ERROR ("LuaCtxPush fail to allocate user data context"); + return NULL; + } + afbContext->ctxMagic=CTX_MAGIC; + afbContext->info=strdup(info); + afbContext->request= request; + return afbContext; +} + +STATIC void LuaCtxFree (LuaAfbContextT *afbContext) { + free (afbContext->info); +} + STATIC int LuaPushArgument (json_object *arg) { switch (json_object_get_type(arg)) { @@ -511,7 +513,7 @@ PUBLIC void LuaDoAction (LuaDoActionT action, afb_req request) { // scan luascript search path once static json_object *luaScriptPathJ =NULL; - if (!luaScriptPathJ) luaScriptPathJ= ScanForConfig(CONTROL_LUA_PATH , NULL, "lua"); + if (!luaScriptPathJ) luaScriptPathJ= ScanForConfig(CONTROL_LUA_PATH , CTL_SCAN_FLAT, NULL, "lua"); err= wrap_json_unpack (queryJ, "{s:s, s?o s?o !}", "script", &script,"args", &args, "arg", &args); if (err) { @@ -537,10 +539,10 @@ PUBLIC void LuaDoAction (LuaDoActionT action, afb_req request) { } for (index=0; index < json_object_array_length(luaScriptPathJ); index++) { - char *filename; char*dirpath; + char *filename; char*fullpath; json_object *entryJ=json_object_array_get_idx(luaScriptPathJ, index); - err= wrap_json_unpack (entryJ, "{s:s, s:s !}", "dirpath", &dirpath,"filename", &filename); + err= wrap_json_unpack (entryJ, "{s:s, s:s !}", "fullpath", &fullpath,"filename", &filename); if (err) { AFB_ERROR ("LUA-DOSCRIPT HOOPs invalid LUA script path = %s", json_object_get_string(entryJ)); goto OnErrorExit; @@ -548,8 +550,8 @@ PUBLIC void LuaDoAction (LuaDoActionT action, afb_req request) { if (strcmp(filename, script)) continue; - char filepath[255]; - strncpy(filepath, dirpath, sizeof(filepath)); + char filepath[CONTROL_MAXPATH_LEN]; + strncpy(filepath, fullpath, sizeof(filepath)); strncat(filepath, "/", sizeof(filepath)); strncat(filepath, filename, sizeof(filepath)); err= luaL_loadfile(luaState, filepath); @@ -616,7 +618,7 @@ PUBLIC int LuaLibInit () { int err, index; // search for default policy config file - json_object *luaScriptPathJ = ScanForConfig(CONTROL_LUA_PATH , "onload", "lua"); + json_object *luaScriptPathJ = ScanForConfig(CONTROL_LUA_PATH , CTL_SCAN_RECURSIVE, "onload", "lua"); // open a new LUA interpretor luaState = luaL_newstate(); @@ -636,15 +638,15 @@ PUBLIC int LuaLibInit () { for (index=0; index < json_object_array_length(luaScriptPathJ); index++) { json_object *entryJ=json_object_array_get_idx(luaScriptPathJ, index); - char *filename; char*dirpath; - err= wrap_json_unpack (entryJ, "{s:s, s:s !}", "dirpath", &dirpath,"filename", &filename); + char *filename; char*fullpath; + err= wrap_json_unpack (entryJ, "{s:s, s:s !}", "fullpath", &fullpath,"filename", &filename); if (err) { AFB_ERROR ("LUA-INIT HOOPs invalid config file path = %s", json_object_get_string(entryJ)); goto OnErrorExit; } char filepath[CONTROL_MAXPATH_LEN]; - strncpy(filepath, dirpath, sizeof(filepath)); + strncpy(filepath, fullpath, sizeof(filepath)); strncat(filepath, "/", sizeof(filepath)); strncat(filepath, filename, sizeof(filepath)); err= luaL_loadfile(luaState, filepath); diff --git a/Controler-afb/ctl-plugin-sample.c b/Controler-afb/ctl-plugin-sample.c index f232573..f7665f0 100644 --- a/Controler-afb/ctl-plugin-sample.c +++ b/Controler-afb/ctl-plugin-sample.c @@ -31,6 +31,20 @@ typedef struct { int count; } MyPluginCtxT; +// This tag is mandotory and used as sanity check when loading plugin +PUBLIC ulong CtlPluginMagic=CTL_PLUGIN_MAGIC; + +// Call at initialisation time +PUBLIC void* CtlPluginOnload(char* label, char* version, char* info) { + MyPluginCtxT *pluginCtx= (MyPluginCtxT*)calloc (1, sizeof(MyPluginCtxT)); + pluginCtx->magic = MY_PLUGIN_MAGIC; + pluginCtx->count = 0; + + fprintf(stderr, "*** CONTROLER-PLUGIN-SAMPLE:Install label=%s version=%s info=%s", label, info, version); + AFB_NOTICE ("CONTROLER-PLUGIN-SAMPLE:Install label=%s version=%s info=%s", label, info, version); + return (void*)pluginCtx; +} + STATIC const char* jsonToString (json_object *valueJ) { const char *value; if (valueJ) @@ -41,24 +55,18 @@ STATIC const char* jsonToString (json_object *valueJ) { return value; } -PUBLIC int SamplePolicyInstall (DispatchActionT *action, json_object *response, void *context) { - - MyPluginCtxT *pluginCtx= (MyPluginCtxT*)calloc (1, sizeof(MyPluginCtxT)); - pluginCtx->magic = MY_PLUGIN_MAGIC; - pluginCtx->count = 0; - - AFB_INFO ("CONTROLER-PLUGIN-SAMPLE SamplePolicyInstall action=%s args=%s", action->label, jsonToString(action->argsJ)); - - return 0; -} -PUBLIC int SamplePolicyCount (DispatchActionT *action, json_object *response, void *context) { +PUBLIC void SamplePolicyCount (afb_req request, DispatchActionT *action, void *context) { MyPluginCtxT *pluginCtx= (MyPluginCtxT*)context; - //pluginCtx->magic = MY_PLUGIN_MAGIC; - //pluginCtx->count = 0; - - AFB_INFO ("CONTROLER-PLUGIN-SAMPLE SamplePolicyCount action=%s args=%s count=%d", action->label, jsonToString(action->argsJ), pluginCtx->count); - return 0; + if (!context || pluginCtx->magic != MY_PLUGIN_MAGIC) { + AFB_ERROR("CONTROLER-PLUGIN-SAMPLE:count (Hoops) Invalid Sample Plugin Context"); + return; + + }; + + pluginCtx->count++; + + AFB_INFO ("CONTROLER-PLUGIN-SAMPLE:Count SamplePolicyCount action=%s args=%s count=%d", action->label, jsonToString(action->argsJ), pluginCtx->count); } diff --git a/conf.d/CMakeLists.txt b/conf.d/CMakeLists.txt new file mode 100644 index 0000000..413fe8e --- /dev/null +++ b/conf.d/CMakeLists.txt @@ -0,0 +1,26 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + + + +# Define subproject targets +ADD_SUBDIRECTORY(ctl-rules) + + + + diff --git a/conf.d/alsa-sample/asoundrc.sample b/conf.d/alsa-sample/asoundrc.sample new file mode 100644 index 0000000..1786c46 --- /dev/null +++ b/conf.d/alsa-sample/asoundrc.sample @@ -0,0 +1,160 @@ +# +# Author: Fulup Ar Foll +# Object: PCM hook type +# +# Test : Note: Jabra_USB=hw:v1340 +# Check SoundCard speaker-test -Dhw:v1340 -c2 -twav +# Check MixerPCM speaker-test -DMyMixerPCM -c2 -twav +# Check HookPCM speaker-test -DMyNavigationHook -c2 -twav +# Check NavPCM speaker-test -DMyNavPCM -c2 -twav +# MultiMedia aplay -DDMyNavPCM /usr/share/sounds/alsa/test.wav +# +# Bug/Feature: when softvol control is initialised from plugin and not +# from AGL binding. At 1st run ctl has invalid TLV and cannot be +# use. Bypass Solution: +# * start audio-binder before playing sound (binding create control before softvol plugin) +# * run a dummy aplay -DMyNavPCM "" to get a clean control +# +# References: https://www.spinics.net/lists/alsa-devel/msg54235.html +# -------------------------------------------------------------------- + +# Mixer PCM allow to play multiple stream simultaneously +# ------------------------------------------------------ +pcm.MyMixerPCM { + type dmix + ipc_key 1024 + ipc_key_add_uid false + ipc_perm 0666 # mixing for all users + + # Define target effective sound card (cannot be a plugin) + slave { + pcm "hw:v1340" #Jabra Solmate + period_time 0 + period_size 1024 + buffer_size 8192 + rate 44100 + } + + # DMIX can only map two channels + bindings { + 0 0 + 1 1 + } +} + +# Define a Hook_type with a private sharelib +# ------------------------------------------- +pcm_hook_type.MyHookPlugin { + install "AlsaInstallHook" + lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Policy-Hook/policy_hook_cb.so" +} + +# Define a HookedPCM that point to Hook_type sharelib +# ---------------------------------------------------- +pcm.MyNavigationHook { + type hooks + slave.pcm "MyMixerPCM" + + # Defined used hook sharelib and provide arguments/config to install func + hooks.0 { + type "MyHookPlugin" + hook_args { + verbose true # print few log messages (default false); + + # Every Call should return OK in order PCM to open (default timeout 100ms) + uri "ws://localhost:1234/api?token='audio-agent-token'" + request { + # Request autorisation to write on navigation + RequestNavigation { + api "polctl" + verb "navigation" + } + # subscribe to Audio Agent Event + SubscriveEvents { + api "polctl" + verb "monitor" + } + TestAutoStop { + api "polctl" + verb "event_test" + query "{'label':'stop', 'delay':10000}" + } + TestAutoStart { + api "polctl" + verb "event_test" + query "{'label':'stop', 'delay':20000}" + } + # start a test pause/resume not supported by every hardware + TestPauseResume { + api "polctl" + verb "event_test" + query "{'label':'pause', 'delay':3000, 'count':10}" + } + } + } + } +} + +# If hardware does not support mixer emulate it with softvol +# ----------------------------------------------------------- +pcm.MyMultimediaPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "MyNavigationHook" + + # resolution=HAL(valMax+1) (default=256) + resolution 256 + + # name should match with HAL but do not set card=xx + control.name "Playback Navigation" + + # Make this plugin visible from aplay -L + hint { + show on + description "Navigation SolftVol PCM" + } +} + +# If hardware does not support mixer emulate it with softvol +# ----------------------------------------------------------- +pcm.MyNavPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "MyNavigationHook" + + # resolution=HAL(valMax+1) (default=256) + resolution 256 + + # name should match with HAL but do not set card=xx + control.name "Playback Navigation" + + # Make this plugin visible from aplay -L + hint { + show on + description "Navigation SolftVol PCM" + } +} + +# If hardware does not support mixer emulate it with softvol +# ----------------------------------------------------------- +pcm.MyAlarmPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "MyNavigationHook" + + # resolution=HAL(valMax+1) (default=256) + resolution 256 + + # name should match with HAL but do not set card=xx + control.name "Playback Navigation" + + # Make this plugin visible from aplay -L + hint { + show on + description "Navigation SolftVol PCM" + } +} + diff --git a/conf.d/alsa-sample/ucm.sample/HDA Intel PCH.conf b/conf.d/alsa-sample/ucm.sample/HDA Intel PCH.conf new file mode 100644 index 0000000..f6608a0 --- /dev/null +++ b/conf.d/alsa-sample/ucm.sample/HDA Intel PCH.conf @@ -0,0 +1,6 @@ +Comment "Leon internal card" + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Default" +} diff --git a/conf.d/alsa-sample/ucm.sample/HiFi.conf b/conf.d/alsa-sample/ucm.sample/HiFi.conf new file mode 100644 index 0000000..9a53c8c --- /dev/null +++ b/conf.d/alsa-sample/ucm.sample/HiFi.conf @@ -0,0 +1,84 @@ +SectionVerb { + EnableSequence [ + cdev "hw:PCH" + + cset "name='Master Playback Switch' on" + cset "name='Headphone Playback Switch' off" + cset "name='Speaker Playback Switch' on" + + cset "name='Capture Switch' on" + cset "name='Capture Volume' 39" + cset "name='Mic Boost Volume' 2" + cset "name='Internal Mic Boost Volume' 0" + #cset "name='Capture Source' 0" + ] + DisableSequence [ + ] + Value { + TQ "Music" + OutputDspName "speaker_eq" + PlaybackPCM "hw:PCH,0" + } +} + +SectionDevice."Headphone".0 { + Value { + JackName "Headphone Jack" + OutputDspName "Jheadphone" + } + EnableSequence [ + cdev "hw:PCH" + + cset "name='Speaker Playback Switch' off" + cset "name='Headphone Playback Switch' on" + ] + DisableSequence [ + cdev "hw:PCH" + + cset "name='Headphone Playback Switch' off" + cset "name='Speaker Playback Switch' on" + ] +} + +SectionDevice."Mic".0 { + Value { + JackName "Mic Jack" + } + EnableSequence [ + cdev "hw:PCH" + + #cset "name='Capture Source' 1" + ] + DisableSequence [ + cdev "hw:PCH" + + cset "name='Capture Source' 0" + ] +} + +SectionModifier."RecordMedia".0 { + SupportedDevice [ + "Headphone" + ] + EnableSequence [ + cdev "hw:PCH" + ] + + DisableSequence [ + cdev "hw:PCH" + ] + + TransitionSequence."ToModifierName" [ + cdev "hw:PCH" + ] + + # Optional TQ and ALSA PCMs + Value { + TQ Voice + CapturePCM "hw:1" + PlaybackVolume "name='Master Playback Volume',index=2" + PlaybackSwitch "name='Master Playback Switch',index=2" + } + +} + diff --git a/conf.d/alsa-sample/ucm.sample/README b/conf.d/alsa-sample/ucm.sample/README new file mode 100644 index 0000000..e7f08ae --- /dev/null +++ b/conf.d/alsa-sample/ucm.sample/README @@ -0,0 +1,2 @@ +Should match sound card name ex: "HDA Intel PCH" +cp -r . /usr/share/alsa/ucm diff --git a/conf.d/alsa/asoundrc.sample b/conf.d/alsa/asoundrc.sample deleted file mode 100644 index 1786c46..0000000 --- a/conf.d/alsa/asoundrc.sample +++ /dev/null @@ -1,160 +0,0 @@ -# -# Author: Fulup Ar Foll -# Object: PCM hook type -# -# Test : Note: Jabra_USB=hw:v1340 -# Check SoundCard speaker-test -Dhw:v1340 -c2 -twav -# Check MixerPCM speaker-test -DMyMixerPCM -c2 -twav -# Check HookPCM speaker-test -DMyNavigationHook -c2 -twav -# Check NavPCM speaker-test -DMyNavPCM -c2 -twav -# MultiMedia aplay -DDMyNavPCM /usr/share/sounds/alsa/test.wav -# -# Bug/Feature: when softvol control is initialised from plugin and not -# from AGL binding. At 1st run ctl has invalid TLV and cannot be -# use. Bypass Solution: -# * start audio-binder before playing sound (binding create control before softvol plugin) -# * run a dummy aplay -DMyNavPCM "" to get a clean control -# -# References: https://www.spinics.net/lists/alsa-devel/msg54235.html -# -------------------------------------------------------------------- - -# Mixer PCM allow to play multiple stream simultaneously -# ------------------------------------------------------ -pcm.MyMixerPCM { - type dmix - ipc_key 1024 - ipc_key_add_uid false - ipc_perm 0666 # mixing for all users - - # Define target effective sound card (cannot be a plugin) - slave { - pcm "hw:v1340" #Jabra Solmate - period_time 0 - period_size 1024 - buffer_size 8192 - rate 44100 - } - - # DMIX can only map two channels - bindings { - 0 0 - 1 1 - } -} - -# Define a Hook_type with a private sharelib -# ------------------------------------------- -pcm_hook_type.MyHookPlugin { - install "AlsaInstallHook" - lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Policy-Hook/policy_hook_cb.so" -} - -# Define a HookedPCM that point to Hook_type sharelib -# ---------------------------------------------------- -pcm.MyNavigationHook { - type hooks - slave.pcm "MyMixerPCM" - - # Defined used hook sharelib and provide arguments/config to install func - hooks.0 { - type "MyHookPlugin" - hook_args { - verbose true # print few log messages (default false); - - # Every Call should return OK in order PCM to open (default timeout 100ms) - uri "ws://localhost:1234/api?token='audio-agent-token'" - request { - # Request autorisation to write on navigation - RequestNavigation { - api "polctl" - verb "navigation" - } - # subscribe to Audio Agent Event - SubscriveEvents { - api "polctl" - verb "monitor" - } - TestAutoStop { - api "polctl" - verb "event_test" - query "{'label':'stop', 'delay':10000}" - } - TestAutoStart { - api "polctl" - verb "event_test" - query "{'label':'stop', 'delay':20000}" - } - # start a test pause/resume not supported by every hardware - TestPauseResume { - api "polctl" - verb "event_test" - query "{'label':'pause', 'delay':3000, 'count':10}" - } - } - } - } -} - -# If hardware does not support mixer emulate it with softvol -# ----------------------------------------------------------- -pcm.MyMultimediaPCM { - type softvol - - # Point Slave on HOOK for policies control - slave.pcm "MyNavigationHook" - - # resolution=HAL(valMax+1) (default=256) - resolution 256 - - # name should match with HAL but do not set card=xx - control.name "Playback Navigation" - - # Make this plugin visible from aplay -L - hint { - show on - description "Navigation SolftVol PCM" - } -} - -# If hardware does not support mixer emulate it with softvol -# ----------------------------------------------------------- -pcm.MyNavPCM { - type softvol - - # Point Slave on HOOK for policies control - slave.pcm "MyNavigationHook" - - # resolution=HAL(valMax+1) (default=256) - resolution 256 - - # name should match with HAL but do not set card=xx - control.name "Playback Navigation" - - # Make this plugin visible from aplay -L - hint { - show on - description "Navigation SolftVol PCM" - } -} - -# If hardware does not support mixer emulate it with softvol -# ----------------------------------------------------------- -pcm.MyAlarmPCM { - type softvol - - # Point Slave on HOOK for policies control - slave.pcm "MyNavigationHook" - - # resolution=HAL(valMax+1) (default=256) - resolution 256 - - # name should match with HAL but do not set card=xx - control.name "Playback Navigation" - - # Make this plugin visible from aplay -L - hint { - show on - description "Navigation SolftVol PCM" - } -} - diff --git a/conf.d/alsa/ucm.sample/HDA Intel PCH.conf b/conf.d/alsa/ucm.sample/HDA Intel PCH.conf deleted file mode 100644 index f6608a0..0000000 --- a/conf.d/alsa/ucm.sample/HDA Intel PCH.conf +++ /dev/null @@ -1,6 +0,0 @@ -Comment "Leon internal card" - -SectionUseCase."HiFi" { - File "HiFi.conf" - Comment "Default" -} diff --git a/conf.d/alsa/ucm.sample/HiFi.conf b/conf.d/alsa/ucm.sample/HiFi.conf deleted file mode 100644 index 9a53c8c..0000000 --- a/conf.d/alsa/ucm.sample/HiFi.conf +++ /dev/null @@ -1,84 +0,0 @@ -SectionVerb { - EnableSequence [ - cdev "hw:PCH" - - cset "name='Master Playback Switch' on" - cset "name='Headphone Playback Switch' off" - cset "name='Speaker Playback Switch' on" - - cset "name='Capture Switch' on" - cset "name='Capture Volume' 39" - cset "name='Mic Boost Volume' 2" - cset "name='Internal Mic Boost Volume' 0" - #cset "name='Capture Source' 0" - ] - DisableSequence [ - ] - Value { - TQ "Music" - OutputDspName "speaker_eq" - PlaybackPCM "hw:PCH,0" - } -} - -SectionDevice."Headphone".0 { - Value { - JackName "Headphone Jack" - OutputDspName "Jheadphone" - } - EnableSequence [ - cdev "hw:PCH" - - cset "name='Speaker Playback Switch' off" - cset "name='Headphone Playback Switch' on" - ] - DisableSequence [ - cdev "hw:PCH" - - cset "name='Headphone Playback Switch' off" - cset "name='Speaker Playback Switch' on" - ] -} - -SectionDevice."Mic".0 { - Value { - JackName "Mic Jack" - } - EnableSequence [ - cdev "hw:PCH" - - #cset "name='Capture Source' 1" - ] - DisableSequence [ - cdev "hw:PCH" - - cset "name='Capture Source' 0" - ] -} - -SectionModifier."RecordMedia".0 { - SupportedDevice [ - "Headphone" - ] - EnableSequence [ - cdev "hw:PCH" - ] - - DisableSequence [ - cdev "hw:PCH" - ] - - TransitionSequence."ToModifierName" [ - cdev "hw:PCH" - ] - - # Optional TQ and ALSA PCMs - Value { - TQ Voice - CapturePCM "hw:1" - PlaybackVolume "name='Master Playback Volume',index=2" - PlaybackSwitch "name='Master Playback Switch',index=2" - } - -} - diff --git a/conf.d/alsa/ucm.sample/README b/conf.d/alsa/ucm.sample/README deleted file mode 100644 index e7f08ae..0000000 --- a/conf.d/alsa/ucm.sample/README +++ /dev/null @@ -1,2 +0,0 @@ -Should match sound card name ex: "HDA Intel PCH" -cp -r . /usr/share/alsa/ucm diff --git a/conf.d/app-templates b/conf.d/app-templates index 5b4dfe2..8967162 160000 --- a/conf.d/app-templates +++ b/conf.d/app-templates @@ -1 +1 @@ -Subproject commit 5b4dfe23ef1141d8f7595a157ca7a8ee5ad8ad07 +Subproject commit 8967162dd12bce89f9ae27f5c9bce7b78624e3fd diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index 5b741d8..63c83b8 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -68,9 +68,15 @@ set (PKG_REQUIRED_LIST # Define CONTROL_CDEV_NAME should match MOST driver values # --------------------------------------------------------- add_compile_options(-DCONTROL_MAXPATH_LEN=255) - add_compile_options(-DCONTROL_DISPATCH_FILE="onload-control-policy.json") - add_compile_options(-DCONTROL_DISPATCH_PATH="${CMAKE_CURRENT_BINARY_DIR}/Controler-afb:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/controler") - add_compile_options(-DCONTROL_LUA_PATH="/etc/default/audio-agent/policy:$ENV{HOME}/.config/audio-agent:${CMAKE_INSTALL_PREFIX}/audio-agent/policy:${CMAKE_SOURCE_DIR}/data") + add_compile_options(-DCONTROL_CONFIG_FILE="onload-control-policy.json") + add_compile_options(-DCONTROL_CONFIG_PATH="${CMAKE_SOURCE_DIR}/conf.d:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/config") + + add_compile_options(-DCONTROL_LUA_PATH="${CMAKE_SOURCE_DIR}/data:/etc/default/${PROJECT_NAME}/lua:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lua") + + + set (CTL_PLUGIN_PRE "audio-") + set (CTL_PLUGIN_EXT ".ctlso") + add_compile_options(-DCTL_PLUGIN_MAGIC=2468013579) add_compile_options(-DCONTROL_PLUGIN_PATH="${BINDINGS_INSTALL_DIR}/controler:/usr/lib/${PROJECT_NAME}") # Print a helper message when every thing is finished diff --git a/conf.d/ctl-rules/CMakeLists.txt b/conf.d/ctl-rules/CMakeLists.txt new file mode 100644 index 0000000..51a3a46 --- /dev/null +++ b/conf.d/ctl-rules/CMakeLists.txt @@ -0,0 +1,44 @@ +########################################################################### +# Copyright 2017 IoT.bzh +# +# author: Fulup Ar Foll +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + + +################################################## +# Control Policy Config file +################################################## +PROJECT_TARGET_ADD(control-rules) + + file(GLOB XML_FILES "*.json" "*.lua") + + add_custom_target(${TARGET_NAME} + DEPENDS ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + ) + + # check XML schema before pushing config + add_custom_command( + DEPENDS ${XML_FILES} + OUTPUT ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + # COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout (Fulup we miss this for JSON) + COMMAND mkdir -p ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + COMMAND touch ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + COMMAND cp -r ${XML_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + ) + + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS "DATA" + OUTPUT_NAME ${TARGET_NAME} + ) diff --git a/conf.d/ctl-rules/helloworld-lua-script.lua b/conf.d/ctl-rules/helloworld-lua-script.lua new file mode 100644 index 0000000..7dd0459 --- /dev/null +++ b/conf.d/ctl-rules/helloworld-lua-script.lua @@ -0,0 +1,41 @@ +--[[ + Copyright (C) 2016 "IoT.bzh" + Author Fulup Ar Foll + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + Simple API script +--]] + + -- retrieve calling arguments + args= ... + + print ("Helloworld script arguments:") + + + for key,value in pairs(args) + do + print("args: ", key,value) + end + + -- loop on script arguments + --for i=1,#args + --do + -- print(" -- ", i, args[i]) + --end + + + -- return two arguments on top of status + return true, 1234, "ABCD", 5678 + diff --git a/conf.d/ctl-rules/onload-control-policy.json b/conf.d/ctl-rules/onload-control-policy.json new file mode 100644 index 0000000..5c0c232 --- /dev/null +++ b/conf.d/ctl-rules/onload-control-policy.json @@ -0,0 +1,99 @@ +{ + "$schema": "ToBeDone", + "metadata": { + "label": "sample-audio-control", + "info": "Provide Default Audio Policy for Multimedia, Navigation and Emergency", + "version": "1.0" + }, + "onload": { + "label": "onload-config", + "info": "onload initialisation config", + "plugin": "audio-ctl-plugin-sample.ctlso", + "actions": [ + { + "label": "onload-sample-cb", + "info": "Call control sharelib install entrypoint", + "callback": "SamplePolicyInstall", + "args": {"arg1" : "first_arg", "nextarg": "second arg value"} + }, { + "label": "onload-sample-api", + "info": "Assert AlsaCore Presence", + "api": "alsacore", + "verb": "ping", + "args": "test" + }, { + "label": "onload-sample-lua", + "info": "Assert LUA Engine", + "lua": "Test_Lua_Engine", + "args": "ping" + } + ] + }, + "controls": + [{ + "label": "multimedia", + "actions": [ + { + "label": "multimedia-control-cb", + "info": "Call Sharelib Sample Callback", + "callback": "samplePolicyCB", + "args": { + "arg1": "snoopy", + "arg2": "toto" + } + }, { + "label": "multimedia-control-ucm", + "info": "Subcall AlSA UCM navigation", + "api": "alsacore", + "verb": "ucmset", + "args": { + "verb": "multimedia" + } + } + ] + }, + { + "label":"navigation", + "action" : { + "api": "alsacore", + "verb": "ucmset", + "args": { + "verb": "navigation" + }, + "optional": true, + "timeout": 100 + } + }, { + "label":"emergency", + "action": { + "api": "alsacore", + "verb": "ucmset", + "args": { + "verb": "emergency" + } + } + }] + , + "events": [ + { + "label": "SampleEvent", + "comment": "define action when receiving a given event", + "actions": [ + { + "info": "Event Callback-1", + "callback": "ProcessEventCB", + "args": { + "arg": "action-1" + } + }, { + "info": "Event Callback-2", + "callback": "ProcessEventCB", + "args": { + "arg": "action-2" + } + } + ] + } + ] +} + diff --git a/conf.d/ctl-rules/onload-control-script.lua b/conf.d/ctl-rules/onload-control-script.lua new file mode 100644 index 0000000..f50bf7a --- /dev/null +++ b/conf.d/ctl-rules/onload-control-script.lua @@ -0,0 +1,95 @@ +--[[ + Copyright (C) 2016 "IoT.bzh" + Author Fulup Ar Foll + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + Provide sample policy function for AGL Advance Audio Agent +--]] + +count=0 + +-- Adjust Volume function of vehicle speed +function Adjust_Volume_Speed (request, speed_meters_second) + + AFB:notice("In Adjust_Volume_Speed speed=%d", speed_meters_second); + + print (string.format("*****(From Lua) Adjust_Volume_Speed speed=%d count=%d", speed_meters_second, count)); + + -- compute volume + volume = speed_meters_second * 2 + count=count+1 + + AFB:success (request, 1234, volume, count, 5678) +end + + +function Test_Binder_CB (result, context) + + local myTable= { ["arg1"] = "myString", ["arg2"] = 1234, ["arg4"] = true, ["arg5"] = 3.1416 } + + AFB:notice ("In Test_Binder_CB", result, context) + + AFB:success (1234, "ABCD", myTable, 5678) + +end + +function Test_Binder_Call_Async () + + local query= { + ["arg1"] = "myString", + ["arg2"] = 1234, + ["arg4"] = true, + ["arg5"] = 3.1416, + } + + AFB:service("alsacore","ping", query, Test_Binder_CB, "myContext") + +end + +function Test_Binder_Call_Sync () + + local query= { + ["arg1"] = "myString", + ["arg2"] = 1234, + ["arg4"] = true, + ["arg5"] = 3.1416, + } + + err= AFB:service_sync ("alsacore","ping", query) + + if (err) then + AFB:fail ("AFB:service_call_sync fail"); + else + AFB:success (1234, "ABCD", myTable) + end + + +end + +function Ping_Test(...) + + print ("Ping_Test script arguments:"); + + for i,v in ipairs(arg) + do + print(" -- ", tostring(v)) + end + + -- push response to client + AFB:success (true, 1234, "ABCD"); + +end + + diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt deleted file mode 100644 index 55ee664..0000000 --- a/data/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -########################################################################### -# Copyright 2017 IoT.bzh -# -# author: Fulup Ar Foll -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -########################################################################### - - - -################################################## -# Control Policy Config file -################################################## -PROJECT_TARGET_ADD(Control_config) - - file(GLOB XML_FILES "*.json") - - add_custom_target(${TARGET_NAME} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - ) - - # check XML schema before pushing config - add_custom_command( - DEPENDS ${XML_FILES} - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - # COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout (Fulup we miss this for JSON) - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND cp -r ${XML_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - ) - - SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES - LABELS "DATA" - OUTPUT_NAME ${TARGET_NAME} - ) diff --git a/data/helloworld-lua-script.lua b/data/helloworld-lua-script.lua deleted file mode 100644 index 7dd0459..0000000 --- a/data/helloworld-lua-script.lua +++ /dev/null @@ -1,41 +0,0 @@ ---[[ - Copyright (C) 2016 "IoT.bzh" - Author Fulup Ar Foll - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Simple API script ---]] - - -- retrieve calling arguments - args= ... - - print ("Helloworld script arguments:") - - - for key,value in pairs(args) - do - print("args: ", key,value) - end - - -- loop on script arguments - --for i=1,#args - --do - -- print(" -- ", i, args[i]) - --end - - - -- return two arguments on top of status - return true, 1234, "ABCD", 5678 - diff --git a/data/onload-control-policy.json b/data/onload-control-policy.json deleted file mode 100644 index 736e188..0000000 --- a/data/onload-control-policy.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "$schema": "ToBeDone", - "metadata": { - "label": "sample-audio-control", - "info": "Provide Default Audio Policy for Multimedia, Navigation and Emergency", - "version": "1.0" - }, - "onload": { - "label": "onload-config", - "info": "onload initialisation config", - "plugin": "audio-ctl-plugin-sample.so", - "actions": [ - { - "label": "onload-sample-cb", - "info": "Call control sharelib install entrypoint", - "callback": "SamplePolicyInstall", - "args": {"arg1" : "first_arg", "nextarg": "second arg value"} - }, { - "label": "onload-sample-api", - "info": "Assert AlsaCore Presence", - "api": "alsacore", - "verb": "ping", - "args": "test" - }, { - "label": "onload-sample-lua", - "info": "Assert LUA Engine", - "lua": "Test_Lua_Engine", - "args": "ping" - } - ] - }, - "controls": - [{ - "label": "multimedia", - "actions": [ - { - "label": "multimedia-control-cb", - "info": "Call Sharelib Sample Callback", - "callback": "samplePolicyCB", - "args": { - "arg1": "snoopy", - "arg2": "toto" - } - }, { - "label": "multimedia-control-ucm", - "info": "Subcall AlSA UCM navigation", - "api": "alsacore", - "verb": "ucmset", - "args": { - "verb": "multimedia" - } - } - ] - }, - { - "label":"navigation", - "action" : { - "api": "alsacore", - "verb": "ucmset", - "args": { - "verb": "navigation" - }, - "optional": true, - "timeout": 100 - } - }, { - "label":"emergency", - "action": { - "api": "alsacore", - "verb": "ucmset", - "args": { - "verb": "emergency" - } - } - }] - , - "events": [ - { - "label": "SampleEvent", - "comment": "define action when receiving a given event", - "actions": [ - { - "info": "Event Callback-1", - "callback": "ProcessEventCB", - "args": { - "arg": "action-1" - } - }, { - "info": "Event Callback-2", - "callback": "ProcessEventCB", - "args": { - "arg": "action-2" - } - } - ] - } - ] -} - diff --git a/data/onload-control-script.lua b/data/onload-control-script.lua deleted file mode 100644 index f50bf7a..0000000 --- a/data/onload-control-script.lua +++ /dev/null @@ -1,95 +0,0 @@ ---[[ - Copyright (C) 2016 "IoT.bzh" - Author Fulup Ar Foll - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Provide sample policy function for AGL Advance Audio Agent ---]] - -count=0 - --- Adjust Volume function of vehicle speed -function Adjust_Volume_Speed (request, speed_meters_second) - - AFB:notice("In Adjust_Volume_Speed speed=%d", speed_meters_second); - - print (string.format("*****(From Lua) Adjust_Volume_Speed speed=%d count=%d", speed_meters_second, count)); - - -- compute volume - volume = speed_meters_second * 2 - count=count+1 - - AFB:success (request, 1234, volume, count, 5678) -end - - -function Test_Binder_CB (result, context) - - local myTable= { ["arg1"] = "myString", ["arg2"] = 1234, ["arg4"] = true, ["arg5"] = 3.1416 } - - AFB:notice ("In Test_Binder_CB", result, context) - - AFB:success (1234, "ABCD", myTable, 5678) - -end - -function Test_Binder_Call_Async () - - local query= { - ["arg1"] = "myString", - ["arg2"] = 1234, - ["arg4"] = true, - ["arg5"] = 3.1416, - } - - AFB:service("alsacore","ping", query, Test_Binder_CB, "myContext") - -end - -function Test_Binder_Call_Sync () - - local query= { - ["arg1"] = "myString", - ["arg2"] = 1234, - ["arg4"] = true, - ["arg5"] = 3.1416, - } - - err= AFB:service_sync ("alsacore","ping", query) - - if (err) then - AFB:fail ("AFB:service_call_sync fail"); - else - AFB:success (1234, "ABCD", myTable) - end - - -end - -function Ping_Test(...) - - print ("Ping_Test script arguments:"); - - for i,v in ipairs(arg) - do - print(" -- ", tostring(v)) - end - - -- push response to client - AFB:success (true, 1234, "ABCD"); - -end - - diff --git a/htdocs/CMakeLists.txt b/htdocs/CMakeLists.txt index 60f6cf8..e85ca3c 100644 --- a/htdocs/CMakeLists.txt +++ b/htdocs/CMakeLists.txt @@ -21,20 +21,20 @@ ################################################## # HTML Testing Files ################################################## -PROJECT_TARGET_ADD(www_test) +PROJECT_TARGET_ADD(htdocs) file(GLOB SOURCE_FILES "*.html" "*.js" "*.jpg" "*.css") add_custom_target(${TARGET_NAME} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + DEPENDS ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} ) add_custom_command( DEPENDS ${SOURCE_FILES} - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND cp -r ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + OUTPUT ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + COMMAND mkdir -p ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + COMMAND touch ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + COMMAND cp -r ${SOURCE_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} ) SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES @@ -42,6 +42,3 @@ PROJECT_TARGET_ADD(www_test) OUTPUT_NAME ${TARGET_NAME} ) - # use only under native Linux when using "make install" - install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DESTINATION .) - diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index a8b33db..225cd8f 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -116,8 +116,8 @@ false - - + + - + - + - + - + - + - + - + - + - + - + Audio-Common build/Controler-afb @@ -192,7 +192,7 @@ - + Audio-Common build/Controler-afb @@ -203,7 +203,7 @@ - + Audio-Common build/Controler-afb @@ -214,7 +214,7 @@ - + Audio-Common build/Controler-afb @@ -225,7 +225,7 @@ - + build/Controler-afb @@ -238,18 +238,18 @@ ex="false" tool="0" flavor2="3"> - + - + - + @@ -257,21 +257,21 @@ - + - + - + @@ -356,11 +356,12 @@ build/Alsa-Plugin/Alsa-Policy-Hook - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 MAX_SND_CARD=16 PIC @@ -381,11 +382,12 @@ build/Alsa-afb - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 MAX_SND_CARD=16 TLV_BYTE_SIZE=256 @@ -405,11 +407,12 @@ build/Audio-Common - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 MAX_SND_CARD=16 TLV_BYTE_SIZE=256 @@ -442,11 +445,12 @@ /usr/include/lua5.3 - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 MAX_SND_CARD=16 TLV_BYTE_SIZE=256 @@ -477,11 +481,12 @@ build/HAL-afb/HAL-interface - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 TLV_BYTE_SIZE=256 @@ -512,11 +517,12 @@ build/HAL-afb/HDA-intel - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 TLV_BYTE_SIZE=256 hal_intel_hda_EXPORTS @@ -536,11 +542,12 @@ build/HAL-afb/Jabra-Solemate - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 TLV_BYTE_SIZE=256 hal_jabra_usb_EXPORTS @@ -560,11 +567,12 @@ build/HAL-afb/Scarlett-Focusrite - CONTROL_DISPATCH_FILE="onload-control-policy.json" - CONTROL_DISPATCH_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Controler-afb:/usr/local/audio-bindings/controler" - CONTROL_LUA_PATH="/etc/default/audio-agent/policy:/home/fulup/.config/audio-agent:/usr/local/audio-agent/policy:/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data" + CONTROL_CONFIG_FILE="onload-control-policy.json" + CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d:/usr/local/audio-bindings/config" + CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/data:/etc/default/audio-bindings/lua:/usr/local/audio-bindings/lua" CONTROL_MAXPATH_LEN=255 CONTROL_PLUGIN_PATH="/home/fulup/opt/audio-bindings/controler:/usr/lib/audio-bindings" + CTL_PLUGIN_MAGIC=2468013579 MAX_LINEAR_DB_SCALE=24 TLV_BYTE_SIZE=256 hal_scalett_usb_EXPORTS -- cgit 1.2.3-korg