Skip to content

[io][asc]: parser / writer using DLC as data length #1245

Description

@jazi007

Describe the bug

Reader
https://github.com/hardbyte/python-can/blob/develop/can/io/asc.py#L197: using DLC (data length code) from ASC as dlc (Data length) in python-can message. I think data_length must be used instead

Writer
https://github.com/hardbyte/python-can/blob/develop/can/io/asc.py#L384: inverse is done here. instead len2dlc(msg.dlc)

To Reproduce

asc_bug.py at python-can root

from pathlib import Path
from can import LogReader

if __name__ == "__main__":
    path = Path(__file__).parent / "test" / "data" / "test_CanFdMessage64.asc"
    reader = LogReader(path)
    for msg in reader:
        print(msg)

output:

Timestamp:       30.506898        ID: 04ee    S Rx     F    EI    DL: 15    a1 02 03 04 00 00 00 00 00 00 00 00 00 00 00    Channel: 3
Timestamp:       31.506898    ID: 1c4d80a7    X Rx     F BS       DL: 15    b1 02 03 04 00 00 00 00 00 00 00 00 00 00 00    Channel: 3

In the test_CanFdMessage64.asc frames are 64 bytes length

Expected behavior

frames should have 64 bytes length

Additional context

used python-can is develop branch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions