diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-03 17:54:20 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-03 17:54:20 +0200 |
commit | 20db959ba59c541bb433cf0f7f5b12384e7cd0bb (patch) | |
tree | d522e7607feba46326d21631970a31cdcd8a6664 /CAN-binder/low-can-binding/can | |
parent | 4ec4f7330425d5f1e63b6467deb11347dab9699a (diff) |
Keeping raw socket until diagnostic_manager is fully migrated
Change-Id: I8cb170613c003bbdb39240eb809b8cefcad6cb35
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r-- | CAN-binder/low-can-binding/can/can-bus-dev.cpp | 8 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/can/can-bus-dev.hpp | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus-dev.cpp b/CAN-binder/low-can-binding/can/can-bus-dev.cpp index 07f921f2..99cad710 100644 --- a/CAN-binder/low-can-binding/can/can-bus-dev.cpp +++ b/CAN-binder/low-can-binding/can/can-bus-dev.cpp @@ -67,8 +67,16 @@ void can_bus_dev_t::configure() if (can_socket_) { const int timestamp_on = 1; + const int canfd_on = 1; DEBUG(binder_interface, "%s: CAN Handler socket correctly initialized : %d", __FUNCTION__, can_socket_.socket()); + + // try to switch the socket into CAN_FD mode + if (can_socket_.setopt(SOL_CAN_RAW, CAN_RAW_FD_FRAMES, &canfd_on, sizeof(canfd_on)) < 0) + { + NOTICE(binder_interface, "%s: Can not switch into CAN Extended frame format: %s", __FUNCTION__, ::strerror(errno)); + } + if (can_socket_.setopt(SOL_SOCKET, SO_TIMESTAMP, ×tamp_on, sizeof(timestamp_on)) < 0) WARNING(binder_interface, "%s: setsockopt SO_TIMESTAMP error: %s", __FUNCTION__, ::strerror(errno)); } diff --git a/CAN-binder/low-can-binding/can/can-bus-dev.hpp b/CAN-binder/low-can-binding/can/can-bus-dev.hpp index 8b4cf47e..e9c2d207 100644 --- a/CAN-binder/low-can-binding/can/can-bus-dev.hpp +++ b/CAN-binder/low-can-binding/can/can-bus-dev.hpp @@ -22,7 +22,7 @@ #include <string> #include <thread> -#include "../utils/socketcan.hpp" +#include "../utils/socketcan-raw.hpp" class can_bus_t; class can_message_t; @@ -34,7 +34,7 @@ class can_bus_dev_t { private: std::string device_name_; ///< a string identifier identitfying the linux CAN device. - utils::socketcan_t can_socket_; + utils::socketcan_raw_t can_socket_; int index_; |