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...
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:
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.
My initial approach was to do something like...
Bash:
timeout -t 1 output=$(candump can0)
My second approach was to try to do something with:
Bash:
ip -details -statistics link show can0
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: