Skip to content

skip the can_op_mode check if the device reports can_op_mode=0 #1678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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