Skip to content

Commit 9160f45

Browse files
zariiii9003mergify[bot]
authored andcommitted
fix #1299
1 parent 638d81a commit 9160f45

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

can/io/asc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ def _process_classic_can_frame(
202202
_, dlc_str = rest_of_message.split(None, 1)
203203
data = ""
204204

205-
dlc = int(dlc_str, self._converted_base)
205+
dlc = dlc2len(int(dlc_str, self._converted_base))
206206
msg_kwargs["dlc"] = dlc
207-
self._process_data_string(data, dlc, msg_kwargs)
207+
self._process_data_string(data, min(8, dlc), msg_kwargs)
208208

209209
return Message(**msg_kwargs)
210210

test/data/issue_1299.asc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
date Thu Apr 28 10:44:52.480 am 2022
2+
base hex timestamps absolute
3+
internal events logged
4+
// version 12.0.0
5+
Begin TriggerBlock Thu Apr 28 10:44:52.480 am 2022
6+
0.000000 Start of measurement
7+
13.258199 1 180 Tx d 8 6A 00 00 00 00 00 00 00 Length = 244016 BitCount = 125 ID = 384
8+
13.258433 1 221 Tx d 8 C2 4A 05 81 00 00 15 10 Length = 228016 BitCount = 117 ID = 545
9+
13.258671 1 3FF Tx d D 55 AA 01 02 03 04 05 06 Length = 232016 BitCount = 119 ID = 1023
10+
13.258907 1 F4 Tx d 8 8A 1A 0D F2 13 00 00 07 Length = 230016 BitCount = 118 ID = 244
11+
End TriggerBlock

test/logformats_test.py

+3
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,9 @@ def test_ignore_comments(self):
561561
def test_no_triggerblock(self):
562562
_msg_list = self._read_log_file("issue_1256.asc")
563563

564+
def test_can_dlc_greater_than_8(self):
565+
_msg_list = self._read_log_file("issue_1299.asc")
566+
564567

565568
class TestBlfFileFormat(ReaderWriterTest):
566569
"""Tests can.BLFWriter and can.BLFReader.

0 commit comments

Comments
 (0)