Add restart_ms option for automatic bus-off recovery - #1
Open
CaptChrisD wants to merge 1 commit into
Open
Conversation
Add a `:restart_ms` config option (default 0, preserving the kernel default of disabled) that is passed to `ip link set ... type can` as `restart-ms`. A positive value lets the CAN controller automatically rejoin the bus after a bus-off condition instead of staying off until the interface is manually cycled. Also replace the placeholder test with real coverage of normalize/1 and to_raw_config/3, add a hermetic test config, and document the options. Bump version to 0.2.0.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
:restart_msconfig option toVintageNetSocketCANso CAN controllers can automatically recover from a bus-off condition.When a CAN controller's transmit error counter crosses the bus-off threshold (e.g. it powers up before any other node is present to ACK its frames), it goes bus-off. With the kernel default
restart-ms 0, it stays off until the interface is manually cycled — on a Nerves device that effectively means a reboot. Passing a positiverestart-mstoip link set ... type canlets the controller automatically rejoin the bus.Changes
:restart_ms(integer) to the validated options, defaulting to0. The default preserves existing behavior (kernel default, auto-recovery disabled).restart-ms <value>through to theip link set ... type canup command.normalize/1andto_raw_config/3. Tests that shell out toipare tagged:requires_ipand auto-excluded whenipisn't on PATH.mix testruns hermetically on a host.Usage