Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASCReader: Fix error for DLC > 8 #1301

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions can/io/asc.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ def _process_classic_can_frame(
_, dlc_str = rest_of_message.split(None, 1)
data = ""

dlc = int(dlc_str, self._converted_base)
dlc = dlc2len(int(dlc_str, self._converted_base))
msg_kwargs["dlc"] = dlc
self._process_data_string(data, dlc, msg_kwargs)
self._process_data_string(data, min(8, dlc), msg_kwargs)

return Message(**msg_kwargs)

Expand Down
11 changes: 11 additions & 0 deletions test/data/issue_1299.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
date Thu Apr 28 10:44:52.480 am 2022
base hex timestamps absolute
internal events logged
// version 12.0.0
Begin TriggerBlock Thu Apr 28 10:44:52.480 am 2022
0.000000 Start of measurement
13.258199 1 180 Tx d 8 6A 00 00 00 00 00 00 00 Length = 244016 BitCount = 125 ID = 384
13.258433 1 221 Tx d 8 C2 4A 05 81 00 00 15 10 Length = 228016 BitCount = 117 ID = 545
13.258671 1 3FF Tx d D 55 AA 01 02 03 04 05 06 Length = 232016 BitCount = 119 ID = 1023
13.258907 1 F4 Tx d 8 8A 1A 0D F2 13 00 00 07 Length = 230016 BitCount = 118 ID = 244
End TriggerBlock
3 changes: 3 additions & 0 deletions test/logformats_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ def test_ignore_comments(self):
def test_no_triggerblock(self):
_msg_list = self._read_log_file("issue_1256.asc")

def test_can_dlc_greater_than_8(self):
_msg_list = self._read_log_file("issue_1299.asc")


class TestBlfFileFormat(ReaderWriterTest):
"""Tests can.BLFWriter and can.BLFReader.
Expand Down