Hi! > 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. > > 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 | 344 +++++++++++++++++++++++++++++++++++++++++-------- > drivers/qmimodem/wms.h | 77 ++++++++--- > 2 files changed, 348 insertions(+), 73 deletions(-) > > +static void delete_msg(struct ofono_sms *sms, uint8_t tag) { > + struct sms_data *data = ofono_sms_get_data(sms); > + struct qmi_param *param; > + qmi_result_func_t func = NULL; > + > + DBG(""); > + > + param = qmi_param_new(); > + if (param == NULL) > + goto done; > + > + qmi_param_append_uint8(param, QMI_WMS_PARAM_DEL_STORE, > + QMI_WMS_STORAGE_TYPE_NV); > + > + if (tag == QMI_WMS_MT_UNDEFINE) { > + DBG("delete read msg type %d ndx %d", data->rd_msg_id.type, > + data->rd_msg_id.ndx); > + > + /* delete 1 msg */ > + qmi_param_append_uint32(param, QMI_WMS_PARAM_DEL_NDX, > + data->rd_msg_id.ndx); > + func = delete_msg_cb; > + } else { > + DBG("delete msg tag %d mode %d", tag, data->msg_mode); > + > + /* delete all msgs from 1 tag type */ > + qmi_param_append_uint8(param, QMI_WMS_PARAM_DEL_TYPE, tag); > + } > + > + qmi_param_append_uint8(param, QMI_WMS_PARAM_DEL_MODE, data->msg_mode); > + > + if (qmi_service_send(data->wms, QMI_WMS_DELETE, param, > + func, sms, NULL) > 0) > return; > + > + qmi_param_free(param); > + > +done: > + return; > +} Explicit "return" at the end of void function looks quite strange to me. goto jumping to it even more so... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html