Created
March 3, 2021 11:17
-
-
Save alepez/5873a3ee57dbb977ff414d7cec666ac4 to your computer and use it in GitHub Desktop.
nmea2kutils
This file contains 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 2>/dev/null | |
} | |
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