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.
PUF implements automatic forwarding of car/camera buses based on "universal" vehicle fingerprints. Initial support is for Hyundai/Kia, but PUF is designed to be easily extended to other manufacturers and for more complicated forwarding if necessary.
The Hyundai fingerprint included was created by taking the intersection of all of the existing Hyundai fingerprints and then doing a frequency analysis of the remaining packets on the CAN bus for my vehicle. Only messages with a rate at least 10% of the maximum message rate on bus 0 were included in the final fingerprint.
There's probably a lot of things here that could be done better, but my C-fu is pretty poor so please feel free to criticize, comment, fix or extend as you see fit. I can say however that it appears to work well. It properly identifies my Kia with the included fingerprints, and if I change any single value in the fingerprint it does not forward. Connecting and disconnecting the USB cable works as expected, with the exception that the forwarding is actually predicated upon a lack of USB transfer/control messages and not a disconnection event. This means that shutting down boardd on the Eon is actually enough to get it to switch over into forwarding mode.
There's some constant cpu time spent processing fingerprints when the USB connection is not active, but if necessary I suppose that could be easily overcome by time-limiting the fingerprinting process or using some kind of ignition hook.
Switches? Who needs stinking switches?