T
tj
Hi,
I apologize if this is not the correct forum for my question. Please
redirect if necessary.
I have a perl program which is communicating with a modem. I am obtaining
response codes from the modem by defining <MODEM> (/dev/ttyS3).
Think of this program as a clone of minicom. When using minicom, I submit
an "AT" code, and I know exactly what response codes I get from the modem,
and the response is displayed on the terminal.
However, using the perl program, I have to fetch the contents of the buffer.
system "stty 19200 < $modem";
open MODEM, "+<$modem" or die "Can't open $modem: $!";
select MODEM;
$|=1;
select STDOUT;
print MODEM $strData."\r";
print "Echoline: ".<MODEM>;
In minicom, I expect the echoline to be "OK\n\r".
In perl, fetching the results of <MODEM> are not consistent. Sometimes I
need to fetch one or two more <MODEM> calls to empty the buffer before I
can proceed. I assume I am making a very basic mistake, in how I am
calling <MODEM>, flushing the buffer, etc. Its hard to make a smart
looping subroutine, when Im not expecting a value in subsequent calls
anyway. ??
print MODEM $strData."\r";
print "Echoline: ".<MODEM>; #may or may not really be empty yet
print "Echoline: ".<MODEM>; #may or may not really be empty yet
print "Echoline: ".<MODEM>; #is probably empty by now.
I apologize if this is not the correct forum for my question. Please
redirect if necessary.
I have a perl program which is communicating with a modem. I am obtaining
response codes from the modem by defining <MODEM> (/dev/ttyS3).
Think of this program as a clone of minicom. When using minicom, I submit
an "AT" code, and I know exactly what response codes I get from the modem,
and the response is displayed on the terminal.
However, using the perl program, I have to fetch the contents of the buffer.
system "stty 19200 < $modem";
open MODEM, "+<$modem" or die "Can't open $modem: $!";
select MODEM;
$|=1;
select STDOUT;
print MODEM $strData."\r";
print "Echoline: ".<MODEM>;
In minicom, I expect the echoline to be "OK\n\r".
In perl, fetching the results of <MODEM> are not consistent. Sometimes I
need to fetch one or two more <MODEM> calls to empty the buffer before I
can proceed. I assume I am making a very basic mistake, in how I am
calling <MODEM>, flushing the buffer, etc. Its hard to make a smart
looping subroutine, when Im not expecting a value in subsequent calls
anyway. ??
print MODEM $strData."\r";
print "Echoline: ".<MODEM>; #may or may not really be empty yet
print "Echoline: ".<MODEM>; #may or may not really be empty yet
print "Echoline: ".<MODEM>; #is probably empty by now.