summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-12-18 16:22:52 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-03-03 23:16:59 +0100
commit78d8fa8015b8d86768eec8e779bd523591af59c0 (patch)
tree1820f6095f322537a6d81a1b8643bf934c4012b3
parent79b251a8f739a1da13faef5525f10b20d9e90537 (diff)
downloadModemManager-78d8fa8015b8d86768eec8e779bd523591af59c0.tar.gz
firmware: export a device id containing the carrier info
In order to support different per-carrier upgrade paths in fwupd.
-rw-r--r--src/mm-iface-modem-firmware.c11
-rw-r--r--src/mm-iface-modem.c18
-rw-r--r--src/mm-iface-modem.h5
3 files changed, 32 insertions, 2 deletions
diff --git a/src/mm-iface-modem-firmware.c b/src/mm-iface-modem-firmware.c
index 5cbe87415..1775a1cb2 100644
--- a/src/mm-iface-modem-firmware.c
+++ b/src/mm-iface-modem-firmware.c
@@ -311,6 +311,7 @@ add_generic_device_ids (MMBaseModem *self,
GPtrArray *ids;
MMPort *primary = NULL;
const gchar *subsystem;
+ const gchar *aux;
vid = mm_base_modem_get_vendor_id (self);
pid = mm_base_modem_get_product_id (self);
@@ -334,7 +335,17 @@ add_generic_device_ids (MMBaseModem *self,
return FALSE;
}
+ /* carrier = g_ascii_strup (mm_iface_modem_get_carrier_config (MM_IFACE_MODEM (self)), -1); */
+ aux = mm_iface_modem_get_carrier_config (MM_IFACE_MODEM (self));
+
ids = g_ptr_array_new_with_free_func ((GDestroyNotify)g_free);
+ if (aux) {
+ gchar *carrier;
+
+ carrier = g_ascii_strup (aux, -1);
+ g_ptr_array_add (ids, g_strdup_printf ("USB\\VID_%04X&PID_%04X&REV_%04X&CARRIER_%s", vid, pid, rid, carrier));
+ g_free (carrier);
+ }
g_ptr_array_add (ids, g_strdup_printf ("USB\\VID_%04X&PID_%04X&REV_%04X", vid, pid, rid));
g_ptr_array_add (ids, g_strdup_printf ("USB\\VID_%04X&PID_%04X", vid, pid));
g_ptr_array_add (ids, g_strdup_printf ("USB\\VID_%04X", vid));
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 9befbddb9..292923db9 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -5452,6 +5452,24 @@ mm_iface_modem_get_revision (MMIfaceModem *self)
return revision;
}
+const gchar *
+mm_iface_modem_get_carrier_config (MMIfaceModem *self)
+{
+ const gchar *carrier_config = NULL;
+ MmGdbusModem *skeleton;
+
+ g_object_get (self,
+ MM_IFACE_MODEM_DBUS_SKELETON, &skeleton,
+ NULL);
+
+ if (skeleton) {
+ carrier_config = mm_gdbus_modem_get_carrier_configuration (skeleton);
+ g_object_unref (skeleton);
+ }
+
+ return carrier_config;
+}
+
/*****************************************************************************/
static void
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index cb7a75ed6..82236dd42 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -400,8 +400,9 @@ gboolean mm_iface_modem_is_4g (MMIfaceModem *self);
gboolean mm_iface_modem_is_4g_only (MMIfaceModem *self);
/* Helpers to query properties */
-const gchar *mm_iface_modem_get_model (MMIfaceModem *self);
-const gchar *mm_iface_modem_get_revision (MMIfaceModem *self);
+const gchar *mm_iface_modem_get_model (MMIfaceModem *self);
+const gchar *mm_iface_modem_get_revision (MMIfaceModem *self);
+const gchar *mm_iface_modem_get_carrier_config (MMIfaceModem *self);
/* Initialize Modem interface (async) */
void mm_iface_modem_initialize (MMIfaceModem *self,