Re: expect script with ppp and stty forces reboot
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
Re: expect script with ppp and stty forces reboot
On Sun, Nov 29, 1998 at 12:49:35PM -0500, Colin Telmer wrote: I recently began using an expect script to connect to my office via ppp and have a problem with how I initialize the modem. I talk with the modem in the expect script as follows: Uh, why that? system stty 38400 -echoe -echo raw /dev/ttyS1 /dev/ttyS1 spawn -noecho -open [open /dev/ttyS1 r+] and at the end of the script I start up pppd as overlay -0 $spawn_id -1 $spawn_id /usr/sbin/pppd /dev/ttyS1 38400 Ahem! If you really start pppd from expect down pass it the already open file. You should use the -detach option of pppd and pass the fd for /dev/ttyS1 as stdin/stdout. This works fine (as far as I can tell), but after disconnecting using poff, I can't reissue the stty command to make a subsequent connection. In other words, I guess it is still opened somehow because the double-open above. stty 38400 -echoe -echo raw /dev/ttyS1 /dev/ttyS1 just hangs. I can't figure out how to reset this, so I have to reboot (cheap excuse). Does anyone know how I can solve this? Thanks, Colin. cu Torsten pgplVc3FN6lgq.pgp Description: PGP signature
expect script with ppp and stty forces reboot
I recently began using an expect script to connect to my office via ppp and have a problem with how I initialize the modem. 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+] and at the end of the script I start up pppd as overlay -0 $spawn_id -1 $spawn_id /usr/sbin/pppd /dev/ttyS1 38400 This works fine (as far as I can tell), but after disconnecting using poff, I can't reissue the stty command to make a subsequent connection. In other words, stty 38400 -echoe -echo raw /dev/ttyS1 /dev/ttyS1 just hangs. I can't figure out how to reset this, so I have to reboot (cheap excuse). Does anyone know how I can solve this? Thanks, Colin. -- Colin Telmer, Ottawa, Ontario, Canada mailto:[EMAIL PROTECTED] http://www.telmer.com
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 HaslerThis posting is in the public domain. [EMAIL PROTECTED] 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.