Skip to content

Commit

Permalink
Vector: Skip the can_op_mode check if the device reports can_op_mode=0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca authored Oct 12, 2023
1 parent d2dc07d commit b0ba12f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions can/interfaces/vector/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,16 +538,19 @@ def _check_can_settings(
)

# check CAN operation mode
if fd:
settings_acceptable &= bool(
bus_params_data.can_op_mode
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CANFD
)
elif bus_params_data.can_op_mode != 0: # can_op_mode is always 0 for cancaseXL
settings_acceptable &= bool(
bus_params_data.can_op_mode
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CAN20
)
# skip the check if can_op_mode is 0
# as it happens for cancaseXL, VN7600 and sometimes on other hardware (VN1640)
if bus_params_data.can_op_mode:
if fd:
settings_acceptable &= bool(
bus_params_data.can_op_mode
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CANFD
)
else:
settings_acceptable &= bool(
bus_params_data.can_op_mode
& xldefine.XL_CANFD_BusParams_CanOpMode.XL_BUS_PARAMS_CANOPMODE_CAN20
)

# check bitrates
if bitrate:
Expand Down

0 comments on commit b0ba12f

Please sign in to comment.