From 35b1672b85d23e0961c33fc7aebc17d0e2d26c81 Mon Sep 17 00:00:00 2001 From: Freedom Liu Date: Fri, 30 Apr 2021 01:52:12 +0000 Subject: [PATCH] foxconn: add new MBIM QDU firmware update method support Based on the QDU service newly added in libmbim, T99W175 module (vid: 0x105b) supports MBIM QDU based update. --- include/ModemManager-enums.h | 2 ++ .../foxconn/mm-broadband-modem-mbim-foxconn.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/ModemManager-enums.h b/include/ModemManager-enums.h index 06c2cf5e..b5d90367 100644 --- a/include/ModemManager-enums.h +++ b/include/ModemManager-enums.h @@ -1515,6 +1515,7 @@ typedef enum { /*< underscore_name=mm_call_direction >*/ * @MM_MODEM_FIRMWARE_UPDATE_METHOD_NONE: No method specified. * @MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT: Device supports fastboot-based update. * @MM_MODEM_FIRMWARE_UPDATE_METHOD_QMI_PDC: Device supports QMI PDC based update. + * @MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU: Device supports MBIM QDU based update. Since 1.18. * * Type of firmware update method supported by the module. * @@ -1524,6 +1525,7 @@ typedef enum { /*< underscore_name=mm_modem_firmware_update_method >*/ MM_MODEM_FIRMWARE_UPDATE_METHOD_NONE = 0, MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT = 1 << 0, MM_MODEM_FIRMWARE_UPDATE_METHOD_QMI_PDC = 1 << 1, + MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU = 1 << 2, } MMModemFirmwareUpdateMethod; /** diff --git a/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c b/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c index a69e87df..f46abc97 100644 --- a/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c +++ b/plugins/foxconn/mm-broadband-modem-mbim-foxconn.c @@ -89,15 +89,24 @@ foxconn_get_firmware_version_ready (QmiClientDms *client, GError *error = NULL; MMFirmwareUpdateSettings *update_settings = NULL; const gchar *str; + MMIfaceModemFirmware *self; output = qmi_client_dms_foxconn_get_firmware_version_finish (client, res, &error); if (!output || !qmi_message_dms_foxconn_get_firmware_version_output_get_result (output, &error)) goto out; - /* Create update settings now */ - update_settings = mm_firmware_update_settings_new (MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT | - MM_MODEM_FIRMWARE_UPDATE_METHOD_QMI_PDC); - mm_firmware_update_settings_set_fastboot_at (update_settings, "AT^FASTBOOT"); + /* Create update settings now: + * 0x105b is the T99W175 module, T99W175 supports QDU, + * else support FASTBOOT and QMI PDC. + */ + self = g_task_get_source_object (task); + if (mm_base_modem_get_vendor_id (MM_BASE_MODEM (self)) == 0x105b) + update_settings = mm_firmware_update_settings_new (MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU); + else { + update_settings = mm_firmware_update_settings_new (MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT | + MM_MODEM_FIRMWARE_UPDATE_METHOD_QMI_PDC); + mm_firmware_update_settings_set_fastboot_at (update_settings, "AT^FASTBOOT"); + } qmi_message_dms_foxconn_get_firmware_version_output_get_version (output, &str, NULL); mm_firmware_update_settings_set_version (update_settings, str);