Skip to content

Commit b0ba12f

Browse files
authored
Vector: Skip the can_op_mode check if the device reports can_op_mode=0 (#1678)
1 parent d2dc07d commit b0ba12f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

can/interfaces/vector/canlib.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -538,16 +538,19 @@ def _check_can_settings(
538538
)
539539

540540
# check CAN operation mode
541-
if fd:
542-
settings_acceptable &= bool(
543-
bus_params_data.can_op_mode
544-
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CANFD
545-
)
546-
elif bus_params_data.can_op_mode != 0: # can_op_mode is always 0 for cancaseXL
547-
settings_acceptable &= bool(
548-
bus_params_data.can_op_mode
549-
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CAN20
550-
)
541+
# skip the check if can_op_mode is 0
542+
# as it happens for cancaseXL, VN7600 and sometimes on other hardware (VN1640)
543+
if bus_params_data.can_op_mode:
544+
if fd:
545+
settings_acceptable &= bool(
546+
bus_params_data.can_op_mode
547+
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CANFD
548+
)
549+
else:
550+
settings_acceptable &= bool(
551+
bus_params_data.can_op_mode
552+
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CAN20
553+
)
551554

552555
# check bitrates
553556
if bitrate:

0 commit comments

Comments
 (0)