aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-10-15 12:35:11 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-10-15 13:19:10 +0200
commite3a1364ddc43e13fe86e98dfca24ef7f6f267b38 (patch)
tree9f3408bbd8b6d98f67d38ca460ee320a1dadf549 /src/mm-base-modem.c
parentd61cb4a21cc1f3509c54f841e2eafafc3ea9a4a9 (diff)
core: allow flagging ports as 'audio'
Instead of flagging them as 'ignored' so that they aren't probed, we can also flag them as 'audio' now, so that the logic knows which port to report as used for audio in the Call object.
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r--src/mm-base-modem.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index 3b9dc7db..2b96f1a6 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -95,6 +95,9 @@ struct _MMBaseModemPrivate {
MMPortSerialAt *gps_control;
MMPortSerialGps *gps;
+ /* Some audio-capable devices will have a port for audio specifically */
+ MMPortSerial *audio;
+
/* Support for parallel enable/disable operations */
GList *enable_tasks;
GList *disable_tasks;
@@ -232,6 +235,9 @@ mm_base_modem_grab_port (MMBaseModem *self,
} else if (ptype == MM_PORT_TYPE_GPS) {
/* Raw GPS port */
port = MM_PORT (mm_port_serial_gps_new (name));
+ } else if (ptype == MM_PORT_TYPE_AUDIO) {
+ /* Generic audio port */
+ port = MM_PORT (mm_port_serial_new (name, ptype));
} else {
g_set_error (error,
MM_CORE_ERROR,
@@ -646,6 +652,22 @@ mm_base_modem_peek_port_gps (MMBaseModem *self)
return self->priv->gps;
}
+MMPortSerial *
+mm_base_modem_get_port_audio (MMBaseModem *self)
+{
+ g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
+
+ return (self->priv->audio ? g_object_ref (self->priv->audio) : NULL);
+}
+
+MMPortSerial *
+mm_base_modem_peek_port_audio (MMBaseModem *self)
+{
+ g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
+
+ return self->priv->audio;
+}
+
#if defined WITH_QMI
MMPortQmi *
@@ -929,6 +951,9 @@ mm_base_modem_get_port_infos (MMBaseModem *self,
case MM_PORT_TYPE_GPS:
port_infos[i].type = MM_MODEM_PORT_TYPE_GPS;
break;
+ case MM_PORT_TYPE_AUDIO:
+ port_infos[i].type = MM_MODEM_PORT_TYPE_AUDIO;
+ break;
case MM_PORT_TYPE_QMI:
port_infos[i].type = MM_MODEM_PORT_TYPE_QMI;
break;
@@ -1039,6 +1064,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
MMPortSerialQcdm *qcdm = NULL;
MMPortSerialAt *gps_control = NULL;
MMPortSerialGps *gps = NULL;
+ MMPortSerial *audio = NULL;
MMPort *data_primary = NULL;
GList *data = NULL;
#if defined WITH_QMI
@@ -1129,6 +1155,12 @@ mm_base_modem_organize_ports (MMBaseModem *self,
gps = MM_PORT_SERIAL_GPS (candidate);
break;
+ case MM_PORT_TYPE_AUDIO:
+ g_assert (MM_IS_PORT_SERIAL (candidate));
+ if (!audio)
+ audio = MM_PORT_SERIAL (candidate);
+ break;
+
#if defined WITH_QMI
case MM_PORT_TYPE_QMI:
if (!qmi_primary)
@@ -1246,6 +1278,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
log_port (self, MM_PORT (qcdm), "qcdm");
log_port (self, MM_PORT (gps_control), "gps (control)");
log_port (self, MM_PORT (gps), "gps (nmea)");
+ log_port (self, MM_PORT (audio), "audio");
#if defined WITH_QMI
log_port (self, MM_PORT (qmi_primary), "qmi (primary)");
for (l = qmi; l; l = g_list_next (l))
@@ -1576,6 +1609,7 @@ dispose (GObject *object)
g_clear_object (&self->priv->qcdm);
g_clear_object (&self->priv->gps_control);
g_clear_object (&self->priv->gps);
+ g_clear_object (&self->priv->audio);
#if defined WITH_QMI
/* We need to close the QMI port cleanly when disposing the modem object,
* otherwise the allocated CIDs will be kept allocated, and if we end up