Bash: Determining if CANbus Bitrate is Configured Properly

pcpro178

New Member
Joined
Jun 16, 2020
Messages
2
Reaction score
0
Credits
23
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...
Bash:
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:
Bash:
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:



Members online


Latest posts

Top