Linux Serial Loopback Test Program

DB9 & DB25 D-type connector pin connections for an RS232 serial loopback test. RS232 basics RS232 standard Software handshaking Signals & voltage levels Pinouts & connectors Loopback connections RS232. The connections for the serial loopback connector are given below in tabular form for a DB-9 D-type connector using the common pinout. The optional set of parallel port and serial port signal loopback TEST Plugs (one 25-pin parallel, one 9-pin serial & one 25-pin serial) are used with the 'external' parallel port and serial port tests.

Active20 days ago

On Linux, I want to send a command string (i.e. some data) to a serial port (containing control characters), and listen to the response (which also usually might contain control characters).

How can I do this as simplest as possible on Linux? An example is appreciated!

AlexAlex
1,91416 gold badges46 silver badges75 bronze badges

5 Answers

All devices on Unix are mapped to a device file, the serial ports would be /dev/ttyS0/dev/ttyS1 .. .

First have a look at the permissions on that file, lets assume you are using /dev/ttyS1.

ls -l /dev/ttyS1

You will want read.write access, if this is a shared system then you should consider the security consequences of opening it up for everyone.

Bleach heat the soul 2 passwords list. Card bonuses: Collect the indicated number of cards to unlock the corresponding bonus.

A very simple crude method to write to the file, would use the simple echo command.

and to read

You can have cat running in one terminal, and echo in a 2nd.

If everything is gibberish, then baud rate, bit settings might need setting before you start sending. stty will do that. !! NOTE stty will use stdin as default file descriptor to affect.

Equivalent commands.

This might be enough for you to script something and log ? Not sure what you are trying to achieve.

For a more interactive, remembers your default settings approach would be to useminicom it is just a program which does everything I've mentioned so far. (similar to hyperterminal in Windows, you might be familiar).

An intermediate solution, would use a terminal program like screen which will work on a serial device.

man screenman minicomman stty for more information

X TianX TianLinux Serial Loopback Test Program
8,1661 gold badge23 silver badges38 bronze badges

All you have to do is open two terminals. In the first terminal you cat everything from the device, e.g.

in the other terminal, you can send arbitrary hex characters and text to the terminal e.g. as follows:

The echo -e command enables the interpretation of backslash escapes.

One has to make sure of course that (i) the serial settings (speed, word length, flow ctrl, etc) are correct and (ii) the serial device (on the other end) is not blocking.

X Tian
8,1661 gold badge23 silver badges38 bronze badges

Linux Serial Loopback Test Program Free

AlexAlex
1,91416 gold badges46 silver badges75 bronze badges

Linux Loopback Device

Programs that talk to serial devices:

or from shell you can do:

ZibriZibri
Leonardo MendozaLeonardo Mendoza

You can read and write to a device simulataneously like so:

Your message is sent to the second cat from stdin, and the first cat relays the response to stdout, turning your terminal into a chatroom.

To finish up, ctrl-c, then run fg then ctrl-c again.

diachedelicdiachedelic

protected by dr01Jun 24 at 7:18

Linux Serial Loopback Test Programs

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Loopback Test

Not the answer you're looking for? Browse other questions tagged serial-port or ask your own question.