summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-07 15:41:00 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-07 15:41:00 +0200
commit14a0633bcf46248b3892a5ab249338fd1cd3a6aa (patch)
tree7a759cf7b72c2fd4334bca13f7a636cfe4cb9c12 /CAN-binder/low-can-binding
parentcb3d8b10b7c397184b70791c000582510215780c (diff)
Add some useful DEBUG information for read frames
Change-Id: I026111942b4b8486b46f56d5fc92fcebde4dc91f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding')
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
index 2b00adbd..76bc6acc 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
@@ -79,8 +79,9 @@ namespace utils
ssize_t nbytes = ::recvfrom(s.socket(), &msg, sizeof(msg), 0, (struct sockaddr*)&addr, &addrlen);
ifr.ifr_ifindex = addr.can_ifindex;
ioctl(s.socket(), SIOCGIFNAME, &ifr);
+ long unsigned int frame_size = nbytes-sizeof(struct bcm_msg_head);
- DEBUG(binder_interface, "Data available: %i bytes read", (int)nbytes);
+ DEBUG(binder_interface, "Data available: %li bytes read. BCM head, opcode: %i, can_id: %i, nframes: %i", frame_size, msg.msg_head.opcode, msg.msg_head.can_id, msg.msg_head.nframes);
DEBUG(binder_interface, "read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, msg.msg_head.can_id, msg.frames.can_dlc,
msg.frames.data[0], msg.frames.data[1], msg.frames.data[2], msg.frames.data[3], msg.frames.data[4], msg.frames.data[5], msg.frames.data[6], msg.frames.data[7]);
@@ -88,7 +89,7 @@ namespace utils
ioctl(s.socket(), SIOCGSTAMP, &tv);
uint64_t timestamp = 1000000 * tv.tv_sec + tv.tv_usec;
cm = ::can_message_t::convert_from_frame(msg.frames ,
- nbytes-sizeof(struct bcm_msg_head),
+ frame_size,
timestamp);
cm.set_sub_id((int)s.socket());