broadband-modem-mbim: add AT based fallback to load model name
Modify the load_model function to use the AT command to get the model name and display the module name in the model instead of [vid:pid]. Test on L860 Linux Device, use `mmcli -L`, it can show: "/org/free desktop/ModemManager1/Modem/0 [Intel] L860-GL-16 LTE Module"
This commit is contained in:

committed by
Aleksander Morgado

parent
be6392c745
commit
b758c57030
@@ -65,6 +65,7 @@ static void shared_qmi_init (MMSharedQmi
|
||||
static MMIfaceModemLocation *iface_modem_location_parent;
|
||||
#endif
|
||||
static MMIfaceModemSignal *iface_modem_signal_parent;
|
||||
static MMIfaceModem *iface_modem_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbim, mm_broadband_modem_mbim, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
@@ -816,6 +817,25 @@ qmi_load_model_ready (MMIfaceModem *self,
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
at_load_model_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
gchar *model = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
model = iface_modem_parent->load_model_finish (self, res, &error);
|
||||
if (!model) {
|
||||
mm_obj_dbg (self, "couldn't load model using AT: %s", error->message);
|
||||
model = modem_load_model_default (self);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_task_return_pointer (task, model, g_free);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
modem_load_model (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -831,6 +851,11 @@ modem_load_model (MMIfaceModem *self,
|
||||
if (port) {
|
||||
model = g_strdup (mm_kernel_device_get_physdev_product (
|
||||
mm_port_peek_kernel_device (MM_PORT (port))));
|
||||
if (model) {
|
||||
g_task_return_pointer (task, model, g_free);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
|
||||
@@ -840,11 +865,7 @@ modem_load_model (MMIfaceModem *self,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!model)
|
||||
model = modem_load_model_default (self);
|
||||
|
||||
g_task_return_pointer (task, model, g_free);
|
||||
g_object_unref (task);
|
||||
iface_modem_parent->load_model (self, (GAsyncReadyCallback)at_load_model_ready, task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -9238,6 +9259,7 @@ finalize (GObject *object)
|
||||
static void
|
||||
iface_modem_init (MMIfaceModem *iface)
|
||||
{
|
||||
iface_modem_parent = g_type_interface_peek_parent (iface);
|
||||
/* Initialization steps */
|
||||
iface->load_supported_capabilities = modem_load_supported_capabilities;
|
||||
iface->load_supported_capabilities_finish = modem_load_supported_capabilities_finish;
|
||||
|
Reference in New Issue
Block a user