diff options
-rw-r--r-- | plugins/foxconn/mm-broadband-modem-mbim-foxconn.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c b/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c index ae6fa196..1473dca8 100644 --- a/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c +++ b/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c @@ -81,22 +81,29 @@ firmware_load_update_settings_finish (MMIfaceModemFirmware *self, return g_task_propagate_pointer (G_TASK (res), error); } -static MMFirmwareUpdateSettings * -create_update_settings (MMBroadbandModemMbimFoxconn *self, - const gchar *version_str) +static gboolean +needs_qdu_and_mcfg_apps_version (MMIfaceModemFirmware *self) { - MMModemFirmwareUpdateMethod methods = MM_MODEM_FIRMWARE_UPDATE_METHOD_NONE; - MMFirmwareUpdateSettings *update_settings = NULL; - guint vendor_id; - guint product_id; + guint vendor_id; + guint product_id; - /* 0x105b is the T99W175 module, T99W175 supports QDU, - * T99W265(0x0489:0xe0da ; 0x0489:0xe0db): supports QDU - * else support FASTBOOT and QMI PDC. + /* 0x105b is the T99W175 module, T99W175 supports QDU and requires MCFG+APPS version. + * T99W265(0x0489:0xe0da ; 0x0489:0xe0db): supports QDU and requires MCFG+APPS version. + * else support FASTBOOT and QMI PDC, and require only MCFG version. */ vendor_id = mm_base_modem_get_vendor_id (MM_BASE_MODEM (self)); product_id = mm_base_modem_get_product_id (MM_BASE_MODEM (self)); - if (vendor_id == 0x105b || (vendor_id == 0x0489 && (product_id == 0xe0da || product_id == 0xe0db))) + return (vendor_id == 0x105b || (vendor_id == 0x0489 && (product_id == 0xe0da || product_id == 0xe0db))); +} + +static MMFirmwareUpdateSettings * +create_update_settings (MMIfaceModemFirmware *self, + const gchar *version_str) +{ + MMModemFirmwareUpdateMethod methods = MM_MODEM_FIRMWARE_UPDATE_METHOD_NONE; + MMFirmwareUpdateSettings *update_settings = NULL; + + if (needs_qdu_and_mcfg_apps_version (self)) methods = MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU; else methods = MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT | MM_MODEM_FIRMWARE_UPDATE_METHOD_QMI_PDC; @@ -161,27 +168,12 @@ firmware_load_update_settings (MMIfaceModemFirmware *self, GAsyncReadyCallback callback, gpointer user_data) { - GTask *task; - QmiFoxFirmwareVersionType fox_version_type; - QmiClient *fox_client = NULL; - QmiDmsFoxconnFirmwareVersionType dms_version_type; - QmiClient *dms_client = NULL; - guint vendor_id; - guint product_id; + GTask *task; + QmiClient *fox_client = NULL; + QmiClient *dms_client = NULL; task = g_task_new (self, NULL, callback, user_data); - /* 0x105b is the T99W175 module, T99W175/T99W265 need to compare the apps version. */ - vendor_id = mm_base_modem_get_vendor_id (MM_BASE_MODEM (self)); - product_id = mm_base_modem_get_product_id (MM_BASE_MODEM (self)); - if (vendor_id == 0x105b || (vendor_id == 0x0489 && (product_id == 0xe0da || product_id == 0xe0db))) { - fox_version_type = QMI_FOX_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG_APPS; - dms_version_type = QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG_APPS; - } else { - fox_version_type = QMI_FOX_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG; - dms_version_type = QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG; - } - /* 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); if (!fox_client) { @@ -198,7 +190,11 @@ firmware_load_update_settings (MMIfaceModemFirmware *self, g_autoptr(QmiMessageFoxGetFirmwareVersionInput) input = NULL; input = qmi_message_fox_get_firmware_version_input_new (); - qmi_message_fox_get_firmware_version_input_set_version_type (input, fox_version_type, NULL); + qmi_message_fox_get_firmware_version_input_set_version_type (input, + (needs_qdu_and_mcfg_apps_version (self) ? + QMI_FOX_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG_APPS : + QMI_FOX_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG), + NULL); qmi_client_fox_get_firmware_version (QMI_CLIENT_FOX (fox_client), input, 10, @@ -212,7 +208,11 @@ firmware_load_update_settings (MMIfaceModemFirmware *self, g_autoptr(QmiMessageDmsFoxconnGetFirmwareVersionInput) input = NULL; input = qmi_message_dms_foxconn_get_firmware_version_input_new (); - qmi_message_dms_foxconn_get_firmware_version_input_set_version_type (input, dms_version_type, NULL); + qmi_message_dms_foxconn_get_firmware_version_input_set_version_type (input, + (needs_qdu_and_mcfg_apps_version (self) ? + QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG_APPS: + QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG), + NULL); qmi_client_dms_foxconn_get_firmware_version (QMI_CLIENT_DMS (dms_client), input, 10, |