I use
ttywatch; it's available pre-packaged from many distributions. You can even script it with TCL/Expect. For example, I have a modem on the port, and I use this to initialize it for CallerID:
Code:
#!/usr/bin/expect
#----------------
# Assume no error
#----------------
set error 0
#---------------------
# Connect to the modem
#---------------------
spawn -noecho /usr/kerberos/bin/telnet localhost 1234
#---------------------------------------
# Make sure the modem is ready for input
#---------------------------------------
after 1000
send "at\r"
after 1000
send "at\r"
after 1000
#-------------------------------
# Send the initialization string
#-------------------------------
expect {
"OK" {
after 1000
send AT&FE1V1Q0+VIP\r
}
timeout {
set error 1
}
}
#----------------
# Enable callerID
#----------------
expect {
"OK" {
after 1000
send AT+VCID=1\r
}
timeout {
set error 1
}
}
#---------
# All done
#---------
expect {
"OK" {
after 1000
exit
}
timeout {
set error 1
}
}
#--------------------
# Did an error occur?
#--------------------
if {$error == 1} {
catch {exec /usr/bin/logger -t initCallerID.info "Error initializing modem for callerID" &}
}
exit