aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp13
-rw-r--r--low-can-binding/utils/socketcan.hpp1
2 files changed, 6 insertions, 8 deletions
diff --git a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp
index c0385c4c..8ce16fbd 100644
--- a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp
+++ b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp
@@ -21,6 +21,7 @@
#include <iostream>
#include <algorithm>
#include <vector>
+
#include "./socketcan-j1939.hpp"
#include "socketcan-j1939-addressclaiming.hpp"
@@ -90,16 +91,12 @@ namespace utils
*/
void socketcan_j1939_t::define_opt(bool promisc, bool recv_own_msgs, bool broadcast)
{
- int promisc_i = 0;
- int recv_own_msgs_i = 0;
- int broadcast_i = 0;
-
- if(promisc) promisc_i = 1;
- if(recv_own_msgs) recv_own_msgs_i=1;
- if(broadcast) broadcast_i = 1;
+ int promisc_i = promisc ? 1 : 0;
+ //int recv_own_msgs_i = recv_own_msgs ? 1 : 0;
+ int broadcast_i = broadcast ? 1 : 0;
setopt(SOL_CAN_J1939, SO_J1939_PROMISC, &promisc_i, sizeof(promisc_i));
- setopt(SOL_CAN_J1939, SO_J1939_RECV_OWN, &recv_own_msgs_i, sizeof(recv_own_msgs_i));
+ //setopt(SOL_CAN_J1939, SO_J1939_RECV_OWN, &recv_own_msgs_i, sizeof(recv_own_msgs_i));
setopt(SOL_SOCKET, SO_BROADCAST, &broadcast_i, sizeof(broadcast_i));
}
diff --git a/low-can-binding/utils/socketcan.hpp b/low-can-binding/utils/socketcan.hpp
index a3b31591..7b2501af 100644
--- a/low-can-binding/utils/socketcan.hpp
+++ b/low-can-binding/utils/socketcan.hpp
@@ -21,6 +21,7 @@
#include <sys/socket.h>
#include <linux/can/bcm.h>
+#include <linux/sockios.h>
#include <string.h>
#include "../binding/low-can-hat.hpp"