|
Posted by Dr.Ruud on February 15, 2006, 9:23 pm
Please log in for more thread options
gormanst schreef:
> I have a simple program. All it is trying to do is issue the "AT"
> attention command and grab the OK that is the result of the command
> using are_match. It never works.
You don't mention that you have a working modem attached.
Did you test with HyperTerminal (or alike)? Is the COM1_test.cfg OK?
> I have tried every permutation of the
> regex, seriously like 15 different tries. Please, if you can, tell me
> what I am doing wrong! I am going to bang my head into the wall soon.
Why do you think that a regex is involved in the problem?
> if($resp ne "" && $resp =~ /OK/)
> {
> printf "Received <%s>\n", $resp;
> $reset = 0;
> }
You might make that
if ($resp ne "") {
printf "Received <%s>\n", $resp;
$reset = 0 if $resp =~ /OK/;
}
for testing. Also for testing, add a "\n" member to are_match().
The '/.*(OK).*/' member of the are_match() can be written as '/OK/', so
you don't need a regex for that at all.
See also example 7 here:
http://www.foo.be/docs/tpj/issues/vol4_1/tpj0401-0020.html
If all fails, do a factory reset of the modem. Check the registers (like
s3 and s4) for strange values. Also try a ';' before the end-<CR> of the
AT-command: "AT;\r". Test manually with a program like HyperTerminal.
--
Affijn, Ruud
"Gewoon is een tijger."
|