Linux command to send binary file to serial port w

2019-07-02 06:17发布

问题:

I need to send binary file to rs232 device (printer) which not always can accept data and so it has BUSY output signal, which i connect to CTS pin.

I try to use it with minicom, and hardware flow control works just fine. But i can't send raw file using minicom, it works wrong ant i think minicom not loves zeroes in file.

At other hand, i try to use cat file > /dev/ttyS5, along with stty -F /dev/ttyS5 clocal or stty -F /dev/ttyS5 crtscts. None of this work: HW control not work at all, data transfer just stops (often at middle of byte when space state on TXD stucks!) and never continues after release of BUSY. Behavior not depends on clocal or crtscts i use. And also cat file > /dev/ttyS5 never wait, even if BUSY was active before this command.

Please note, using minicom, i ensure that i have correct connections, support for RTS/CTS in kernel and in RS232 PCI-E board, etc.

So the question is, how i can do correct binary file transfer from command line using HW flow control? Thanks.

回答1:

Here is a guy who says he has a solution for transferring binary data with minicom: http://www.dannysung.com/wmain/linux/tips/sending-binary-files-via-minicom/

I don't understand why his little script is different from cat file >/dev/ttySX but maybe you can give it a try.



回答2:

When I made those sort of test (20 years ago) I used unix dd command. Find a similar one in your linux flavor.