I'm working with a device connected to my PC via serial port.
When i send a command to this device (using putty or minicom) it send me back some output.
I would like to save this output (serial input of my PC) on a local file.
I found this workaround to do this:
-In the first terminal i type:
cat -v /dev/ttyACM0 > filename
-In another terminal i type:
echo -ne 'cat "filename"\n\r' > /dev/ttyACM
It works, but i'd like to automate the process with a single bash script.
./serialDownload.sh filename
I tried to put in background the first command before executing the second one but it doesn't work...
#!/bin/bash
SERIAL_PORT="/dev/ttyACM0"
BAUDRATE=9600
stty raw speed $BAUDRATE
./serialListen.sh $1& (->this put in background the first command)
sleep 2
echo -e 'cat "'$1'"\n\r' > $SERIAL_PORT
Thank you in advance for any kind of help!