synapticsmst: Allow using a custom flag 'skip-restart'

This flag is intended for devices that the restart procedure will
be performed as part of a transactional update by an external
controller.

None of the currently supported devices need this flag.
This commit is contained in:
Mario Limonciello 2018-08-28 15:44:25 -05:00 committed by Richard Hughes
parent 102074eeea
commit 812ac02bac
4 changed files with 25 additions and 4 deletions

View File

@ -339,6 +339,7 @@ fu_plugin_update (FuPlugin *plugin,
const gchar *aux_node; const gchar *aux_node;
guint8 layer; guint8 layer;
guint8 rad; guint8 rad;
gboolean reboot;
/* extract details to build a new device */ /* extract details to build a new device */
kind = synapticsmst_device_kind_from_string (fu_device_get_metadata (dev, "SynapticsMSTKind")); kind = synapticsmst_device_kind_from_string (fu_device_get_metadata (dev, "SynapticsMSTKind"));
@ -357,15 +358,22 @@ fu_plugin_update (FuPlugin *plugin,
if (!synapticsmst_device_enumerate_device (device, error)) if (!synapticsmst_device_enumerate_device (device, error))
return FALSE; return FALSE;
reboot = !fu_device_has_custom_flag (dev, "skip-restart");
fu_device_set_status (dev, FWUPD_STATUS_DEVICE_WRITE); fu_device_set_status (dev, FWUPD_STATUS_DEVICE_WRITE);
if (!synapticsmst_device_write_firmware (device, blob_fw, if (!synapticsmst_device_write_firmware (device, blob_fw,
fu_synapticsmst_write_progress_cb, fu_synapticsmst_write_progress_cb,
dev, dev,
reboot,
error)) { error)) {
g_prefix_error (error, "failed to flash firmware: "); g_prefix_error (error, "failed to flash firmware: ");
return FALSE; return FALSE;
} }
if (!reboot) {
g_debug ("Skipping device restart per quirk request");
return TRUE;
}
/* Re-run device enumeration to find the new device version */ /* Re-run device enumeration to find the new device version */
fu_device_set_status (dev, FWUPD_STATUS_DEVICE_RESTART); fu_device_set_status (dev, FWUPD_STATUS_DEVICE_RESTART);
for (guint i = 1; i <= SYNAPTICS_UPDATE_ENUMERATE_TRIES; i++) { for (guint i = 1; i <= SYNAPTICS_UPDATE_ENUMERATE_TRIES; i++) {

View File

@ -1228,6 +1228,7 @@ synapticsmst_device_write_firmware (SynapticsMSTDevice *device,
GBytes *fw, GBytes *fw,
GFileProgressCallback progress_cb, GFileProgressCallback progress_cb,
gpointer progress_data, gpointer progress_data,
gboolean reboot,
GError **error) GError **error)
{ {
const guint8 *payload_data; const guint8 *payload_data;
@ -1272,10 +1273,17 @@ synapticsmst_device_write_firmware (SynapticsMSTDevice *device,
} }
/* enable remote control and disable on exit */ /* enable remote control and disable on exit */
locker = fu_device_locker_new_full (device, if (reboot) {
(FuDeviceLockerFunc) synapticsmst_device_enable_remote_control, locker = fu_device_locker_new_full (device,
(FuDeviceLockerFunc) synapticsmst_device_restart, (FuDeviceLockerFunc) synapticsmst_device_enable_remote_control,
error); (FuDeviceLockerFunc) synapticsmst_device_restart,
error);
} else {
locker = fu_device_locker_new_full (device,
(FuDeviceLockerFunc) synapticsmst_device_enable_remote_control,
(FuDeviceLockerFunc) synapticsmst_device_disable_remote_control,
error);
}
if (locker == NULL) if (locker == NULL)
return FALSE; return FALSE;

View File

@ -82,6 +82,7 @@ gboolean synapticsmst_device_write_firmware (SynapticsMSTDevice *device,
GBytes *fw, GBytes *fw,
GFileProgressCallback progress_cb, GFileProgressCallback progress_cb,
gpointer user_data, gpointer user_data,
gboolean reboot,
GError **error); GError **error);
G_END_DECLS G_END_DECLS

View File

@ -10,6 +10,10 @@
# DeviceKind != system # DeviceKind != system
# * Will map to a GUID containing each comma delimitted substring # * Will map to a GUID containing each comma delimitted substring
# * These GUIDs will look like MST-${DEVICEKIND}-${CHIPID}-${BOARDID} # * These GUIDs will look like MST-${DEVICEKIND}-${CHIPID}-${BOARDID}
#
# By default the Synaptics MST device will restart after update
# To override this behavior add the custom flag "skip-restart"
#
[SynapticsMSTBoardID=0] [SynapticsMSTBoardID=0]
Name = Synaptics EVB development board Name = Synaptics EVB development board