summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-cb.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
index 0671f9eb..5a877af5 100644
--- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp
+++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
@@ -85,10 +85,12 @@ int read_message(sd_event_source *event_source, int fd, uint32_t revents, void *
utils::socketcan_bcm_t& s = can_subscription->get_socket();
s >> cm;
- push_n_notify(cm);
+ // Sure we got a valid CAN message ?
+ if(! cm.get_id() == 0 && ! cm.get_length() == 0)
+ {push_n_notify(cm);}
}
- /* check if error or hangup */
+ // check if error or hangup
if ((revents & (EPOLLERR|EPOLLRDHUP|EPOLLHUP)) != 0)
{
sd_event_source_unref(event_source);