From af07f32c0f52f28d929a7eea9b3db2710c1c55dd Mon Sep 17 00:00:00 2001 From: Benson Leung Date: Wed, 19 Aug 2020 17:03:31 -0700 Subject: [PATCH] cros-ec: Send a start message after the stay-in-ro The extra command (stay-in-ro) consumes the start message, so we need to issue another one before write firmware. --- plugins/cros-ec/fu-cros-ec-usb-device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/cros-ec/fu-cros-ec-usb-device.c b/plugins/cros-ec/fu-cros-ec-usb-device.c index 62bdf1002..60b245783 100644 --- a/plugins/cros-ec/fu-cros-ec-usb-device.c +++ b/plugins/cros-ec/fu-cros-ec-usb-device.c @@ -703,12 +703,13 @@ fu_cros_ec_usb_device_write_firmware (FuDevice *device, guint16 subcommand = UPDATE_EXTRA_CMD_STAY_IN_RO; guint8 command_body[2]; /* Max command body size. */ gsize command_body_size = 0; + START_RESP start_resp; if (!fu_cros_ec_usb_device_send_subcommand (device, subcommand, command_body, command_body_size, &response, &response_size, FALSE, error)) { - /* failure here is ok */ - g_clear_error (error); + g_prefix_error (error, "failed to send stay-in-ro subcommand: "); + return FALSE; } /* clear custom flags */ fu_device_set_custom_flags (device, ""); @@ -719,6 +720,13 @@ fu_cros_ec_usb_device_write_firmware (FuDevice *device, g_prefix_error (error, "failed to flush device to idle state: "); return FALSE; } + + /* send start request */ + if (!fu_device_retry (device, fu_cros_ec_usb_device_start_request, + SETUP_RETRY_CNT, &start_resp, error)) { + g_prefix_error (error, "failed to send start request: "); + return FALSE; + } } if (fu_device_has_custom_flag (device, "rw-written") && self->in_bootloader) {