Skip to content

Commit 3d602a3

Browse files
fix pylint issues
1 parent 3013dd5 commit 3d602a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

can/interfaces/socketcan/socketcan.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def build_can_frame(msg: Message) -> bytes:
224224
flags = 0
225225

226226
# The socketcan code identify the received FD frame by the packet length.
227-
# Therefore, padding to the data length is performed according to the message type (Classic / FD)
227+
# So, padding to the data length is performed according to the message type (Classic / FD)
228228
if msg.is_fd:
229229
flags |= constants.CANFD_FDF
230230
max_len = constants.CANFD_MAX_DLEN
@@ -242,6 +242,8 @@ def build_can_frame(msg: Message) -> bytes:
242242
data_len = msg.dlc
243243
else:
244244
data_len = min(i for i in can.util.CAN_FD_DLC if i >= len(msg.data))
245+
header = CAN_FRAME_HEADER_STRUCT.pack(can_id, data_len, flags, msg.dlc)
246+
return header + data
245247

246248

247249
def build_bcm_header(
@@ -330,8 +332,7 @@ def dissect_can_frame(frame: bytes) -> Tuple[int, int, int, bytes]:
330332
# Allow deprecated can frames with old struct
331333
if (
332334
data_len == constants.CAN_MAX_DLEN
333-
and len8_dlc > constants.CAN_MAX_DLEN
334-
and len8_dlc <= constants.CAN_MAX_RAW_DLC
335+
and constants.CAN_MAX_DLEN < len8_dlc <= constants.CAN_MAX_RAW_DLC
335336
):
336337
can_dlc = len8_dlc
337338
else:

0 commit comments

Comments
 (0)