From 43cc23cd9d0986ae370f5839aa952c6e3eb196d0 Mon Sep 17 00:00:00 2001 From: Arthur GUYADER Date: Thu, 12 Dec 2019 18:12:01 +0100 Subject: j1939: Follow updates of the kernel This commit patch j1939 feature after the update of the kernel from linux-can-next to mainline. Now promisc option removes filter of the bind. The option is now a parameter in the event_filter. The feature recv_own isn't available, you can't receive on the same socket an emit frame from you. Not a big problem because receive and send method use two different sockets in the implementation. Change-Id: I5ac410177c1512090827870300b8aa1679477b84 Signed-off-by: Arthur GUYADER Signed-off-by: Romain Forlot --- low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp') diff --git a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp index 90e68218..0e5a671b 100644 --- a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp +++ b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp @@ -87,18 +87,16 @@ namespace utils /** * @brief Define some parameters on the socket * - * @param promisc - Allows to accept all packets that the socket receives even if they are not addressed directly to it - * @param recv_own_msgs - Allows you to receive your own packets * @param broadcast - Allows to write message with address brodcast (255) + * @param promisc - Allows to accept all packets that the socket receives even if they are not addressed directly to it */ - void socketcan_j1939_t::define_opt(bool promisc, bool recv_own_msgs, bool broadcast) + void socketcan_j1939_t::define_opt(bool broadcast, bool promisc) { - int promisc_i = promisc ? 1 : 0; - //int recv_own_msgs_i = recv_own_msgs ? 1 : 0; int broadcast_i = broadcast ? 1 : 0; + int promisc_i = promisc ? 1 : 0; - setopt(SOL_CAN_J1939, SO_J1939_PROMISC, &promisc_i, sizeof(promisc_i)); setopt(SOL_SOCKET, SO_BROADCAST, &broadcast_i, sizeof(broadcast_i)); + setopt(SOL_CAN_J1939, SO_J1939_PROMISC, &promisc_i, sizeof(promisc_i)); } -- cgit 1.2.3-korg