I need to send a small file over serial port (actually
/dev/ttyUSB0, there is a usb-to-serual converter attached to the port). The operation needs to be scriptable i.e. non-interactive.
Here is what I have tried:
minicom- works correctly, but is interactive.
--script=SCRIPToption looks promising, but I have no idea how to write the script.
sx- non-interactive, but freezes, probably because I did not specify baud rate and byte format (stop bits, parity, data bits).
What are my options?
Still no luck, while minicom with
38400 8N1 sends the file correctly. I am doing
sudo stty -F /dev/ttyUSB0 38400 cs8 -parenb -cstopb -ixoff sx ~/test_signals/ones.bin -vvvvvvvvvvvv
sx just freezes. Here is the output:
vorac@laptop:~/projects/megaboot$ sx ~/test_signals/ones.bin -vvvvvvvvvvvv sx 0.12.21rc mode:1 Sending /home/vorac/test_signals/ones.bin, 7 blocks: Give your local XMODEM receive command now. wctx:file length=1000 Calling read: alarm=60 Readnum=128
And just stays there. The receiver is using the short 1-byte checksum method, indicated by sending a NACK at the beginning of the file, instead of the 2-byte crc, which would be indicated by sending a 'C'. Maybe this is unsupported by
To avoid reading the exhaustive documentation on cu, I copied the command from this article. Still no luck.
vorac@laptop:~$ sudo cu -l /dev/ttyUSB0 -s 38400 cu: open (/dev/ttyUSB0): Permission denied cu: /dev/ttyUSB0: Line in use vorac@laptop:~$ groups vorac vorac : vorac adm dialout cdrom sudo dip plugdev lpadmin sambashare wireshark