fastboot: flash the partition after downloading the file

This commit is contained in:
Aleksander Morgado 2019-01-28 23:20:45 +01:00 committed by Richard Hughes
parent 44ce5aeae4
commit 046c84b5b3

View File

@ -251,10 +251,19 @@ fu_fastboot_device_cmd (FuDevice *device, const gchar *cmd, GError **error)
} }
static gboolean static gboolean
fu_fastboot_device_flash (FuDevice *device, fu_fastboot_device_flash (FuDevice *device, const gchar *partition, GError **error)
const gchar *partition, {
GBytes *fw, g_autofree gchar *tmp = g_strdup_printf ("flash:%s", partition);
GError **error) if (!fu_fastboot_device_writestr (device, tmp, error))
return FALSE;
if (!fu_fastboot_device_read (device, NULL,
FU_FASTBOOT_DEVICE_READ_FLAG_STATUS_POLL, error))
return FALSE;
return TRUE;
}
static gboolean
fu_fastboot_device_download (FuDevice *device, GBytes *fw, GError **error)
{ {
FuFastbootDevice *self = FU_FASTBOOT_DEVICE (device); FuFastbootDevice *self = FU_FASTBOOT_DEVICE (device);
gsize sz = g_bytes_get_size (fw); gsize sz = g_bytes_get_size (fw);
@ -360,7 +369,9 @@ fu_fastboot_device_write_qfil_part (FuDevice *device,
partition += 2; partition += 2;
/* flash the partition */ /* flash the partition */
return fu_fastboot_device_flash (device, partition, data, error); if (!fu_fastboot_device_download (device, data, error))
return FALSE;
return fu_fastboot_device_flash (device, partition, error);
} }
static gboolean static gboolean
@ -481,7 +492,9 @@ fu_fastboot_device_write_motorola_part (FuDevice *device,
} }
/* flash the partition */ /* flash the partition */
return fu_fastboot_device_flash (device, partition, data, error); if (!fu_fastboot_device_download (device, data, error))
return FALSE;
return fu_fastboot_device_flash (device, partition, error);
} }
/* dumb operation that doesn't expect a response */ /* dumb operation that doesn't expect a response */