Re: [patch] error in smsc_at.c in communication with nokia gsm modems

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Wapme Systems AG
Message-ID <[email protected]>
Wilfried Goesgens wrote:
> 
> 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

which type of modems do you refer on this?

> 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);

is this AT command device specific? If yes, you'll need to ensure you
don't pass it generically to any type of modem.

> 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;

otherwise I'm +0 in commiting this.

Any other opinions, objections, votes please. ?

Stipe

mailto:[email protected]
-------------------------------------------------------------------
Wapme Systems AG

Vogelsanger Weg 80
40470 Düsseldorf, NRW, Germany

phone: +49.211.74845.0
fax: +49.211.74845.299

mailto:[email protected]
http://www.wapme-systems.de/
-------------------------------------------------------------------

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.2 (Cygwin)

mIsEP6mcYwEEAMDnUiUwrbb+xwTFWN6TxF2+XZu7/alwJMeCwMBRvXtPZqfjpPhS
OkBpU0F4TrVuugz1HINTSaJTYq10AzDQXp5NkyWgckqW79nPAWuOX0dicbJk+cN2
nM2TI4KaxUDe6u8hghNEnH/i2lXsUu9apnP/iixzV81VC2je3uc9hZpnAAYptEVT
dGlwZSBUb2xqIChUZWNobm9sb2d5IENlbnRlciAmIFJlc2VhcmNoIExhYikgPHRv
bGpAd2FwbWUtc3lzdGVtcy5kZT6ItAQTAQIAHgUCP6mcYwIbAwYLCQgHAwIDFQID
AxYCAQIeAQIXgAAKCRABV0w1BqPYRuSqA/wPzsQxao2YePENCtgRTrO86U6zg3sl
OcS6CJFI4FZP5h/xD3GRsNH1+MPSvZlomDdpFnr547DGz/Kq9MXuQwVvlVig5yWZ
K5dtKp1r5YLhxJQBhfirZbRFFnYmf19f18J8OoS28tuFVftDl1AIwJS3HLyBTv6H
g2HyLAEKQIp30Q==
=aYCI
-----END PGP PUBLIC KEY BLOCK-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.