From 14a0633bcf46248b3892a5ab249338fd1cd3a6aa Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 7 Jun 2017 15:41:00 +0200 Subject: Add some useful DEBUG information for read frames Change-Id: I026111942b4b8486b46f56d5fc92fcebde4dc91f Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/socketcan-bcm.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'CAN-binder/low-can-binding/utils') 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()); -- cgit 1.2.3-korg