All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Unable to decode PDU for SMS-STATUS-REPORT
  2012-06-25 16:10 Unable to decode PDU for SMS-STATUS-REPORT Audric Schiltknecht
@ 2012-06-22  8:28 ` Denis Kenzior
  2012-06-26  7:18   ` Audric Schiltknecht
  2012-06-25 16:20 ` Audric Schiltknecht
  1 sibling, 1 reply; 5+ messages in thread
From: Denis Kenzior @ 2012-06-22  8:28 UTC (permalink / raw)
  To: ofono

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

Hi Audric,

On 06/25/2012 11:10 AM, Audric Schiltknecht wrote:
> Hi guys.
>
> I'm having troubles with delivery reports.
>
> When I send a message with the property "UseDeliveryReports" set to "true",
> I can get the delivery report from the GSM modem, but ofono is unable to
> decode it:
>
> ofonod[677]: SMS: < \r\n+CDS:
> 32\r\n07913386094000F006DB0A810011223344216052714081802160527140228000\r\n
> ofonod[677]: drivers/atmodem/sms.c:at_cds_notify() Got new Status-Report
> PDU via CDS:
> 07913386094000F006DB0A810011223344216052714081802160527140228000, 32
> ofonod[677]: src/sms.c:ofono_sms_status_notify() len 32 tpdu len 32
> ofonod[677]: Unable to decode PDU
>
> The PDU is valid, since I can decode it using some online tool.
>
> It seems that sms_decode does not correctly handle the SMSCC part
> (913386094000F0),
> and tries to decode it as the sender address, which obviously fails.
>

Likely it is because your modem is being stupid.  3GPP 27.005 states:

<length> integer type value indicating in the text mode (+CMGF=1) the 
length of the message body <data> > (or <cdata>) in characters; or in 
PDU mode (+CMGF=0), the length of the actual TP data unit in octets 
(i.e. the RP layer SMSC address octets are not counted in the length)

So in the case above it should be reporting the length of the payload, 
not the length of the entire hex string.

See if the PDU is decoded successfully by setting tpdu_len to the 
appropriate value.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Unable to decode PDU for SMS-STATUS-REPORT
@ 2012-06-25 16:10 Audric Schiltknecht
  2012-06-22  8:28 ` Denis Kenzior
  2012-06-25 16:20 ` Audric Schiltknecht
  0 siblings, 2 replies; 5+ messages in thread
From: Audric Schiltknecht @ 2012-06-25 16:10 UTC (permalink / raw)
  To: ofono

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

Hi guys.

I'm having troubles with delivery reports.

When I send a message with the property "UseDeliveryReports" set to 
"true",
I can get the delivery report from the GSM modem, but ofono is unable 
to decode it:

ofonod[677]: SMS:    < \r\n+CDS: 
32\r\n07913386094000F006DB0A810011223344216052714081802160527140228000\r\n
ofonod[677]: drivers/atmodem/sms.c:at_cds_notify() Got new 
Status-Report PDU via CDS: 
07913386094000F006DB0A810011223344216052714081802160527140228000, 32
ofonod[677]: src/sms.c:ofono_sms_status_notify() len 32 tpdu len 32
ofonod[677]: Unable to decode PDU

The PDU is valid, since I can decode it using some online tool.

It seems that sms_decode does not correctly handle the SMSCC part 
(913386094000F0),
and tries to decode it as the sender address, which obviously fails.

If in decode_deliver() function, I shift the PDU of 9 bytes (ie. PDU is 
DB0A810011223344216052714081802160527140228000),
then the function still fails (more or less expected), but the sender 
address is correctly decoded.


Do any of you have an idea on this matter ?


Regards.
Audric Schiltknecht

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unable to decode PDU for SMS-STATUS-REPORT
  2012-06-25 16:10 Unable to decode PDU for SMS-STATUS-REPORT Audric Schiltknecht
  2012-06-22  8:28 ` Denis Kenzior
@ 2012-06-25 16:20 ` Audric Schiltknecht
  2012-06-26  9:14   ` Philippe Nunes
  1 sibling, 1 reply; 5+ messages in thread
From: Audric Schiltknecht @ 2012-06-25 16:20 UTC (permalink / raw)
  To: ofono

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

On Mon, 25 Jun 2012 18:10:36 +0200, Audric Schiltknecht wrote:
> Hi guys.
>
> I'm having troubles with delivery reports.
>
> When I send a message with the property "UseDeliveryReports" set to 
> "true",
> I can get the delivery report from the GSM modem, but ofono is unable
> to decode it:
>
> ofonod[677]: SMS:    < \r\n+CDS:
> 
> 32\r\n07913386094000F006DB0A810011223344216052714081802160527140228000\r\n
> ofonod[677]: drivers/atmodem/sms.c:at_cds_notify() Got new
> Status-Report PDU via CDS:
> 07913386094000F006DB0A810011223344216052714081802160527140228000, 32
> ofonod[677]: src/sms.c:ofono_sms_status_notify() len 32 tpdu len 32
> ofonod[677]: Unable to decode PDU
>
> The PDU is valid, since I can decode it using some online tool.
>
> It seems that sms_decode does not correctly handle the SMSCC part
> (913386094000F0),
> and tries to decode it as the sender address, which obviously fails.


Digging a little further in the code, I found that the sms_decode() 
function is responsible
of decoding the SMSC part of the PDU. However, this is done if tpdu_len 
< len, which is not the case,
since both of them equal to 32.

If I correctly understand, 'tpdu' is returned by the modem in the +CDS 
notification.
Here, its value is 32, which is correct as shown in the logs.
'len' is calculated in the decode_hex_own_buffer() function called in 
the +CDS notification callback.
Here, its value also is 32, and I do not see how it could not be that.

Any help to point out my mistake(s) will be appreciated ;)

Regards,
Audric Schiltknecht

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unable to decode PDU for SMS-STATUS-REPORT
  2012-06-22  8:28 ` Denis Kenzior
@ 2012-06-26  7:18   ` Audric Schiltknecht
  0 siblings, 0 replies; 5+ messages in thread
From: Audric Schiltknecht @ 2012-06-26  7:18 UTC (permalink / raw)
  To: ofono

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

Hello Denis,

On Fri, 22 Jun 2012 03:28:55 -0500, Denis Kenzior wrote:
> Hi Audric,
>
> On 06/25/2012 11:10 AM, Audric Schiltknecht wrote:
>> Hi guys.
>>
>> I'm having troubles with delivery reports.
>>
>> When I send a message with the property "UseDeliveryReports" set to 
>> "true",
>> I can get the delivery report from the GSM modem, but ofono is 
>> unable to
>> decode it:
>>
>> ofonod[677]: SMS: < \r\n+CDS:
>> 
>> 32\r\n07913386094000F006DB0A810011223344216052714081802160527140228000\r\n
>> ofonod[677]: drivers/atmodem/sms.c:at_cds_notify() Got new 
>> Status-Report
>> PDU via CDS:
>> 07913386094000F006DB0A810011223344216052714081802160527140228000, 32
>> ofonod[677]: src/sms.c:ofono_sms_status_notify() len 32 tpdu len 32
>> ofonod[677]: Unable to decode PDU
>>
>> The PDU is valid, since I can decode it using some online tool.
>>
>> It seems that sms_decode does not correctly handle the SMSCC part
>> (913386094000F0),
>> and tries to decode it as the sender address, which obviously fails.
>>
>
> Likely it is because your modem is being stupid.  3GPP 27.005 states:
>
> <length> integer type value indicating in the text mode (+CMGF=1) the
> length of the message body <data> > (or <cdata>) in characters; or in
> PDU mode (+CMGF=0), the length of the actual TP data unit in octets
> (i.e. the RP layer SMSC address octets are not counted in the length)
>
> So in the case above it should be reporting the length of the
> payload, not the length of the entire hex string.

Oh, I see. I must have missed this part in the specs.

>
> See if the PDU is decoded successfully by setting tpdu_len to the
> appropriate value.

You are quite right on this, the modem is to blame...
I should have guessed it ;-)

Thank you again for your help.

Regards,
Audric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unable to decode PDU for SMS-STATUS-REPORT
  2012-06-25 16:20 ` Audric Schiltknecht
@ 2012-06-26  9:14   ` Philippe Nunes
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Nunes @ 2012-06-26  9:14 UTC (permalink / raw)
  To: ofono

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

Hi,

On 06/25/2012 06:20 PM, Audric Schiltknecht wrote:
> On Mon, 25 Jun 2012 18:10:36 +0200, Audric Schiltknecht wrote:
>> Hi guys.
>>
>> I'm having troubles with delivery reports.
>>
>> When I send a message with the property "UseDeliveryReports" set to
>> "true",
>> I can get the delivery report from the GSM modem, but ofono is unable
>> to decode it:
>>
>> ofonod[677]: SMS: < \r\n+CDS:
>>
>> 32\r\n07913386094000F006DB0A810011223344216052714081802160527140228000\r\n
>>
>> ofonod[677]: drivers/atmodem/sms.c:at_cds_notify() Got new
>> Status-Report PDU via CDS:
>> 07913386094000F006DB0A810011223344216052714081802160527140228000, 32
>> ofonod[677]: src/sms.c:ofono_sms_status_notify() len 32 tpdu len 32
>> ofonod[677]: Unable to decode PDU
>>
>> The PDU is valid, since I can decode it using some online tool.
>>
>> It seems that sms_decode does not correctly handle the SMSCC part
>> (913386094000F0),
>> and tries to decode it as the sender address, which obviously fails.
>
>
> Digging a little further in the code, I found that the sms_decode()
> function is responsible
> of decoding the SMSC part of the PDU. However, this is done if tpdu_len
> < len, which is not the case,
> since both of them equal to 32.
>
> If I correctly understand, 'tpdu' is returned by the modem in the +CDS
> notification.
> Here, its value is 32, which is correct as shown in the logs.
> 'len' is calculated in the decode_hex_own_buffer() function called in
> the +CDS notification callback.
> Here, its value also is 32, and I do not see how it could not be that.
>
> Any help to point out my mistake(s) will be appreciated ;)
>

As pointed by Denis, the length given by the CDS notification should be 
the length of the TPDU part (PDU without SMSC). In your case, this value 
should be 24 and not 32.

07913386094000F0 | 06DB0A810011223344216052714081802160527140228000
----------------   ------------------------------------------------
SMSC (8 octets)  |           TPDU (24 octets)

decode_hex_own_buffer() function returns the length of the PDU 
(including the SMSC). In your case, this value is indeed 32.

So, you're facing definitely with an incorrect modem behavior.
Regards,

Philippe.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-26  9:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-25 16:10 Unable to decode PDU for SMS-STATUS-REPORT Audric Schiltknecht
2012-06-22  8:28 ` Denis Kenzior
2012-06-26  7:18   ` Audric Schiltknecht
2012-06-25 16:20 ` Audric Schiltknecht
2012-06-26  9:14   ` Philippe Nunes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.