How do I link two serial ports in GNU/Linux?

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).


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.


Update:

To link serial port ttyS0 to another serial port:

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

from http://technostuff.blogspot.co.uk/2008/10/some-useful-socat-commands.html

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


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.

UPDATE

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