summaryrefslogtreecommitdiffstats
path: root/binding/hvac-demo-binding.c
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-11-17 15:22:09 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-11-17 15:22:09 +0000
commitb7388d3adaa6b3fdee442f6b4f5ea54de89e932d (patch)
tree2bea046e89e78d211f97bc57de8b0ea03dd27d58 /binding/hvac-demo-binding.c
parentc8185b19e014b586d54a51705f9da42dd1ec9727 (diff)
parent1292f584612281fc084405d8a4722b38ee5be36c (diff)
Merge "Fix CAN device configuration" into halibuthalibut_8.0.4halibut_8.0.3halibut/8.0.4halibut/8.0.38.0.48.0.3
Diffstat (limited to 'binding/hvac-demo-binding.c')
-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);