1833650 Members
4260 Online
110062 Solutions
New Discussion

modems

 
John Carr_2
Honored Contributor

modems

Hi

does anyone have a script to auto detect modems connected to a server.

thanks
John.
5 REPLIES 5
Mark Grant
Honored Contributor

Re: modems

I haven't tested this so it may need a bit of adjusting but how aboutsomething like

for DEVICE in /dev/tty*
do
cu -l $DEVICE dir << EOF
+++
EOF
[[ $? eq 0 ]] && echo "$DEVICE looks like one"
done

My memory or how to deal with a modem should you connect might be a bit hayesey (sorry, hazy) and you might need to adjust the devices we are looking at but this might do what you want.
Never preceed any demonstration with anything more predictive than "watch this"
John Carr_2
Honored Contributor

Re: modems

Mark

what im really after is a script which tests to see if a modem is plugged into the serial port and then communicates with it to find out what its settings are.


John.
Mark Grant
Honored Contributor

Re: modems

John,

The idea I was thinking of was to check all the devices and try to connect to them with "cu"

However, echo will do but you would need to introduce a timeout. If you put the following in a loop, you would get output only if it was a connected modem and that output would be the settings. If it wasn't it will timeout.


$DEVICE=/dev/something


(sleep 2 ; kill $$)&
#change the ATSO=? to the correct Hayes code
#for dumping the modem settings
echo ATS0=? > $DEVICE
kill $!



Never preceed any demonstration with anything more predictive than "watch this"
Darren Prior
Honored Contributor

Re: modems

Hi John,

Due to the variability of some Hayes commands, that might be a bit tricky to implement. Even different models from one manufacturer report can report their settings back in different ways.

How many different types of modem are you expecting to see?

Kermit has some scripting capability and can perform if/then decisions on returned info (similar to expect.) There's a good book on Kermit - unfortunately it's not to hand at the moment otherwise I'd give you further details.

regards,

Darren.
Calm down. It's only ones and zeros...
doug mielke
Respected Contributor

Re: modems

Since cu can load the modem with settings each time a call is initiated, I've never tried to see what the settings are.
However, in /etc/uucp/Dialers there is a list of standard hays commands that can be sent to the modem.