How to create a virtual serial port?

Nick Craig-Wood nick at craig-wood.com
Sun Apr 19 21:30:05 CEST 2009


Grant Edwards <grante at visi.com> wrote:
>  On 2009-04-12, JanC <usenet at janc.invalid> wrote:
> > Grant Edwards wrote:
> >
> >> On 2009-04-10, Stuart Davenport <stuart.davenport at gmail.com> wrote:
> >>
> >>> I am trying to work out if its possible, to create a virtual serial
> >>> port with Python?
> >>
> >> On Linux: no.
> >
> > I wonder if there is no way to emulate ptys from userspace?
> 
>  Didn't I just answer that question?
> 
>  On Linux: no.

Actually you could do it with an LD_PRELOAD library

Intercept open("/dev/ttyS0",...).  You'd need to intercept ioctl(),
read(), write(), close() etc too.

Messy but possible.

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list