Skip to content

Disable error frames when ignore_rx_error_frames is set #1907

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

polymorf
Copy link

@polymorf polymorf commented Jan 4, 2025

Changing ignore_rx_error_frames for socketcan interfaces has no effect since error filter is only applied when ignore_rx_error_frames is false

@@ -702,6 +702,14 @@ def __init__(
)
except OSError as error:
log.error("Could not enable error frames (%s)", error)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could simplify this a bit like this:

            # set error frame filter
            try:
                self.socket.setsockopt(
                    constants.SOL_CAN_RAW,
                    constants.CAN_RAW_ERR_FILTER,
                    0x0 if ignore_rx_error_frames else 0x1FFFFFFF,
                )
            except OSError as error:
                log.error("Could not enable error frame filter (%s)", error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants