diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c index b27246c..4e35a91 100644 --- a/daemon/x52d_config.c +++ b/daemon/x52d_config.c @@ -40,3 +40,15 @@ void x52d_config_load(const char *cfg_file) } } +#define CFG(section, key, name, parser, def) \ +static void x52d_cfg_set_ ## section ## _ ## key(typeof(x52d_config . name) param) \ +{ \ + PINELOG_TRACE("Calling set " #section ":" #key); \ +} +#include "x52d_config.def" + +void x52d_config_apply(void) +{ + #define CFG(section, key, name, parser, def) x52d_cfg_set_ ## section ## _ ## key(x52d_config . name); + #include "x52d_config.def" +} diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h index 0987c3f..ebcca2f 100644 --- a/daemon/x52d_config.h +++ b/daemon/x52d_config.h @@ -48,5 +48,6 @@ int x52d_config_apply_overrides(struct x52d_config *cfg); void x52d_config_clear_overrides(void); void x52d_config_load(const char *cfg_file); +void x52d_config_apply(void); #endif // !defined X52D_CONFIG_H diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index 24f4ab8..5faa24f 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -135,6 +135,9 @@ int main(int argc, char **argv) // Start device threads x52d_dev_init(); + // Apply configuration + x52d_config_apply(); + for(;;) { // TODO: Replace with main event loop // Let all threads run in background forever