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.
This commit is contained in:
Benson Leung 2020-08-19 17:03:31 -07:00 committed by Richard Hughes
parent c516724278
commit af07f32c0f

View File

@ -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) {