How to create a virtual serial port?

Grant Edwards grante at visi.com
Sat Apr 11 09:31:28 EDT 2009


On 2009-04-10, Stuart Davenport <stuart.davenport at gmail.com> wrote:

> I'm on a OS X, python 2.5. Basically I will have a remote
> application pushing data (GPS) over the network to a python
> application I have running on my Mac, I want this python
> application to again push the data on to a "virtual serial
> port". Then the GPS program I have running on my MAC,
> RouteBuddy, can read the data from that serial port as
> standard.

You might be able to use a pty.  It depends on what ioctl calls
RouteBuddy uses.  Unless Apple has done major surgury on the
pty driver, the Unix pty driver only supports a subset of the
serial-port ioctl commands: for example pty's don't support the
TIOCMGET and TIOCMSET commands.

If RouteBuddy won't work with a pty, then you could buy two
USB-serial converters (that are supported on Mac OS X) and
connect them to each other with a null-modem adapter.

Or you could fix up the pty driver to support the reset of the
serial-port ioctl commands.  I've been meaning to do that for
Linux for several years now...

-- 
Grant




More information about the Python-list mailing list