Created
July 31, 2019 08:53
-
-
Save alepez/c43a3498447dbce9e4b084a645ccc639 to your computer and use it in GitHub Desktop.
nmea2kutils
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
#!/bin/bash | |
init() { | |
ip link set can0 type can bitrate 250000 | |
ip link set can0 up | |
} | |
rawdump() { | |
candump can0 | |
} | |
dump() { | |
rawdump | candump2analyzer | |
} | |
live_analyze() { | |
dump | analyzer | |
} | |
live_json() { | |
dump | analyzer -json | |
} | |
dump_write() { | |
socketcan-writer can0 | |
} | |
help() { | |
cat <<EOF | |
help: show this help | |
init: initialize network (needs root permissions) | |
rawdump: print canbus raw data | |
dump: print canbus partially analyzed data with timestamp | |
analyze: convert dump format (from stdin) to human readable data | |
live_analyze: show human readable data directly from network | |
live_json: show json data directly from network | |
EOF | |
} | |
case $1 in | |
init) init;; | |
rawdump) rawdump;; | |
dump) dump;; | |
analyze) analyzer;; | |
live_analyze) live_analyze;; | |
live_json) live_json;; | |
dump_write) dump_write;; | |
*) help;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment