From 046c84b5b37d4d60ad3151d8d7b05da74ebe04aa Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 28 Jan 2019 23:20:45 +0100 Subject: [PATCH] fastboot: flash the partition after downloading the file --- plugins/fastboot/fu-fastboot-device.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/plugins/fastboot/fu-fastboot-device.c b/plugins/fastboot/fu-fastboot-device.c index f4674ae27..904fd6e1f 100644 --- a/plugins/fastboot/fu-fastboot-device.c +++ b/plugins/fastboot/fu-fastboot-device.c @@ -251,10 +251,19 @@ fu_fastboot_device_cmd (FuDevice *device, const gchar *cmd, GError **error) } static gboolean -fu_fastboot_device_flash (FuDevice *device, - const gchar *partition, - GBytes *fw, - GError **error) +fu_fastboot_device_flash (FuDevice *device, const gchar *partition, GError **error) +{ + g_autofree gchar *tmp = g_strdup_printf ("flash:%s", partition); + 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); gsize sz = g_bytes_get_size (fw); @@ -360,7 +369,9 @@ fu_fastboot_device_write_qfil_part (FuDevice *device, partition += 2; /* 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 @@ -481,7 +492,9 @@ fu_fastboot_device_write_motorola_part (FuDevice *device, } /* 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 */