Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipe One Serial Port to Another in Linux [closed]

I am looking for a means to pipe one serial ports data (regardless of data type) to another serial port. In my case I am trying to take in data from one serial port and output it through a radio connected to another serial port in real time.

I already know what ports I am using and have looked up a program called socat, which should be able to handle it but there are no examples of how to do this and I have not been able to figure out how to do it.

Has anybody been able to use socat or a bash scipt/some other method to accomplish this in Linux??

I am running Ubuntu 14.04.

like image 572
Ludefice Avatar asked Oct 20 '25 05:10

Ludefice


1 Answers

Assuming the serial port you are reading from is /dev/ttyS0, and the other you are writing to (where the radio is connected) is /dev/ttyS1 you shall simply do:

cat /dev/ttyS0 > /dev/ttyS1

or

dd if=/dev/ttyS0 of=/dev/ttyS1 bs=1

Of course before you should set all the serial ports' parameters using stty command.

like image 188
nsilent22 Avatar answered Oct 21 '25 19:10

nsilent22



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!