[Gllug] Modem Commands

Rob Andrews rob at impure.org.uk
Sat Feb 9 20:27:36 UTC 2002


[09-Feb-2002 18:10.56 (GMT) / Iain Conochie]
 > Hiya guys,
 > I have been playing around with various AT modem command to get the line
 > speed logged in /var/log/messages, but so far without success.
 > here is the line I am using...
 > "" "AT&FH0X4W2"
 > apparently, X4 should give call progress result codes, connectin speeds
 > etc, and W2 should givemodem to modem connect speeds. However, it
 > doesn't!!!!

Ahhh... but it does...

 > see sample from /var/log/mesages
 > Feb  9 18:03:34 rialto chat[602]: expect (CONNECT)
 > Feb  9 18:03:34 rialto chat[602]: ^M
 > Feb  9 18:04:04 rialto chat[602]: atdtxxxxxxxxxxxxx^M^M
 > Feb  9 18:04:04 rialto pppd[600]: Serial connection established.
 > Feb  9 18:04:04 rialto pppd[600]: Connect: ppp0 <--> /dev/ttyS1
 > Feb  9 18:04:04 rialto chat[602]: CONNECT
 > Feb  9 18:04:04 rialto chat[602]:  -- got it
 > But no speed after connect
 > What is the command I need to do this???

This is a pain, since before ADSL I wanted to do this too. chat is expecting
"CONNECT", once it gets it, and chat reaches the end of the script, that's
it. Gone.

You've got two options. First, you could get the chat to do the login for
you - most ISPs still support this, but a few don't, so if it doesn't do it
for you, don't be suprised. Try bashing at it with minicom or cu beforehand,
and see what happens. If it does work, chat will log the whole login
session. ISPs I know of that allow such logins include Demon, Freeserve,
Force9/PlusNet, Inweb, and most likely a whole bundle of others. ISPs that
don't most likely include MSN, but that's to be expected. They could be
doing anything, we just don't know.

Secondly you could get chat to multi-expect more than one thing. Like
"CONNECT <speed>", but since modems don't always negotiate at the same rate,
this may end up spitting out any speed. You have to predict all of them. And
trust me, there are lots. This isn't a pleasant method.

Or you could not use chat. This is the third "hidden" option I don't usually
suggest, but try either expect or perl with Expect.pm, then get it to issue
a syslog output with something like "connected at $speed". This seems the
tidiest method. And both expect and perl's Expect.pm are a doddle to learn.

Give it a shot. Remember, chat is very basic on purpose. It doesn't need to
be otherwise, really :)

n.

-- 
nine      <e> rob at impure.org.uk <pgp> 0x8bb5c71e <w> http://impure.org.uk/

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list