Open Source Telephony
 help / color / mirror / Atom feed
From: Alexander Couzens <lynxis@fe80.eu>
To: ofono@ofono.org
Subject: Re: [PATCH 1/2] smsutil: sms_decode() allow to pass sms with unknown TPDU size
Date: Wed, 17 May 2017 01:01:18 +0200	[thread overview]
Message-ID: <20170517010118.4157374e@lazus.yip> (raw)
In-Reply-To: <42f4d13e-d2c2-bbdd-b268-f9cbbe09c245@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1826 bytes --]

Hi Denis,

> Hi Alexander,
> 
> On 05/16/2017 10:49 AM, Alexander Couzens wrote:
> > Certain modems (QMI based) only return a PDU length, but without
> > the length of the TPDU.  
> 
> It looks like the current QMI_WMS_RESULT_NEW_MSG_NOTIFY assumes that
> the message doesn't have an SMSC preceeding it.  Or is it that we are
> not parsing some other parameters?

The nice thing here is:
When receiving a SMS PDU over the notify callback, it doesn't contain a
SC address, but when reading it from NV it does.

> > Without passing this information over ofono_sms_deliver_notify()
> > down to sms_decode(), sms_decode() will fail, as it try to
> > interpret the SC header as PDU header.  
> 
> How do we know when a PDU contains the SC address and when it doesn't?
I don't know. Sorry, I didn't read (yet) the whole spec. 

Originally I though it would be possible and a good idea to detect SC,
but sms_decode_address_field() can exit early with success and
sms_decode() fail later when decoding. A second pass is then required.
I dropped that idea and use fixed expectation, hopefully QMI behave the
same way on different devices.

> [..]

> > b) export sms_decode_address_field() which is part of smsutil.h
> > would mean using this function only to get the length of TPDU and
> > throw away the result (address), which is later called a second
> > time.  
> 
> In-tree drivers can freely utilize core utilities such as smsutil and 
> stkutil.  So this isn't really a problem.  Since the QMI API is quite 
> dumb, then parsing the SC address field twice is probably the least
> evil way to do this.

Ok. Will do it that way.

-- 
Alexander Couzens

mail: lynxis(a)fe80.eu
jabber: lynxis(a)fe80.eu
mobile: +4915123277221
gpg: 390D CF78 8BF9 AA50 4F8F  F1E2 C29E 9DA6 A0DF 8604

[-- Attachment #2: attachment.sig --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2017-05-16 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 15:49 [PATCH 1/2] smsutil: sms_decode() allow to pass sms with unknown TPDU size Alexander Couzens
2017-05-16 15:49 ` [PATCH 2/2] qmimodem: receive & delete sms from NV storage on 'Powered' Alexander Couzens
2017-05-16 18:06   ` Denis Kenzior
2017-05-16 17:49 ` [PATCH 1/2] smsutil: sms_decode() allow to pass sms with unknown TPDU size Denis Kenzior
2017-05-16 23:01   ` Alexander Couzens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170517010118.4157374e@lazus.yip \
    --to=lynxis@fe80.eu \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox