From 20db959ba59c541bb433cf0f7f5b12384e7cd0bb Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 3 May 2017 17:54:20 +0200 Subject: Keeping raw socket until diagnostic_manager is fully migrated Change-Id: I8cb170613c003bbdb39240eb809b8cefcad6cb35 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/can/can-bus-dev.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'CAN-binder/low-can-binding/can/can-bus-dev.cpp') 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 07f921f..99cad71 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)); } -- cgit 1.2.3-korg