Socat pseudo terminal: Can you use data lines (DTR, RTS, etc.)?

I am creating a virtual serial port using socat.

socat -d -d pty,echo=0,raw pty,echo=0,raw

      

This works as expected. Using echo / cat, I can send / receive text, etc.
But what about signal lines like DTR or RTS? How do I get / set the state of these lines using pty? Is it possible? I couldn't find any mention of this anywhere.

+3


source to share


2 answers


socat is a channel handler, basically allows you to use Tx and Rx lines, without having to watch for signals when data is ready / received.

RTS / CTS / DSR / DTR are the actual pins in the serial connector that control what happens on the Tx / Rx lines.



9 pin serial connector

Off the top of my head I have not used socat or tried to do anything like this, the lowest level I got is the EMV interface and protocol and sometimes I also netcat really fast between machines when I am too lazy to cp to a directory in the house httpd ... anyway, if you are trying to connect two objects using socat (separate machines or applications on the same computer), you will use the same pipe and specify some control characters so that they end (you need to do this and try implement it somehow with my wife) or use two separate pipes, one for Rx and one for Tx: Tx of object 1, which goes into Rx of object 2, Tx of object 2 goes into Rx of object 1.

+1


source


From your comment, it looks like you want to control RTS / CTS regardless of the data stream. You will need to write an application to interact with the serial port using ioctls.



I found this helpful forum (with sample app) https://www.linuxquestions.org/questions/programming-9/manually-controlling-rts-cts-326590/

+1


source







All Articles