Skip to contentSkip to conversation

qmi: sms: Implement message ack

PATCH Applied Ivaylo Dimitrov 2 participants 2 messages Jul 23, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qmi: sms: Implement message ack

A "transfer route" message may come with ack_required being set to require ack, obey that.

---
 drivers/qmimodem/sms.c | 44 ++++++++++++++++++++++++++++++++++++++++++
 drivers/qmimodem/wms.h |  3 +++
 2 files changed, 47 insertions(+)
drivers/qmimodem/sms.c +44 -0
index 43fa9e39..39a4bb3f 100644
@@ -571,6 +571,47 @@ static void get_msg_protocol(struct ofono_sms *sms)
 				get_msg_protocol_cb, sms, NULL);
 }
 
+static void send_ack_cb(struct qmi_result *result, void *user_data)
+{
+	uint16_t err;
+
+	DBG("");
+
+	if (!qmi_result_set_error(result, &err))
+		return;
+
+	DBG("Err: protocol %d - %s",
+			err, qmi_result_get_error(result));
+}
+
+static void send_ack(struct sms_data *data,
+				const struct qmi_wms_result_message *message)
+{
+	struct __attribute__((__packed__)) {
+		uint32_t transaction_id;
+		uint8_t mode;
+		uint8_t success;
+	} ack;
+	struct qmi_param *param;
+
+	ack.transaction_id = message->transaction_id;
+	ack.success = 1;
+
+	if (message->msg_format == 0)
+		ack.mode = QMI_WMS_MESSAGE_MODE_CDMA;
+	else
+		ack.mode = QMI_WMS_MESSAGE_MODE_GSMWCDMA;
+
+	param = qmi_param_new();
+	qmi_param_append(param, 0x01, sizeof(ack), &ack);
+
+	if (qmi_service_send(data->wms, QMI_WMS_SEND_ACK, param,
+				send_ack_cb, NULL, NULL) > 0)
+		return;
+
+	qmi_param_free(param);
+}
+
 static void event_notify(struct qmi_result *result, void *user_data)
 {
 	struct ofono_sms *sms = user_data;
@@ -615,6 +656,9 @@ static void event_notify(struct qmi_result *result, void *user_data)
 			DBG("msg format %d PDU length %d",
 				message->msg_format, plen);
 
+			if (message->ack_required == QMI_WMS_ACK_REQUIRED)
+				send_ack(data, message);
+
 			ofono_sms_deliver_notify(sms, message->msg_data,
 							plen, plen);
 		}
drivers/qmimodem/wms.h +3 -0
index 9d7165b5..f8d4f3f5 100644
@@ -20,6 +20,7 @@
 #define QMI_WMS_GET_SMSC_ADDR		52	/* Get SMSC address */
 #define QMI_WMS_SET_SMSC_ADDR		53	/* Set SMSC address */
 #define QMI_WMS_GET_MSG_LIST_MAX	54	/* Get maximum size of SMS storage */
+#define QMI_WMS_SEND_ACK		55	/* Send Ack */
 
 #define QMI_WMS_GET_DOMAIN_PREF		64	/* Get domain preference */
 #define QMI_WMS_SET_DOMAIN_PREF		65	/* Set domain preference */
@@ -32,6 +33,8 @@ struct qmi_wms_result_new_msg_notify {
 	uint32_t storage_index;
 } __attribute__((__packed__));
 
+#define QMI_WMS_ACK_REQUIRED			0x00
+
 #define QMI_WMS_RESULT_MESSAGE			0x11
 struct qmi_wms_result_message {
 	uint8_t ack_required;				/* bool */
Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to ofono.git (master) by Denis Kenzior <[email protected]>:

Hello:

This patch was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:

Quoted 6 lines · On Wed, 23 Jul 2025 09:04:37 +0300 you wrote:

A "transfer route" message may come with ack_required being set to require ack, obey that.

---
 drivers/qmimodem/sms.c | 44 ++++++++++++++++++++++++++++++++++++++++++
 drivers/qmimodem/wms.h |  3 +++
 2 files changed, 47 insertions(+)

Here is the summary with links:
- qmi: sms: Implement message ack

    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=ad2de57ce8f3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html