8000 Update Neousys available configs detection by j-c-cook · Pull Request #1744 · hardbyte/python-can · GitHub
[go: up one dir, main page]

Skip to content

Update Neousys available configs detection #1744

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
Mar 15, 2024

Conversation

j-c-cook
Copy link
Contributor

The modification ensures that the Neousys interface's method '_detect_available_configs' function checks if NEOUSYS_CANLIB is None. If it's None, no configuration is returned, and if it's not, the usual configuration with the interface as 'neousys' and channel as 0 is returned. This provides an additional layer of error handling.

closes #1738

The modification ensures that the Neousys interface's method '_detect_available_configs' function checks if NEOUSYS_CANLIB is None. If it's None, no configuration is returned, and if it's not, the usual configuration with the interface as 'neousys' and channel as 0 is returned. This provides an additional layer of error handling.
@j-c-cook
Copy link
Contributor Author

The change above will stop the can.detect_available_configs() function from returning the neousys interface as an option if the driver is unavailable.

Unfortunately, the detection does not query the hardware for an available channel. However, if someone does construct a neousys bus and has the driver available, then there is a couple statements that will handle the improper mounting of the hardware.

if (
NEOUSYS_CANLIB.CAN_Setup(
channel, byref(self.init_config), sizeof(self.init_config)
)
== 0
):
raise CanInitializationError("Neousys CAN bus Setup Error")

if NEOUSYS_CANLIB.CAN_Start(channel) == 0:
raise CanInitializationError("Neousys CAN bus Start Error")

@zariiii9003 Would you like a deeper dive into this topic or is 4e2bb4b an adequate fix to #1738?

Copy link
Collaborator
@zariiii9003 zariiii9003 left a comment

Choose a reason for hiding this comment

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

Looks good, It's still a draft, can i merge?

@j-c-cook j-c-cook marked this pull request as ready for review March 14, 2024 18:54
@j-c-cook
Copy link
Contributor Author

Looks good, It's still a draft, can i merge?

Removed draft indication. Yes, I think merging is appropriate.

@zariiii9003 zariiii9003 merged commit 71f54cc into hardbyte:main Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can.detect_available_configs() returns neousys interface when not connected
3 participants
0