Re: Emulating a modem with expect
From: Don Libes (libes_at_nist.gov)
Date: 02/18/05
- Next message: Melissa Schrumpf: "Re: Sharing a Serial Port"
- Previous message: Volker Hetzer: "Re: Communicating to USB device"
- In reply to: news.mot.com: "Emulating a modem with expect"
- Next in thread: MOTJason: "Re: Emulating a modem with expect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Feb 2005 10:22:42 -0500
"news.mot.com" <jason.brummal@motorola.com> writes:
> Is there a way to emulate a modem with Expect? Basically I have written an
> Expect script that allows a user to bring up ppp through a telnet pipe
> (basically allows GUI connections via telnet if X is not allowed). The
> script works fine on Linux machines since it makes a call to pppd on both
> sides of the telnet and then makes them talk to each other. I am trying to
> get the same behavior to happen on Solaris8.0 but running into issues.
>
> Basically pppd on Linux creates a ppp0 interace automatically, where pppd on
> Solaris does not. Solaris expects the user to plumb an ipdptp interface that
> will make a call to an /etc/ppp/options file which, in turn, uses a 'call'
> option to initialize an actual modem with chat.
>
> Once chat finishes the phyiscal connection of dialing, it then appears to
> bind the ipdptpx to the local pppd process. Once that bind occurs, the
> remote pppd process is free to negotiate LCP with the ipdptpx adaptor.
>
> So basically I am trying to figure out is there a way to bind the ipdptp
> adapter to the pppd process on the local side so that I can get an IP
> address. I have tried 'spawn -open [ open /dev/ipdptp0 w+ ]' and capturing
> the spawn_id, then spawning the pppd session and forcing an interaction, but
> that does not seem to buy me anything.
>
> I was pointed to the 'spawn -pty' as perhaps a way around, but working
> through the man page as well as Exploring Expect's example - I don't see
> where to take this. Any help/hints would be greatly appreciated.
>
> Jason
I've read this 5 times and still don't understand what you're doing
(sorry). But if you're just trying to make a black box that has an IP
addr on one side and a serial addr on the other, yes, you can do that.
IP2serial is trivial so hopefully it's serial2IP that you're trying to
achieve - what I do is create a fifo and then let the Expect script
sleep on a fifo read. When the read completes, the script does a
socket open or spawn telnet or whatever you want for the other side of
the connection. An 'interact' ties them together.
To most programs, serial devices all look the same so a program
shouldn't care whether it's a modem or a fifo.
Since you have the book, you can also find code samples and pictures
in there (2nd Interact chapter). If this still doesn't address your
question, a picture would be helpful.
Don
- Next message: Melissa Schrumpf: "Re: Sharing a Serial Port"
- Previous message: Volker Hetzer: "Re: Communicating to USB device"
- In reply to: news.mot.com: "Emulating a modem with expect"
- Next in thread: MOTJason: "Re: Emulating a modem with expect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|