All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Nguyen <tomirq@earthlink.net>
To: ofono@ofono.org
Subject: Re: [PATCH v3] qmimodem: support wake on SMS receive
Date: Sat, 28 Sep 2019 01:48:39 +0000	[thread overview]
Message-ID: <1507338948.2591.1559746007437@wamui-aurora.atl.sa.earthlink.net> (raw)

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

Hi Denis,

>From: Tom Nguyen
>
>Hi Denis,
>
>>From: Denis Kenzior 
>>
>>Hi Tom,
>>
>>On 05/23/2019 01:15 PM, Tom Nguyen wrote:
>>> Some modems, like Quectel EC25, support waking the host platform from a suspend state upon an SMS reception. Current SMS handling configures the modem to not save incoming messages. On platforms where the modem's interfaces (eg, cdc-wdm, wwan, etc) disconnect on suspend and reconnect on resume, oFono will re-initialize. This can cause lost messages upon resume because the QMI indication is sent before oFono is ready.
>>
>>Note, the commit description should be broken up with no line longer 
>>than 72 characters.
>>
>>> 
>>> Changes to support suspend/resume with wake on SMS:
>>> - On startup:
>>>    1. Configure modem to save messages to NV and notify for class NONE.
>>>    2. Delete all processed messages in modem memory to free space.
>>>    3. Get list of unread messages, then get and delete each.
>>> - After startup:
>>>    1. Process message upon event indication and delete.
>>>    2. Then check for possibly more messages to process.
>>> ---
>>>   drivers/qmimodem/sms.c | 327 ++++++++++++++++++++++++++++++++++++++++---------
>>>   drivers/qmimodem/wms.h |  77 +++++++++---
>>>   2 files changed, 332 insertions(+), 72 deletions(-)
>>> 

<snip>

>>>   static void event_notify(struct qmi_result *result, void *user_data) @@ -367,66 +575,72 @@ static void event_notify(struct qmi_result *result, void *user_data)
>>>   	struct ofono_sms *sms = user_data;
>>>   	struct sms_data *data = ofono_sms_get_data(sms);
>>>   	const struct qmi_wms_result_new_msg_notify *notify;
>>> -	const struct qmi_wms_result_message *message;
>>> -	uint16_t len;
>>>   
>>>   	DBG("");
>>>   
>>> -	notify = qmi_result_get(result, QMI_WMS_RESULT_NEW_MSG_NOTIFY, &len);
>>> +	notify = qmi_result_get(result, QMI_WMS_RESULT_NEW_MSG_NOTIFY, NULL);
>>>   	if (notify) {
>>> -		DBG("storage type %d index %d", notify->storage_type,
>>> -				GUINT32_FROM_LE(notify->storage_index));
>>> -	}
>>> +		/* route is store and notify */
>>> +		if (!qmi_result_get_uint8(result, QMI_WMS_RESULT_MSG_MODE,
>>> +				&data->msg_mode))
>>> +			DBG("msg mode not found, use mode %d", data->msg_mode);
>>> +
>>> +		DBG("msg type %d ndx %d mode %d", notify->storage_type,
>>> +			GUINT32_FROM_LE(notify->storage_index), data->msg_mode);
>>> +
>>> +		/* don't read if list is being processed, will find this msg */
>>> +		if (!data->msg_list_chk)
>>> +			raw_read(sms, notify->storage_type,
>>> +					GUINT32_FROM_LE(notify->storage_index));
>>
>>So I'm not familiar with QMI enough to truly know what is happening. 
>>But it looks like you are changing the logic slightly in this function. 
>>Before it would attempt to grab the QMI_WMS_RESULT_NEW_MSG_NOTIFY 
>>structure only for debug purposes, and instead attempt to grab the 
>>QMI_WMS_RESULT_MESSAGE in all cases.  If the QMI_WMS_RESULT_MESSAGE was 
>>not present, then the raw-read stuff would be triggered.  You're doing 
>>it slightly differently here.  It may be worth a comment.
>>
>>Also, it may be clearer if the introduction of raw_read and the 
>>refactoring of this function are done as a separate commit.
>>
>
>Hmm, looking at the "Quectel EC21" comment again, looks like the original code was done to address a quirk (ie, bug???) with that modem. I'll revert to reading both.
>
>But, per spec, the 2 message TLVs are mutually exclusive, depending on the route action configuration. I'm referring to setting "new_list->route[0].action =" in get_routes_cb(). So, we shouldn't need to always read both since one is guaranteed to fail.
>
>Also, the original code, if somehow both "notify" and "message" are NULL, it'll erroneously use a null notify. I'll address this in the revert.
>

On 2nd thought, my change is still ok per that "Quectel EC21" comment. I'll keep my changes and add comment to explain the 2 TLV that are being queried. Also, I introduced raw_read because I need to pull QMI_WMS_RAW_READ out of event_notify to service both event_notify and the message list. So, I'd like to keep this in the same commit.

Thanks,
Tom

             reply	other threads:[~2019-09-28  1:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-28  1:48 Tom Nguyen [this message]
2019-06-05 15:09 ` [PATCH v3] qmimodem: support wake on SMS receive Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2019-09-28  1:48 Tom Nguyen
2019-09-28  1:48 Tom Nguyen
2019-09-28  1:48 Tom Nguyen
2019-05-24 17:56 ` Denis Kenzior

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=1507338948.2591.1559746007437@wamui-aurora.atl.sa.earthlink.net \
    --to=tomirq@earthlink.net \
    --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 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.