[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: expect script with ppp and stty forces reboot



> I talk with the modem in the expect script as follows:

> system "stty 38400 -echoe -echo raw < /dev/ttyS1 > /dev/ttyS1"
> spawn -noecho -open [open /dev/ttyS1 "r+"]

Why do you need to do this?  Pppd will just reconfigure the serial port to
its satisfaction when it comes up. 

If you are just using the expect script to dial and negotiate a connection,
it would be much easier to use pppd's 'connect' option.  One way to do this
is to create a file in /etc/ppp/peers/ just like the ones pppconfig makes
(naming it 'my_office', for example), but replace 

	connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"

with

        connect "/usr/bin/expect /etc/chatscripts/my_office"

Then you will be able to connect to your office with 'pon my_office'
and disconnect with 'poff'.

> overlay -0 $spawn_id -1 $spawn_id /usr/sbin/pppd /dev/ttyS1 38400

Do you really need to run as slow as 38400?

> This works fine (as far as I can tell), but after disconnecting using
> poff,...

Which kills pppd, causing it to put the serial port back the way it found
it, i.e., as your stty command set it up.
-- 
John Hasler                This posting is in the public domain.
john@dhh.gt.org		   Do with it what you will.
Dancing Horse Hill         Make money from it if you can; I don't mind.
Elmwood, Wisconsin         Do not send email advertisements to this address.


Reply to: