diff options
-rw-r--r-- | CAN-binder/low-can-binding/utils/socketcan.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp index 3385f0c..486c34f 100644 --- a/CAN-binder/low-can-binding/utils/socketcan.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan.cpp @@ -145,7 +145,7 @@ namespace utils struct can_frame frames; } msg; - struct sockaddr_can addr = s.get_tx_address(); + const struct sockaddr_can& addr = s.get_tx_address(); socklen_t addrlen = sizeof(addr); struct ifreq ifr; @@ -153,11 +153,12 @@ namespace utils ifr.ifr_ifindex = addr.can_ifindex; ioctl(s.socket(), SIOCGIFNAME, &ifr); - printf("Data available: %i bytes read\n", (int)nbytes); - printf("read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X\n", ifr.ifr_name, msg.msg_head.can_id, msg.frames.len, + DEBUG(binder_interface, "Data available: %i bytes read", (int)nbytes); + 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]); - + cm = ::can_message_t::convert_from_frame(msg.frames , nbytes-sizeof(struct bcm_msg_head)); + return s; } |