You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The class BLFReader from can.io.blf is implemented using Toby Lorenz's Vector_BLF. The implementation for reading CAN messages especially for CAN_MESSAGE and CAN_MESSAGE2 is incorrect.
In this library
The code in this library related to this is as follows:
Both versions have a is.read(reinterpret_cast<char *>(data.data()), static_cast<std::streamsize>(data.size())); that does not slice the data based on DLC.
To Reproduce
Instantiate the BLFReader class:
data=BLFReader(blffile_path)
Expected behavior
Bytes extracted from the data should be 8 bytes
bytearray(b'\xff\x00\xff\x00\x00\x00\x08\x00')
In the current version:
Bytes extracted from the data are 3 bytes because of the DLC slicing
bytearray(b'\xff\x00\xff')
This causes errors in decoding the data using cantools which reads the length of data as 8 bytes from the DBC file.
Additional context
OS and version: Ubuntu 22.04
Python version: 3.10.12
python-can version: 4.4.2
python-can interface/s (if applicable):
The text was updated successfully, but these errors were encountered:
Describe the bug
The class
BLFReader
fromcan.io.blf
is implemented using Toby Lorenz's Vector_BLF. The implementation for reading CAN messages especially forCAN_MESSAGE
andCAN_MESSAGE2
is incorrect.In this library
The code in this library related to this is as follows:
data=can_data[:dlc]
uses the data length code to slice data bytes.In Vector_BLF
For
CAN_MESSAGE
:For
CAN_MESSAGE2
:Both versions have a
is.read(reinterpret_cast<char *>(data.data()), static_cast<std::streamsize>(data.size()));
that does not slice the data based on DLC.To Reproduce
Instantiate the
BLFReader
class:Expected behavior
Bytes extracted from the data should be 8 bytes
In the current version:
Bytes extracted from the data are 3 bytes because of the DLC slicing
This causes errors in decoding the data using cantools which reads the length of data as 8 bytes from the DBC file.
Additional context
OS and version: Ubuntu 22.04
Python version: 3.10.12
python-can version: 4.4.2
python-can interface/s (if applicable):
The text was updated successfully, but these errors were encountered: