aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-06 11:31:50 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2019-11-06 11:31:50 +0100
commitcb7af6003d51852dc4d5db84da66c7d761b45f4a (patch)
treeeb4f2946d1a5a0aa3493bb379784c2bb221a1475
parentbd8c71dd8eb67e0f043636bedab9ad3b0cc8109f (diff)
j1939: update using latest commits in linux-next
Change-Id: Id01e92330582da299af675676987cd667272e2c5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-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"