On Apr 11, 6:56 pm, Grant Edwards <gra...@visi.com> wrote:
> On 2009-04-11, Grant Edwards <gra...@visi.com> wrote:
>
> > You can write a port redirector in user-space in MS-Windows,
> > but you can't in Linux/Unix.  On Unix systems you have to
> > write a kernel module that sits below the tty layer.
>
> Perhaps I should elucidate further.
>
> That's what the "pty" driver on Unix is: a kernel module that
> sits underneath the tty layer where the "normal" serial-port
> UART drivers sit.
>
> However, Unix pty drivers only handles a subset of the normal
> serial-port API.  [I'm not sure why pty drivers have never been
> "finished" so that they fully emulate a serial port, but it's
> been that way for 20+ years].
>
> If RouteBuddy doesn't try to do things like get/set modem
> control/status lines, then the OP might be able to use a pty.
>
> Each pty consists of two devices: a master end and a slave end.
> RouteBuddy would be told to use the slave end, and the OP would
> write a program that would transfer data between a network
> connection and the master end.
>
> A pty devices is what is used by programs like xterm to run
> programs like bash.  Xterm transfers data between a network
> connection and the master end of a pty.  Bash is connected to
> the slave end of that pty and "thinks" it's connected to a
> serial port.  Bash uses little of the serial port API, so it's
> happy with the limited API provided by a pty slave-end.
>
> --
> Grant

Grant - HERO! THIS EXACTLY WHAT I WANT TO DO...

I didn't realise people were still posting on this thread and have
spent the last 3 hours trying to get some example code to create a
pseudo TTY (pty) in Python, I get that I have to use the pty module,
but finding an example is like searching for... lets go festing ...an
easter egg in a forest ;)

You wouldn't have any pointers to initiating a PTY and how to write to
it? This is all I want to achieve.


My point in all this is actually that I ordered a USB GPS Receiver and
it wont arrive for another two weeks, being my impatient self, I am
writing an app for my iPhone to broadcast its GPS location over the
network to my laptop. I then want to get this data into the NMEA
format and push this data onto a PTY - this will in-effect replace the
USB GPS Receiver and the GPS software can read it :)

Cheers
Stu
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to