pmaports/temp/ofono/0008-qmimodem-add-ussd-indication-support.patch
Alexey Andreyev 73a5cace0d
temp/ofono: implement USSD indication in qmimodem driver (MR 1976)
Handle USSD QMI indication messages.
Add support for UCS2 USS Data coding scheme.
Check for User Action TLV type.

Downstream the accepted ofono patch as temporary solution.
2021-02-24 03:55:44 +03:00

84 lines
2.3 KiB
Diff

From ce86a6c207222fd5c42b53bc6c4a39c545f543de Mon Sep 17 00:00:00 2001
From: Alexey Andreyev <aa13q@ya.ru>
Date: Fri, 19 Feb 2021 15:47:42 +0300
Subject: qmimodem: Add USSD indication support
Handle USSD QMI indication messages.
Add support for UCS2 USS Data coding scheme.
Check for User Action TLV type.
---
drivers/qmimodem/ussd.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/drivers/qmimodem/ussd.c b/drivers/qmimodem/ussd.c
index 1e613032..e5399b9d 100644
--- a/drivers/qmimodem/ussd.c
+++ b/drivers/qmimodem/ussd.c
@@ -67,6 +67,12 @@ static int convert_qmi_dcs_gsm_dcs(int qmi_dcs, int *gsm_dcs)
case QMI_USSD_DCS_ASCII:
*gsm_dcs = USSD_DCS_8BIT;
break;
+ case QMI_USSD_DCS_8BIT:
+ *gsm_dcs = USSD_DCS_8BIT;
+ break;
+ case QMI_USSD_DCS_UCS2:
+ *gsm_dcs = USSD_DCS_UCS2;
+ break;
default:
return 1;
}
@@ -74,6 +80,41 @@ static int convert_qmi_dcs_gsm_dcs(int qmi_dcs, int *gsm_dcs)
return 0;
}
+static void async_ind(struct qmi_result *result, void *user_data)
+{
+ struct ofono_ussd *ussd = user_data;
+ const struct qmi_ussd_data *qmi_ussd;
+ uint8_t user_action_required = 0;
+ int notify_status = OFONO_USSD_STATUS_NOTIFY;
+ uint16_t len;
+ int gsm_dcs;
+
+ DBG("");
+
+ qmi_ussd = qmi_result_get(result, QMI_VOICE_PARAM_USSD_IND_DATA, &len);
+ if (qmi_ussd == NULL)
+ return;
+
+ if (validate_ussd_data(qmi_ussd, len))
+ goto error;
+
+ if (convert_qmi_dcs_gsm_dcs(qmi_ussd->dcs, &gsm_dcs))
+ goto error;
+
+ if (qmi_result_get_uint8(result, QMI_VOICE_PARAM_USSD_IND_USER_ACTION,
+ &user_action_required)) {
+ if (user_action_required == QMI_USSD_USER_ACTION_REQUIRED)
+ notify_status = OFONO_USSD_STATUS_ACTION_REQUIRED;
+ }
+
+ ofono_ussd_notify(ussd, notify_status, gsm_dcs,
+ qmi_ussd->data, qmi_ussd->length);
+ return;
+
+error:
+ ofono_ussd_notify(ussd, OFONO_USSD_STATUS_TERMINATED, 0, NULL, 0);
+}
+
static void async_orig_ind(struct qmi_result *result, void *user_data)
{
struct ofono_ussd *ussd = user_data;
@@ -141,6 +182,9 @@ static void create_voice_cb(struct qmi_service *service, void *user_data)
data->voice = qmi_service_ref(service);
+ qmi_service_register(data->voice, QMI_VOICE_USSD_IND,
+ async_ind, ussd, NULL);
+
qmi_service_register(data->voice, QMI_VOICE_ASYNC_ORIG_USSD,
async_orig_ind, ussd, NULL);
--
cgit 1.2.3-1.el7