mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-25 21:05:42 +00:00
modem-manager: Add the logic of inhibiting modemmanager device in mbim-qdu
It may make sense to have the modem not doing anything during the upgrade, so the inhibition would make total sense. Signed-off-by: Jarvis Jiang <jarvis.w.jiang@gmail.com>
This commit is contained in:
parent
70f9124545
commit
8d6dbd9009
@ -270,16 +270,6 @@ typedef struct {
|
||||
FuProgress *progress;
|
||||
} WriteContext;
|
||||
|
||||
static gboolean
|
||||
fu_mbim_qdu_updater_reboot_timeout(gpointer user_data)
|
||||
{
|
||||
WriteContext *ctx = user_data;
|
||||
g_ptr_array_unref(ctx->chunks);
|
||||
g_main_loop_quit(ctx->mainloop);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
fu_mbim_qdu_updater_file_write_ready(MbimDevice *device, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
@ -322,9 +312,8 @@ fu_mbim_qdu_updater_file_write_ready(MbimDevice *device, GAsyncResult *res, gpoi
|
||||
return;
|
||||
}
|
||||
|
||||
fu_progress_set_status(ctx->progress, FWUPD_STATUS_DEVICE_RESTART);
|
||||
/* device will auto reboot right after update finish */
|
||||
g_timeout_add_seconds(10, fu_mbim_qdu_updater_reboot_timeout, ctx);
|
||||
g_ptr_array_unref(ctx->chunks);
|
||||
g_main_loop_quit(ctx->mainloop);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -54,6 +54,7 @@ struct _FuMmDevice {
|
||||
gchar *detach_fastboot_at;
|
||||
gint port_at_ifnum;
|
||||
gint port_qmi_ifnum;
|
||||
gint port_mbim_ifnum;
|
||||
|
||||
/* fastboot detach handling */
|
||||
gchar *port_at;
|
||||
@ -138,6 +139,13 @@ fu_mm_device_get_port_qmi_ifnum(FuMmDevice *device)
|
||||
return device->port_qmi_ifnum;
|
||||
}
|
||||
|
||||
gint
|
||||
fu_mm_device_get_port_mbim_ifnum(FuMmDevice *device)
|
||||
{
|
||||
g_return_val_if_fail(FU_IS_MM_DEVICE(device), -1);
|
||||
return device->port_mbim_ifnum;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
validate_firmware_update_method(MMModemFirmwareUpdateMethod methods, GError **error)
|
||||
{
|
||||
@ -380,7 +388,7 @@ fu_mm_device_probe_default(FuDevice *device, GError **error)
|
||||
fu_mm_utils_get_port_info(self->port_mbim,
|
||||
&mbim_device_bus,
|
||||
&mbim_device_sysfs_path,
|
||||
NULL,
|
||||
&self->port_mbim_ifnum,
|
||||
NULL);
|
||||
if (device_sysfs_path == NULL && mbim_device_sysfs_path != NULL) {
|
||||
device_sysfs_path = g_steal_pointer(&mbim_device_sysfs_path);
|
||||
@ -1171,8 +1179,6 @@ fu_mm_device_write_firmware_mbim_qdu(FuDevice *device,
|
||||
return FALSE;
|
||||
|
||||
fu_progress_set_status(progress, FWUPD_STATUS_DEVICE_READ);
|
||||
fu_device_set_remove_delay(device, MAX_WAIT_TIME_SECS * 1000);
|
||||
fu_device_add_flag(device, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG);
|
||||
version = fu_mm_device_get_firmware_version_mbim(device, error);
|
||||
if (version == NULL)
|
||||
return FALSE;
|
||||
@ -1553,6 +1559,7 @@ fu_mm_device_new(MMManager *manager, MMObject *omodem)
|
||||
self->omodem = g_object_ref(omodem);
|
||||
self->port_at_ifnum = -1;
|
||||
self->port_qmi_ifnum = -1;
|
||||
self->port_mbim_ifnum = -1;
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -1571,6 +1578,7 @@ fu_plugin_mm_inhibited_device_info_new(FuMmDevice *device)
|
||||
info->detach_fastboot_at = g_strdup(fu_mm_device_get_detach_fastboot_at(device));
|
||||
info->port_at_ifnum = fu_mm_device_get_port_at_ifnum(device);
|
||||
info->port_qmi_ifnum = fu_mm_device_get_port_qmi_ifnum(device);
|
||||
info->port_mbim_ifnum = fu_mm_device_get_port_mbim_ifnum(device);
|
||||
info->inhibited_uid = g_strdup(fu_mm_device_get_inhibition_uid(device));
|
||||
|
||||
return info;
|
||||
|
@ -25,6 +25,8 @@ gint
|
||||
fu_mm_device_get_port_at_ifnum(FuMmDevice *device);
|
||||
gint
|
||||
fu_mm_device_get_port_qmi_ifnum(FuMmDevice *device);
|
||||
gint
|
||||
fu_mm_device_get_port_mbim_ifnum(FuMmDevice *device);
|
||||
MMModemFirmwareUpdateMethod
|
||||
fu_mm_device_get_update_methods(FuMmDevice *device);
|
||||
|
||||
@ -42,6 +44,7 @@ struct FuPluginMmInhibitedDeviceInfo {
|
||||
gchar *detach_fastboot_at;
|
||||
gint port_at_ifnum;
|
||||
gint port_qmi_ifnum;
|
||||
gint port_mbim_ifnum;
|
||||
};
|
||||
FuPluginMmInhibitedDeviceInfo *
|
||||
fu_plugin_mm_inhibited_device_info_new(FuMmDevice *device);
|
||||
|
@ -247,8 +247,20 @@ fu_plugin_mm_device_removed_cb(MMManager *manager, MMObject *modem, FuPlugin *pl
|
||||
if (dev == NULL)
|
||||
return;
|
||||
g_debug("removed modem: %s", mm_object_get_path(modem));
|
||||
|
||||
#if MM_CHECK_VERSION(1, 17, 1)
|
||||
/* No information will be displayed during the upgrade process if the
|
||||
* device is removed, the main reason is that device is "removed" from
|
||||
* ModemManager, but it still exists in the system */
|
||||
if (!(fu_mm_device_get_update_methods(FU_MM_DEVICE(dev)) &
|
||||
MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU)) {
|
||||
fu_plugin_cache_remove(plugin, object_path);
|
||||
fu_plugin_device_remove(plugin, FU_DEVICE(dev));
|
||||
}
|
||||
#else
|
||||
fu_plugin_cache_remove(plugin, object_path);
|
||||
fu_plugin_device_remove(plugin, FU_DEVICE(dev));
|
||||
#endif /* MM_CHECK_VERSION(1,17,1) */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -376,13 +388,6 @@ fu_plugin_detach(FuPlugin *plugin, FuDevice *device, FuProgress *progress, GErro
|
||||
FuPluginData *priv = fu_plugin_get_data(plugin);
|
||||
g_autoptr(FuDeviceLocker) locker = NULL;
|
||||
|
||||
#if MM_CHECK_VERSION(1, 17, 1)
|
||||
/* skip update_detach, as MBIM modem doesn't change port layout. */
|
||||
if (fu_mm_device_get_update_methods(FU_MM_DEVICE(device)) &
|
||||
MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU)
|
||||
return TRUE;
|
||||
|
||||
#endif /* MM_CHECK_VERSION(1,17,1) */
|
||||
/* open device */
|
||||
locker = fu_device_locker_new(device, error);
|
||||
if (locker == NULL)
|
||||
@ -419,13 +424,6 @@ fu_plugin_attach(FuPlugin *plugin, FuDevice *device, FuProgress *progress, GErro
|
||||
{
|
||||
g_autoptr(FuDeviceLocker) locker = NULL;
|
||||
|
||||
#if MM_CHECK_VERSION(1, 17, 1)
|
||||
/* skip update_attach, as MBIM modem doesn't change port layout. */
|
||||
if (fu_mm_device_get_update_methods(FU_MM_DEVICE(device)) &
|
||||
MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU)
|
||||
return TRUE;
|
||||
|
||||
#endif /* MM_CHECK_VERSION(1,17,1) */
|
||||
/* open device */
|
||||
locker = fu_device_locker_new(device, error);
|
||||
if (locker == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user