aboutsummaryrefslogtreecommitdiffstats
path: root/src/can/can-bus-dev.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-08 23:10:44 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:10:40 +0100
commitccd244c10988cd59d6f0b35e1b83a5eebd7bfb01 (patch)
tree3b8584ac6569fc43be3558950fca99242b57f222 /src/can/can-bus-dev.cpp
parent8cc56c40c96a63b157ee11ac7fd2494ffa63357d (diff)
Cleaning old can_bus_dev_t now implemented
separatly Change-Id: I4529100f118afe25aee747d36a77dc5b533878a5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> Conflicts: src/can/can-bus.hpp
Diffstat (limited to 'src/can/can-bus-dev.cpp')
-rw-r--r--src/can/can-bus-dev.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/can/can-bus-dev.cpp b/src/can/can-bus-dev.cpp
index 5166550e..c64242d5 100644
--- a/src/can/can-bus-dev.cpp
+++ b/src/can/can-bus-dev.cpp
@@ -24,15 +24,15 @@
#include "can-bus-dev.hpp"
#include "low-can-binding.hpp"
-/// @brief Class constructor
+/// @brief Class constructor
/// @param dev_name String representing the device name into the linux /dev tree
can_bus_dev_t::can_bus_dev_t(const std::string& dev_name)
: device_name_{dev_name}
{
}
-/// @brief Open the can socket and returning it
-/// @return -1
+/// @brief Open the can socket and returning it
+/// @return -1
int can_bus_dev_t::open()
{
const int canfd_on = 1;
@@ -47,15 +47,15 @@ int can_bus_dev_t::open()
if (can_socket_)
{
DEBUG(binder_interface, "CAN Handler socket correctly initialized : %d", can_socket_.socket());
-
+
// Set timeout for read
can_socket_.setopt(SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout));
-
+
// Set timestamp for receveid frame
if (can_socket_.setopt(SOL_SOCKET, SO_TIMESTAMP, &timestamp_on, sizeof(timestamp_on)) < 0)
WARNING(binder_interface, "setsockopt SO_TIMESTAMP error: %s", ::strerror(errno));
DEBUG(binder_interface, "Switch CAN Handler socket to use fd mode");
-
+
// 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)
{