From: Romain Forlot Date: Wed, 26 Apr 2017 16:24:03 +0000 (+0200) Subject: Finish to read stream and fill the destination object. X-Git-Tag: 3.99.1~122 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=fdcc36f1b9dbc0cb95cf4b968823c2be4d7227d0;p=apps%2Flow-level-can-service.git Finish to read stream and fill the destination object. Use AFB log system Change-Id: I5aa727ce7f9db5b6f18df5957f31f37d9af88d20 Signed-off-by: Romain Forlot --- 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; }