LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Simulate serial device with pty's (https://www.linuxquestions.org/questions/linux-software-2/simulate-serial-device-with-pty%27s-756813/)

maus 09-21-2009 01:28 PM

Simulate serial device with pty's
 
Hi,

I wrote software which access and reads a serial device. I would like to test this software on my computer without loop-wiring or without a second computer.

How could I use pty's to simulate a serial device?

Actually I would like to temporary replace the /dev/ttyS1 file by one end of the pty. How could I do this? Is there a command to create a pty pair?

Thanks for any suggestions.

Wim Sturkenboom 09-22-2009 09:44 AM

The pairs are already there. Hope that the below gives you the idea what to do.

Run this first in a terminal; it will simulate your serial port
Code:

minicom -p /dev/ptyp0
Next, in other terminal, let your application connect to it (I use minicon but you can use your application)
Code:

minicom -p /dev/ttyp0

maus 09-25-2009 02:29 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 3692959)
The pairs are already there. Hope that the below gives you the idea what to do.

Run this first in a terminal; it will simulate your serial port
Code:

minicom -p /dev/ptyp0
Next, in other terminal, let your application connect to it (I use minicon but you can use your application)
Code:

minicom -p /dev/ttyp0

Thanks Wim,

The pty pair doesn't exist on my computer. Is there a command to create such a pty pair??

In the folder /dev/pts/ there are plenty of pty ports. But the all end up in open terminal session.

Wim Sturkenboom 09-26-2009 04:51 AM

For me it worked long ago under RH7.x (or maybe it was even 6.2). I did check before I posted on my Ubuntu 8.04 box.

I can't find the links any more ( :( ) but there seem to be two styles. Maybe do a search for pmtx.

Which distro are you using?

maus 09-27-2009 11:10 AM

Hi,

I'm using Linux Mint Gloriqa (Linux Ubunut 8.0 Derivat).
The two devices /dev/ptyp0 and /dev/ttyp0 don't exist.

There is a application called socat which can create to pseudo terminals.

With this app I'm able to create a pair of ptys.


All times are GMT -5. The time now is 09:22 AM.