foxconn: remove QMI_SERVICE_FOX from Generic MBIM modem object

Allocate the fox_client to attempt loading the firmware info using
QMI_SERVICE_FOX,and release it when no longer needed.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/599
This commit is contained in:
Fanice.luo
2022-09-15 10:11:23 +08:00
committed by Aleksander Morgado
parent a93c1f6f19
commit fab0481027
2 changed files with 30 additions and 8 deletions

View File

@@ -36,6 +36,7 @@
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED #if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
# include "mm-iface-modem-firmware.h" # include "mm-iface-modem-firmware.h"
# include "mm-shared-qmi.h" # include "mm-shared-qmi.h"
# include "mm-log.h"
#endif #endif
static void iface_modem_location_init (MMIfaceModemLocation *iface); static void iface_modem_location_init (MMIfaceModemLocation *iface);
@@ -164,15 +165,19 @@ fox_get_firmware_version_ready (QmiClientFox *client,
} }
static void static void
firmware_load_update_settings (MMIfaceModemFirmware *self, mbim_port_allocate_qmi_client_ready (MMPortMbim *mbim,
GAsyncReadyCallback callback, GAsyncResult *res,
gpointer user_data) GTask *task)
{ {
GTask *task; MMIfaceModemFirmware *self;
QmiClient *fox_client = NULL; QmiClient *fox_client = NULL;
QmiClient *dms_client = NULL; QmiClient *dms_client = NULL;
g_autoptr(GError) error = NULL;
task = g_task_new (self, NULL, callback, user_data); self = g_task_get_source_object (task);
if (!mm_port_mbim_allocate_qmi_client_finish (mbim, res, &error))
mm_obj_dbg (self, "Allocate FOX client failed: %s", error->message);
/* Try to get firmware version over fox service, if it failed to peek client, try dms service. */ /* Try to get firmware version over fox service, if it failed to peek client, try dms service. */
fox_client = mm_shared_qmi_peek_client (MM_SHARED_QMI (self), QMI_SERVICE_FOX, MM_PORT_QMI_FLAG_DEFAULT, NULL); fox_client = mm_shared_qmi_peek_client (MM_SHARED_QMI (self), QMI_SERVICE_FOX, MM_PORT_QMI_FLAG_DEFAULT, NULL);
@@ -225,6 +230,24 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
g_assert_not_reached (); g_assert_not_reached ();
} }
static void
firmware_load_update_settings (MMIfaceModemFirmware *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
MMPortMbim *mbim;
task = g_task_new (self, NULL, callback, user_data);
mbim = mm_broadband_modem_mbim_peek_port_mbim (MM_BROADBAND_MODEM_MBIM (self));
mm_port_mbim_allocate_qmi_client (mbim,
QMI_SERVICE_FOX,
NULL,
(GAsyncReadyCallback)mbim_port_allocate_qmi_client_ready,
task);
}
#endif #endif
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -2933,7 +2933,6 @@ static const QmiService qmi_services[] = {
QMI_SERVICE_PDS, QMI_SERVICE_PDS,
QMI_SERVICE_LOC, QMI_SERVICE_LOC,
QMI_SERVICE_PDC, QMI_SERVICE_PDC,
QMI_SERVICE_FOX,
QMI_SERVICE_UIM, QMI_SERVICE_UIM,
}; };