[patch] error in smsc_at.c in communication with nokia gsm modems
"Wilfried Goesgens" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
in at2_check_sms_memory kannel tries to evaluate the number of sms the modem
is able to receive into its memory by reading the size of the storage.
something like
at+cpms?
... ME ,77,170 ...
would be a correct reply. but i found that some of our modems just return
... ME ,77,0 ...
which makes kannel asume, the modem is able to hold zero messages in memory.
so it says: "77 messages waiting in memory" and starts the memory read
function.
there it loops reading memory-slots until the number of sms successfuly read
is
equal to the number of sms waiting in memory, or the last slot of the modem
has passed.
As of kannel asumes, that there are 0 slots, it won't loop at all.
so i just did the hack to compare the number of sms'es to be read and the
assumed memory units.
if nSMS < storagesize, storagesize is wrong. To reach the end, i used n-sms
+20. The clean way
would be to have it optionally configured, and warn in syslog, if it's not
configured, and
kannel find a zero...
the first part is a check if the pointer exists, which i found crashing it
in some case it being zero.
the middle part is retrying to delete an sms, if it fails.
cvs diff smsc_at.c
Index: smsc_at.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at.c,v
retrieving revision 1.13
diff -r1.13 smsc_at.c
156c156
< if (privdata->modem->need_sleep)
---
> if (privdata->modem&&privdata->modem->need_sleep)
415a416
>
417a419,420
> at2_send_modem_command(privdata, "AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q", 0, 0);
> sleep(1);
743a747,755
> if (at2_send_modem_command(privdata, cmd, 20, 0) != 0) {
> /*
> * failed to delete the message, we'll just ignore it for now,
> * this is bad, since if the message really didn't get deleted
> * we'll see it next time around.
> */
> error(2, "AT2[%s]: REALY failed to delete message %d.",
> octstr_get_cstr(privdata->name), message_number);
> }
937c949,951
<
---
> /* did the modem tell us the truth about its capacity?
> if not use current number of sms+20*/
> if (values[0]>values[1]) values[1]=values[0]+20;