Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to have one serial port receive data and another to transmit same data. How do I make such setup in GNU/Linux. One will be a port created by bluetooth and another will be a USB to serial adapter.

I'll most likely be using newest version of 64 bit Mint (12, if I remember correctly).

share|improve this question
up vote 7 down vote accepted

socat can handle serial-ports.

Normally it is used with network interfaces and can relay data, but it does handle serial TTY devices too. The examples in the above link don't include serial-serial relaying but from those examples you can probably work out the command parameters that ought to accomplish that.


To link serial port ttyS0 to another serial port:

 socat /dev/ttyS0,raw,echo=0,crnl /dev/ttyS1,raw,echo=0,crnl


socat also has options so that you can, if you wish, log the data that is being relayed.

share|improve this answer

For a quick & dirty procedure, setup a terminal emulator program, such as minicom, for each serial port. That will give you an interactive full-duplex interface for transferring text between ports. Several modem transfer protocols are built-in for file and binary data transfers.

For more complex data transfer, e.g. handling somekind of custom data format/protocol, you will have to write a program to access the serial port to handle the data.


Please provide more detail as to what you are trying to do. Are both serial ports to be connected to the same PC, or each port to one PC? Is there any reason why the two serial ports could not be connected to each other if that is the purpose of this "linking question"?

Since one of the "serial ports" is a USB-RS232 adapter, there's no reason to connect each serial port through a PC. Connect the two serial ports to each other (a connecter adapter may needed to be wired up), and then plug in the USB into a PC. Use a terminal emulator program to deal with the one serial port now connected to the PC.

Bluetooth <---->  USB adapter  <--->  PC
share|improve this answer
Looks interesting. Is there some (relatively easy) way to say pipe capture file so that one minicom process is transmitting what other is receiving? In the worst case, even pasting a capture file into another windows could be enough. – AndrejaKo Mar 21 '12 at 20:09
You can log (record) everything that is sent and received at each minicom program. The logging can be turned off/paused and back on using keystrokes. You would have to stop logging completely in order to start recording to a different log file. – sawdust Mar 21 '12 at 21:03
Bluetooth has support for serial emulation where bluetooth adapters of both devices create virtual serial ports which to software appear as real serial ports. Bluetooth stack of the operating system is usually used to do that and bluetooth adapters that have real hardware serial ports are expensive and (at least for me) difficult to obtain. My mobile phone has GPS receiver and software which can send NMEA sentences over the bluetooth serial port which I can receive on terminal emulator on my PC and I want to redirect that to a microcontroller which will later process that data. – AndrejaKo Mar 22 '12 at 8:08
The microcontroller will be later used with a GPS receiver that has a real serial port which I don't have at the moment and I want to use the mobile phone to do software development on the microcontroller because both modules emit the type of NMEA sentence I need. – AndrejaKo Mar 22 '12 at 8:09
Thanks for the clarification. Hope you find a solution. – sawdust Mar 22 '12 at 8:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .