summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--binding/hvac-demo-binding.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/binding/hvac-demo-binding.c b/binding/hvac-demo-binding.c
index 5a6debd..1d5e6ac 100644
--- a/binding/hvac-demo-binding.c
+++ b/binding/hvac-demo-binding.c
@@ -278,13 +278,13 @@ static int parse_config()
}
// Extract can device
- json_object_object_get_ex(jobj, "can_device", &candevice); {
+ if (json_object_object_get_ex(jobj, "can_device", &candevice)) {
can_dev.name = json_object_get_string(candevice);
}
+ AFB_INFO("Using CAN device %s\n", can_dev.name);
// return 0 if all succeeded
return 0;
-
}
/*
@@ -700,14 +700,16 @@ static void set(afb_req_t request)
static int bindingServicePreInit(afb_api_t api)
{
- return open_can_dev();
+ if(parse_config() != 0)
+ AFB_WARNING("Default values are being used!\n");
+
+ open_can_dev();
}
static int bindingServiceInit(afb_api_t api)
{
event = afb_daemon_make_event("language");
- if(parse_config() != 0)
- AFB_WARNING("Default values are being used!\n");
+
if(afb_daemon_require_api("identity", 1))
return -1;
return afb_api_call_sync(api, "identity", "subscribe", json_object_new_object(), NULL, NULL, NULL);