foxconn: setup FCC unlock step
Use the new "DMS Foxconn Set FCC authentication" command to request the modem unlock during a power up operation. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/373
This commit is contained in:
@@ -399,7 +399,7 @@ dnl-----------------------------------------------------------------------------
|
||||
dnl QMI support (enabled by default)
|
||||
dnl
|
||||
|
||||
LIBQMI_VERSION=1.29.6
|
||||
LIBQMI_VERSION=1.29.7
|
||||
|
||||
AC_ARG_WITH(qmi, AS_HELP_STRING([--without-qmi], [Build without QMI support]), [], [with_qmi=yes])
|
||||
AM_CONDITIONAL(WITH_QMI, test "x$with_qmi" = "xyes")
|
||||
|
@@ -41,6 +41,7 @@
|
||||
static void iface_modem_location_init (MMIfaceModemLocation *iface);
|
||||
|
||||
#if defined WITH_QMI
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
|
||||
#endif
|
||||
|
||||
@@ -48,6 +49,7 @@ static MMIfaceModemLocation *iface_modem_location_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimFoxconn, mm_broadband_modem_mbim_foxconn, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
|
||||
#if defined WITH_QMI
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
|
||||
#endif
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init))
|
||||
@@ -62,6 +64,62 @@ struct _MMBroadbandModemMbimFoxconnPrivate {
|
||||
FeatureSupport unmanaged_gps_support;
|
||||
};
|
||||
|
||||
|
||||
#if defined WITH_QMI
|
||||
|
||||
/*****************************************************************************/
|
||||
/* FCC unlock (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
fcc_unlock_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void
|
||||
dms_foxconn_set_fcc_authentication_ready (QmiClientDms *client,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
g_autoptr(QmiMessageDmsFoxconnSetFccAuthenticationOutput) output = NULL;
|
||||
|
||||
output = qmi_client_dms_foxconn_set_fcc_authentication_finish (client, res, &error);
|
||||
if (!output || !qmi_message_dms_foxconn_set_fcc_authentication_output_get_result (output, &error))
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
fcc_unlock (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
QmiClient *client = NULL;
|
||||
g_autoptr(QmiMessageDmsFoxconnSetFccAuthenticationInput) input = NULL;
|
||||
|
||||
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
||||
QMI_SERVICE_DMS, &client,
|
||||
callback, user_data))
|
||||
return;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
input = qmi_message_dms_foxconn_set_fcc_authentication_input_new ();
|
||||
qmi_message_dms_foxconn_set_fcc_authentication_input_set_value (input, 0x00, NULL);
|
||||
qmi_client_dms_foxconn_set_fcc_authentication (QMI_CLIENT_DMS (client),
|
||||
input,
|
||||
5,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)dms_foxconn_set_fcc_authentication_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Firmware update settings
|
||||
*
|
||||
@@ -70,8 +128,6 @@ struct _MMBroadbandModemMbimFoxconnPrivate {
|
||||
* report.
|
||||
*/
|
||||
|
||||
#if defined WITH_QMI
|
||||
|
||||
static MMFirmwareUpdateSettings *
|
||||
firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
|
||||
GAsyncResult *res,
|
||||
@@ -482,6 +538,13 @@ iface_modem_location_init (MMIfaceModemLocation *iface)
|
||||
|
||||
#if defined WITH_QMI
|
||||
|
||||
static void
|
||||
iface_modem_init (MMIfaceModem *iface)
|
||||
{
|
||||
iface->fcc_unlock = fcc_unlock;
|
||||
iface->fcc_unlock_finish = fcc_unlock_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_firmware_init (MMIfaceModemFirmware *iface)
|
||||
{
|
||||
|
Reference in New Issue
Block a user