Update Neousys available configs detection by j-c-cook · Pull Request #1744 · hardbyte/python-can
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.
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?
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
marked this pull request as ready for review
Looks good, It's still a draft, can i merge?
Removed draft indication. Yes, I think merging is appropriate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters