[PATC] Fix to prevent AT-command interference
Matti Ärmänen <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, If a memory check is performed right after AT+CNMA-command, an error message is generated and modem connection is reopened. Here is an example: 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: <-- +CMT: ,20 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: <-- ****DELETED**** 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: received message from SMSC: ****DELETED**** 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: Numeric sender (international) <****DELETED****> 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: User data length read as (1) 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: Udh decoding done len=1 udhi=0 udhlen=0 udh='' 2008-09-28 17:57:59 [7962] [16] DEBUG: AT2[12]: --> AT+CNMA^M 2008-09-28 17:58:00 [7962] [16] DEBUG: AT2[12]: --> AT+CPMS?^M 2008-09-28 17:58:00 [7962] [16] DEBUG: AT2[12]: <-- OK 2008-09-28 17:58:00 [7962] [16] DEBUG: AT2[12]: no correct header for CPMS response. 2008-09-28 17:58:00 [7962] [16] DEBUG: AT2[12]: memory check error 2008-09-28 17:58:00 [7962] [16] INFO: AT2[12]: Closing device 2008-09-28 17:58:00 [7962] [16] ERROR: AT2[12]: Couldn't connect (retrying in 10 seconds). This can be fixed, if after issuing the AT+CNMA-command, the OK-answer is waited before continuing. As the OK-answer is waited, the logic with "expect_extra_ok"-counter is no longer necessary. We have run this in 3 kannel instances for 2 months without problems. Regards, Matti Ärmänen
patch.txt
(text/plain, 1.1 KB)
--- smsc_at.c.orig 2008-09-28 18:37:38.000000000 +0300
+++ smsc_at.c 2008-09-28 18:41:53.000000000 +0300
@@ -749,7 +749,6 @@
Msg *msg;
int len;
int cmgr_flag = 0;
- int expect_extra_ok = 0;
time(&end_time);
if (timeout == 0)
@@ -772,12 +771,8 @@
goto end;
}
if (octstr_search(line, octstr_imm("OK"), 0) != -1) {
- if (!expect_extra_ok) {
- ret = 0;
- goto end;
- } else {
- --expect_extra_ok;
- }
+ ret = 0;
+ goto end;
}
if ((gt_flag ) && (octstr_search(line, octstr_imm(">"), 0) != -1)) {
ret = 1;
@@ -847,8 +842,7 @@
if (!cmgr_flag) {
if (privdata->phase2plus) {
- at2_write_line(privdata, "AT+CNMA");
- ++expect_extra_ok;
+ at2_send_modem_command(privdata, "AT+CNMA", 3, 0);
}
}