On 29 Nov 1998 [EMAIL PROTECTED] wrote: > > 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.
I did that following the example /usr/doc/ppp/examples/secure-card. I don't know any other way for expect to communicate with the modem. I was partially wrong about one thing in my previous post - if the first system line is commented out, the script runs (although it connects at 9600 baud) but it also hangs on the second try. > 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'. I tried this a number of times, but I could not figure out how to get expect to not disconnect the modem connection after exiting. I thought the overlay command would do this, but it explicitly wants a command to "take the connection". I would prefer to do it that way - any suggestions? Also, in regards to your first question, even if I could get it going in this preferable fashion, wouldn't I still need to point expect at the serial port using the system and spawn commands above? > > overlay -0 $spawn_id -1 $spawn_id /usr/sbin/pppd /dev/ttyS1 38400 > > Do you really need to run as slow as 38400? No, I should have changed that. However, when the connection is first established, it comes up as 38400 in the expect script output. Does pppd have the ability to speed this up? Also, if I leave out the stty command from above, the connection is established at 9600 baud. > > 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. I don't understand that. I can issue the stty command any number of times before the ppp connection and it always returns. Only after the ppp connection is disconnected using poff is when the stty command hangs. Given my lack of understanding of this stuff, I thought that I was doing something analogous to leaving the serial port busy so I could not access it again, but I don't know how to figure that out. Thanks again for your help, I really appreciate it. This would be a great deal easier if I didn't need to have an interactive script to ask for a one-time passphrase. Cheers, Colin. -- Colin Telmer, Ottawa, Ontario, Canada <mailto:[EMAIL PROTECTED]> <http://www.telmer.com>