Skip to contentSkip to conversation

qmimodem voicecall support

RFC PATCH In review Adam Pigg 2 participants 2 messages Mar 18, 2024 – Mar 20, 2024 Kbuild

lore
Share & tools
lore

Adam Pigg

author
#0 lore raw

RFC PATCH 1/1 qmimodem voicecall support

Hi

As previously mentioned, ive been working on updating Ofono in Sailfish. There are several patches which probably are of no interest, but this one may be. It implements voicecall support for the qmimodem driver, and ive tested it on a PinephonePro, and can make/receive/hangup calls.

I cant take credit for the original implementation, it was taken from other ofono forks out there, such as https://github.com/maemo-leste-upstream-forks/
ofono/commit/9c8ec63c1bb41a03cd87d2733dd83ecd148d0105

The changes I have made include:
*moving voice_generated.* into voice.*
This is because it isnt actually generated and reduces the files in the tree
*removed glib and replaced with ell
*tweaked the notify code in call_list.c
Changed the disconnect type from UNKNOWN because in src/voicecall.c, if the
reason is UNKNOWN then it doesnt then perform the dbus notify
Made it call ofono_voicecall_disconnected when the state was DISCONNECTED
(QMI state disconnecting and end)

The common/call_list.* files can potentially be used by other drivers.

Apologies for attaching the patch, git send-email is not my normal work flow! :)

Adam

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Adam Pigg <[email protected]>
Date: Tue, 12 Mar 2024 18:52:32 +0000
Subject: [PATCH 1/1] Add voicecall support to the qmimodem driver

Adds a call_list helper which could be shared across drivers

---
 Makefile.am                  |   6 +-
 drivers/common/call_list.c   | 151 ++++++++++++
 drivers/common/call_list.h   |  49 ++++
 drivers/qmimodem/qmi.h       |  14 ++
 drivers/qmimodem/voice.c     | 365 +++++++++++++++++++++++++++++
 drivers/qmimodem/voice.h     | 242 ++++++++++++++++---
 drivers/qmimodem/voicecall.c | 435 ++++++++++++++++++++++++++++++++++-
 src/common.h                 |   5 +
 8 files changed, 1223 insertions(+), 44 deletions(-)
 create mode 100644 drivers/common/call_list.c
 create mode 100644 drivers/common/call_list.h
 create mode 100644 drivers/qmimodem/voice.c
Makefile.am +4 -2
index 636546189a50f338f77706ec465cded268a89210..7f8a691d6f0679eb94ccb64bf418cf20a98db689 100644
@@ -373,8 +373,8 @@ qmi_sources = drivers/qmimodem/qmi.h drivers/qmimodem/qmi.c \
 					drivers/qmimodem/pds.h \
 					drivers/qmimodem/common.h \
 					drivers/qmimodem/wda.h \
-					drivers/qmimodem/voice.h
-
+					drivers/qmimodem/voice.h \
+					drivers/qmimodem/voice.c
 builtin_sources += $(qmi_sources) \
 			drivers/qmimodem/util.h \
 			drivers/qmimodem/devinfo.c \
@@ -579,6 +579,8 @@ builtin_sources += plugins/ublox.c
 builtin_sources += plugins/xmm7xxx.c
 builtin_sources += plugins/droid.c
 
+builtin_sources += drivers/common/call_list.c
+
 builtin_modules += stemgr
 builtin_sources += plugins/stemgr.c
 
drivers/common/call_list.c new file +151 -0

151 lines not on this page · raw message

drivers/common/call_list.h new file +49 -0

49 lines not on this page · raw message

drivers/qmimodem/qmi.h +14 -0
index 506fed6b3a66c874ff82b26559e478fc9533201e..9caffa88da9559ef625045843c0db49e45c4bc87 100644
@@ -19,6 +19,9 @@
  *
  */
 
+#ifndef __OFONO_QMI_QMI_H
+#define __OFONO_QMI_QMI_H
+
 #include <stdbool.h>
 #include <stdint.h>
 
@@ -54,6 +57,7 @@
 #define QMI_SERVICE_CAT_OLD	224	/* Card application toolkit service */
 #define QMI_SERVICE_RMS		225	/* Remote management service */
 #define QMI_SERVICE_OMA		226	/* OMA device management service */
+#define QMI_SERVICE_UPDATE  400
 
 enum qmi_device_expected_data_format {
 	QMI_DEVICE_EXPECTED_DATA_FORMAT_UNKNOWN,
@@ -176,3 +180,13 @@ uint16_t qmi_service_register(struct qmi_service *service,
 				void *user_data, qmi_destroy_func_t destroy);
 bool qmi_service_unregister(struct qmi_service *service, uint16_t id);
 bool qmi_service_unregister_all(struct qmi_service *service);
+
+
+/* FIXME: find a place for parse_error */
+enum parse_error {
+	NONE = 0,
+	MISSING_MANDATORY = 1,
+	INVALID_LENGTH = 2,
+};
+
+#endif /* __OFONO_QMI_QMI_H */
drivers/qmimodem/voice.c new file +365 -0

365 lines not on this page · raw message

drivers/qmimodem/voice.h +205 -37

267 lines not on this page · raw message

drivers/qmimodem/voicecall.c +430 -5

489 lines not on this page · raw message

src/common.h +5 -0
index cede20d1de329a26dc7de7946de1f5b2a0f6810c..c226d468b8e2830cae09890fdfaae9d9d6523d97 100644
@@ -19,6 +19,9 @@
  *
  */
 
+#ifndef OFONO_COMMON_H
+#define OFONO_COMMON_H
+
 #include <stdbool.h>
 #include <glib.h>
 
@@ -193,3 +196,5 @@ bool gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto);
 const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth);
 bool gprs_auth_method_from_string(const char *str,
 					enum ofono_gprs_auth_method *auth);
+
+#endif
#1 lore raw

Hi Adam,

Quoted 11 lines · Adam Pigg

Hi

As previously mentioned, ive been working on updating Ofono in Sailfish. There are several patches which probably are of no interest, but this one may be. It implements voicecall support for the qmimodem driver, and ive tested it on a PinephonePro, and can make/receive/hangup calls.

I cant take credit for the original implementation, it was taken from other ofono forks out there, such as https://github.com/maemo-leste-upstream-forks/
ofono/commit/9c8ec63c1bb41a03cd87d2733dd83ecd148d0105

Quoted 10 lines

The changes I have made include:
*moving voice_generated.* into voice.*
This is because it isnt actually generated and reduces the files in the tree
*removed glib and replaced with ell
*tweaked the notify code in call_list.c
Changed the disconnect type from UNKNOWN because in src/voicecall.c, if the
reason is UNKNOWN then it doesnt then perform the dbus notify
Made it call ofono_voicecall_disconnected when the state was DISCONNECTED
(QMI state disconnecting and end)

That's an awesome start. Some preliminary comments:

- Since you've made so many changes already, even based on work by other authors, it would be okay to add your copyright to the added / modified files.

- Coding style and formatting. There's quite a bit of formatting problems in the file. See oFono's doc/coding-style.txt for our coding style guidelines. Also, it may be a good idea to run this patch and future submissions through Linux Kernel's checkpatch.pl script to avoid going through multiple rounds of reviews due to style issues. Some minor nitpicks I can fix in place (assuming the author doesn't mind) when applying the patch, but there's too many in this RFC at the moment.

- Also watch out for mixed tabs and space indentation, > 80 char lines, redundant double empty lines, etc.

- Redundant changes. Many changes seem to be spurious / redundant, particularly in voice.h file. This makes the diff bigger for no apparent reason. Can this be fixed?

- Much of voice.c seems to be not useful. The only user of these functions would be in the voicecall driver itself. I'd rather not introduce intermediate APIs for no reason. Could you inline the operations directly in the driver method implementation? For example, static void dial() invokes qmi_voice_dial_call(). Just inline the qmi_voice_dial_call() implementation inside dial().

- I know this is an existing driver, but any chance you could split this up a bit into multiple patches? Think of it as telling a story / writing a novel. Introduce new data structures / operations as you use them. One strategy might be to break this up like this:
- Dial implementation
- Event processing / all_call_status_ind()
- Answer implementation
- Release specific implementation
- hangup active implementation
- DTMF implementation

Quoted 2 lines

The common/call_list.* files can potentially be used by other drivers.

Can you put call_list.[ch] into the voicecall.c for now? I understand the reason for why this was invented / why this exists, but ultimately there's a much better approach that we can utilize. We'll worry about this a bit later once the initial set is upstream.

Quoted 2 lines

Apologies for attaching the patch, git send-email is not my normal work flow! :)

Please use git send-email for submissions. Patchwork does not work well with attachments. oFono CI (which is still a bit WIP) doesn't like attachments either. It is also much easier to comment on patches sent via git send-email since the patch contents can be easily replied to in-line.

As a side benefit, the CI runs checkpatch, checks compilation on multiple platforms, etc.

Regards,
-Denis