few more commands
[huawei.git] / qcom-chat.pl
index 71fb97c..7157a30 100755 (executable)
@@ -20,8 +20,8 @@ $port->user_msg(1);
 $port->error_msg(1);
 $port->debug(1);
 
-$port->read_char_time(1000);  # 0.1 s char timeout
-$port->read_const_time(500); # 0.5 s read timeout
+$port->read_char_time(3000);  # 5 s char timeout
+$port->read_const_time(3000); # 1 s read timeout
 
 while ( my $drain = $port->input ) {
        warn "# drain $drain\n# /drain\n";
@@ -37,13 +37,14 @@ sub c {
 #      $port->write_done(1); # flush
        $port->write_drain;
        my $ret = $port->read(1);
+again:
        while ( my $c = $port->input ) {
                print STDERR "<<< ",dump($ret . $c), $/;
                $ret .= $c;
 #              last if $c =~ m/^OK\r/;
        }
+       goto again unless $ret =~ s/\r\n(OK|ERROR)\r\n$//s || warn "ERROR: can't find OK or ERROR status!\n";
        $ret =~ s/^[\r\n]+//;
-       $ret =~ s/\r\nOK\r\n$// || warn "ERROR: missing OK";
        print "$cmd [$message] = $ret\n";
        return $ret;
 }
@@ -53,18 +54,32 @@ c 'ATE0' => 'echo off';
 #
 c 'ATI'  => 'info';
 
-c 'AT+CGMI'  => 'CGMI';
+c 'AT+CGMI'  => 'manufacturer';
 
-c 'AT+CGMM'  => 'CGMM';
+c 'AT+CGMM'  => 'model';
 
-c 'AT+CGMR'  => 'CGMR';
+c 'AT+CGMR'  => 'revision';
+
+c 'AT+CGSN'  => 'serial';
+
+c 'AT+GCAP'  => 'capabilities';
 
 c 'AT+CIMI'  => 'IMSI';
 
-c 'AT+CGSN'  => 'CGSN';
+c 'AT+CNUM'  => 'MSISDN';
+
+#c 'AT+COPS=?'  => 'operators'; # times out
+
+c 'AT+CLCK=?' => 'facility lock';
+
+c 'AT^HWVER' => 'hardware version';
 
 c 'AT^CVOICE?' => 'is voice enabled?';
 
+c 'AT^DDSETEX=?' => 'voice output';
+
+c 'AT^SYSINFO' => 'sys info';
+
 
 $port->close || die "can't close port $!";