/// timestamp received messages and pass the socket to FD mode.
///
/// @return -1 if something wrong.
-int can_bus_dev_t::open_raw()
+int can_bus_dev_t::open(bool bcm)
{
const int canfd_on = 1;
const int timestamp_on = 1;
struct timeval timeout;
DEBUG(binder_interface, "open_raw: CAN Handler socket : %d", can_socket_.socket());
- can_socket_.open(device_name_);
+ return can_socket_.open(device_name_, bcm);
// Set some option on the socket : timeout, timestamp and canfd frame usage.
if (can_socket_)
else
{
ERROR(binder_interface, "send_can_message: socket not initialized. Attempt to reopen can device socket.");
- open_raw();
+ open(true);
return -1;
}
return 0;
else
{
ERROR(binder_interface, "send_can_message: socket not initialized. Attempt to reopen can device socket.");
- open_raw();
+ open(true);
}
return false;
}
for(const auto& device : devices_name)
{
can_bus_t::can_devices_[device] = std::make_shared<can_bus_dev_t>(device, i);
- if (can_bus_t::can_devices_[device]->open_raw() == 0)
+ if (can_bus_t::can_devices_[device]->open(true) >= 0)
{
DEBUG(binder_interface, "Start reading thread");
NOTICE(binder_interface, "%s device opened and reading", device.c_str());