Added debugging messages.
authorRomain Forlot <romain.forlot@iot.bzh>
Tue, 28 Feb 2017 15:06:15 +0000 (16:06 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Tue, 28 Feb 2017 20:45:49 +0000 (21:45 +0100)
Change-Id: I42d2576355f69ac167b170a2994c7360d8449fb7
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
src/can-bus.cpp

index 84cbaaa..f4a6d55 100644 (file)
@@ -18,6 +18,7 @@
 #include "can-bus.hpp"
 
 #include <map>
+#include <cerrno>
 #include <vector>
 #include <string>
 #include <fcntl.h>
@@ -28,6 +29,9 @@
 #include <json-c/json.h>
 #include <linux/can/raw.h>
 
+#include "can-decoder.hpp"
+#include "openxc-utils.hpp"
+
 extern "C"
 {
        #include <afb/afb-binding.h>
@@ -164,13 +168,14 @@ int can_bus_t::init_can_dev()
                for(const auto& device : devices_name)
                {
                        can_bus_dev_t can_bus_device_handler(device);
-                       if (can_bus_device_handler.open())
+                       if (can_bus_device_handler.open() == 0)
                        {
                                i++;
+                               DEBUG(binder_interface, "Start reading thread");
                                can_bus_device_handler.start_reading(std::ref(*this));
                        }
                        else
-                               ERROR(binder_interface, "Can't open device %s", device);
+                               ERROR(binder_interface, "Can't open device %s", device.c_str());
                }
 
                NOTICE(binder_interface, "Initialized %d/%d can bus device(s)", i, t);
@@ -197,7 +202,7 @@ std::vector<std::string> can_bus_t::read_conf()
                std::fread(&fd_conf_content[0], 1, fd_conf_content.size(), fd);
                std::fclose(fd);
 
-               DEBUG(binder_interface, "Conf file content : %s", fd_conf_content.c_str());
+               DEBUG(binder_interface, "Configuration file content : %s", fd_conf_content.c_str());
                jo = json_tokener_parse(fd_conf_content.c_str());
 
                if (jo == NULL || !json_object_object_get_ex(jo, "canbus", &canbus))