diff --git a/can/interfaces/systec/structures.py b/can/interfaces/systec/structures.py index 9acc34c2c..c80f21d44 100644 --- a/can/interfaces/systec/structures.py +++ b/can/interfaces/systec/structures.py @@ -52,9 +52,12 @@ class CanMsg(Structure): ), # Receive time stamp in ms (for transmit messages no meaning) ] - def __init__(self, id_=0, frame_format=MsgFrameFormat.MSG_FF_STD, data=None): + def __init__( + self, id_=0, frame_format=MsgFrameFormat.MSG_FF_STD, data=None, dlc=None + ): data = [] if data is None else data - super().__init__(id_, frame_format, len(data), (BYTE * 8)(*data), 0) + dlc = len(data) if dlc is None else dlc + super().__init__(id_, frame_format, dlc, (BYTE * 8)(*data), 0) def __eq__(self, other): if not isinstance(other, CanMsg): diff --git a/can/interfaces/systec/ucanbus.py b/can/interfaces/systec/ucanbus.py index cb0dcc39e..3dff7fda5 100644 --- a/can/interfaces/systec/ucanbus.py +++ b/can/interfaces/systec/ucanbus.py @@ -207,6 +207,7 @@ def send(self, msg, timeout=None): | (MsgFrameFormat.MSG_FF_EXT if msg.is_extended_id else 0) | (MsgFrameFormat.MSG_FF_RTR if msg.is_remote_frame else 0), msg.data, + msg.dlc, ) self._ucan.write_can_msg(self.channel, [message]) except UcanException as exception: