From 80e2edcae145354693de8fd59f652b5708ab737f Mon Sep 17 00:00:00 2001 From: Crestani Fabio FRD DAXE2 Date: Fri, 8 Jan 2021 12:34:19 +0100 Subject: [PATCH 1/2] Add msg direction for CAN-FD in BlfReader --- can/io/blf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/can/io/blf.py b/can/io/blf.py index eb6c69210..47514cad1 100644 --- a/can/io/blf.py +++ b/can/io/blf.py @@ -311,8 +311,7 @@ def _parse_data(self, data): channel=channel - 1, ) elif obj_type == CAN_FD_MESSAGE_64: - members = unpack_can_fd_64_msg(data, pos)[:7] - channel, dlc, valid_bytes, _, can_id, _, fd_flags = members + channel, dlc, valid_bytes, _, can_id, _, fd_flags, _, _, _, _, _, direction, _, _ = unpack_can_fd_64_msg(data, pos) pos += can_fd_64_msg_size yield Message( timestamp=timestamp, @@ -320,6 +319,7 @@ def _parse_data(self, data): is_extended_id=bool(can_id & CAN_MSG_EXT), is_remote_frame=bool(fd_flags & 0x0010), is_fd=bool(fd_flags & 0x1000), + is_rx=not direction, bitrate_switch=bool(fd_flags & 0x2000), error_state_indicator=bool(fd_flags & 0x4000), dlc=dlc2len(dlc), From 2c07d543ab3c21332b91561d33507ce6aa52896f Mon Sep 17 00:00:00 2001 From: Fabio Crestani Date: Tue, 8 Jun 2021 23:27:23 +0200 Subject: [PATCH 2/2] Fix test for CAN-FD direction in BLF reader --- test/logformats_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/logformats_test.py b/test/logformats_test.py index fbca43306..d1da03da2 100644 --- a/test/logformats_test.py +++ b/test/logformats_test.py @@ -602,6 +602,7 @@ def test_can_fd_message_64(self): channel=0x10, dlc=64, is_fd=True, + is_rx=False, bitrate_switch=True, error_state_indicator=True, )