• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Bash: Determining if CANbus Bitrate is Configured Properly


New Member
Jun 16, 2020
Reaction score
I'm working on an embedded Linux (4.1.15) bash script wherein the bitrate of a CANbus may be one of several possibilities. When my module comes online it comes up at the first bitrate in the list, checks for traffic, and, if no traffic, cycles through each bitrate in like manner until traffic is detected.

My initial approach was to do something like...
timeout -t 1 output=$(candump can0)
If output is empty, then bitrate is incorrect. However, the timeout function doesn't seem to force a return from the command.

My second approach was to try to do something with:
ip -details -statistics link show can0
While this does produce some meaningful information in a single, discrete command, it's not very useful without being able to reset the statistics.

The command uname -rms yields this version info about the system: "Linux 4.1.15 armv7l"

If anyone knows how to get either of these approaches to work, that'd be great, or if you know another way, I'm all ears. Bottom line is, I need to find a way to do this using bash script.
Last edited: