* [PATCH] qmimodem: Add USSD indication support
@ 2021-02-19 15:21 Alexey Andreyev
2021-02-19 15:30 ` Alexey Andreyev
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Andreyev @ 2021-02-19 15:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 3674 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] qmimodem: Add USSD indication support
2021-02-19 15:21 [PATCH] qmimodem: Add USSD indication support Alexey Andreyev
@ 2021-02-19 15:30 ` Alexey Andreyev
2021-02-22 16:06 ` Denis Kenzior
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Andreyev @ 2021-02-19 15:30 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2923 bytes --]
Sorry for a noob html format, retrying from a custom client as plaintext:
Hello! My first patch, feel free to criticize :) This is to handle the USSD
Indication messages with the qmimodem driver.
Higher-level KDE Plasma Mobile issue:
https://invent.kde.org/plasma-mobile/plasma-dialer/-/merge_requests/33
Tested with Quectel EG25-G (Pinephone BH), looks like working, I'm able to
receive the expected QMI USSD Indication messages.
---
From 2f041e6ba183a2f2a3309e139adef3d114bdc85b Mon Sep 17 00:00:00 2001
From: Alexey Andreyev <aa13q@ya.ru>
Date: Fri, 19 Feb 2021 15:47:42 +0300
Subject: [PATCH] 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 | 45 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/qmimodem/ussd.c b/drivers/qmimodem/ussd.c
index 1e613032..189de5bc 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,42 @@ 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 +183,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);
--
2.30.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] qmimodem: Add USSD indication support
2021-02-19 15:30 ` Alexey Andreyev
@ 2021-02-22 16:06 ` Denis Kenzior
0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2021-02-22 16:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
Hi Alexey,
On 2/19/21 9:30 AM, Alexey Andreyev wrote:
> Sorry for a noob html format, retrying from a custom client as plaintext:
>
> Hello! My first patch, feel free to criticize :) This is to handle the USSD
> Indication messages with the qmimodem driver.
> Higher-level KDE Plasma Mobile issue:
> https://invent.kde.org/plasma-mobile/plasma-dialer/-/merge_requests/33
> Tested with Quectel EG25-G (Pinephone BH), looks like working, I'm able to
> receive the expected QMI USSD Indication messages.
>
> ---
> From 2f041e6ba183a2f2a3309e139adef3d114bdc85b Mon Sep 17 00:00:00 2001
> From: Alexey Andreyev <aa13q@ya.ru>
> Date: Fri, 19 Feb 2021 15:47:42 +0300
> Subject: [PATCH] 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 | 45 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
I had to hand-edit this patch for it to apply and then fix up the whitespace
formatting. Please get git send-email working properly for future submissions.
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-22 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 15:21 [PATCH] qmimodem: Add USSD indication support Alexey Andreyev
2021-02-19 15:30 ` Alexey Andreyev
2021-02-22 16:06 ` Denis Kenzior
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.