mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 04:23:21 +00:00
wacomhid: Set the device status when erasing and writing firmware
This commit is contained in:
parent
5a8581e4e7
commit
aa1ed47f06
@ -547,6 +547,7 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* clear all checksums of pages */
|
/* clear all checksums of pages */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_ERASE);
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
FuWacFlashDescriptor *fd = g_ptr_array_index (self->flash_descriptors, i);
|
FuWacFlashDescriptor *fd = g_ptr_array_index (self->flash_descriptors, i);
|
||||||
if (fu_wav_device_flash_descriptor_is_wp (fd))
|
if (fu_wav_device_flash_descriptor_is_wp (fd))
|
||||||
@ -579,6 +580,7 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error)
|
|||||||
blocks_total = g_hash_table_size (fd_blobs) + 2;
|
blocks_total = g_hash_table_size (fd_blobs) + 2;
|
||||||
|
|
||||||
/* write the data into the flash page */
|
/* write the data into the flash page */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
|
||||||
csum_local = g_new0 (guint32, self->flash_descriptors->len);
|
csum_local = g_new0 (guint32, self->flash_descriptors->len);
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
FuWacFlashDescriptor *fd = g_ptr_array_index (self->flash_descriptors, i);
|
FuWacFlashDescriptor *fd = g_ptr_array_index (self->flash_descriptors, i);
|
||||||
@ -617,9 +619,7 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* update device progress */
|
/* update device progress */
|
||||||
fu_device_set_progress_full (FU_DEVICE (self),
|
fu_device_set_progress_full (device, blocks_done++, blocks_total);
|
||||||
blocks_done++,
|
|
||||||
blocks_total);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate CRC inside device */
|
/* calculate CRC inside device */
|
||||||
@ -629,7 +629,7 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* update device progress */
|
/* update device progress */
|
||||||
fu_device_set_progress_full (FU_DEVICE (self), blocks_done++, blocks_total);
|
fu_device_set_progress_full (device, blocks_done++, blocks_total);
|
||||||
|
|
||||||
/* read all CRC of all pages and verify with local CRC */
|
/* read all CRC of all pages and verify with local CRC */
|
||||||
if (!fu_wac_device_ensure_checksums (self, error))
|
if (!fu_wac_device_ensure_checksums (self, error))
|
||||||
@ -661,16 +661,17 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* update device progress */
|
/* update device progress */
|
||||||
fu_device_set_progress_full (FU_DEVICE (self), blocks_done++, blocks_total);
|
fu_device_set_progress_full (device, blocks_done++, blocks_total);
|
||||||
|
|
||||||
/* store host CRC into flash */
|
/* store host CRC into flash */
|
||||||
if (!fu_wac_device_write_checksum_table (self, error))
|
if (!fu_wac_device_write_checksum_table (self, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* update progress */
|
/* update progress */
|
||||||
fu_device_set_progress_full (FU_DEVICE (self), blocks_total, blocks_total);
|
fu_device_set_progress_full (device, blocks_total, blocks_total);
|
||||||
|
|
||||||
/* reboot, which switches the boot index of the firmware */
|
/* reboot, which switches the boot index of the firmware */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_RESTART);
|
||||||
return fu_wac_device_update_reset (self, error);
|
return fu_wac_device_update_reset (self, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ fu_wac_module_bluetooth_write_firmware (FuDevice *device, GBytes *blob, GError *
|
|||||||
blocks_total = blocks->len + 2;
|
blocks_total = blocks->len + 2;
|
||||||
|
|
||||||
/* start, which will erase the module */
|
/* start, which will erase the module */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_ERASE);
|
||||||
if (!fu_wac_module_set_feature (self, FU_WAC_MODULE_COMMAND_START, blob_start, error))
|
if (!fu_wac_module_set_feature (self, FU_WAC_MODULE_COMMAND_START, blob_start, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -132,6 +133,7 @@ fu_wac_module_bluetooth_write_firmware (FuDevice *device, GBytes *blob, GError *
|
|||||||
fu_device_set_progress_full (device, 1, blocks_total);
|
fu_device_set_progress_full (device, 1, blocks_total);
|
||||||
|
|
||||||
/* data */
|
/* data */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
|
||||||
for (guint i = 0; i < blocks->len; i++) {
|
for (guint i = 0; i < blocks->len; i++) {
|
||||||
FuWacModuleBluetoothBlockData *bd = g_ptr_array_index (blocks, i);
|
FuWacModuleBluetoothBlockData *bd = g_ptr_array_index (blocks, i);
|
||||||
guint8 buf[256+11];
|
guint8 buf[256+11];
|
||||||
@ -160,7 +162,7 @@ fu_wac_module_bluetooth_write_firmware (FuDevice *device, GBytes *blob, GError *
|
|||||||
fu_device_set_progress_full (device, blocks_total, blocks_total);
|
fu_device_set_progress_full (device, blocks_total, blocks_total);
|
||||||
|
|
||||||
/* reboot */
|
/* reboot */
|
||||||
fu_device_set_status (FU_DEVICE (self), FWUPD_STATUS_DEVICE_RESTART);
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_RESTART);
|
||||||
return fu_wac_device_update_reset (parent, error);
|
return fu_wac_device_update_reset (parent, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ fu_wac_module_touch_write_firmware (FuDevice *device, GBytes *blob, GError **err
|
|||||||
blocks_total = chunks->len + 2;
|
blocks_total = chunks->len + 2;
|
||||||
|
|
||||||
/* start, which will erase the module */
|
/* start, which will erase the module */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_ERASE);
|
||||||
if (!fu_wac_module_set_feature (self, FU_WAC_MODULE_COMMAND_START, NULL, error))
|
if (!fu_wac_module_set_feature (self, FU_WAC_MODULE_COMMAND_START, NULL, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ fu_wac_module_touch_write_firmware (FuDevice *device, GBytes *blob, GError **err
|
|||||||
fu_device_set_progress_full (device, 1, blocks_total);
|
fu_device_set_progress_full (device, 1, blocks_total);
|
||||||
|
|
||||||
/* data */
|
/* data */
|
||||||
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
|
||||||
for (guint i = 0; i < chunks->len; i++) {
|
for (guint i = 0; i < chunks->len; i++) {
|
||||||
DfuChunkedPacket *pkt = g_ptr_array_index (chunks, i);
|
DfuChunkedPacket *pkt = g_ptr_array_index (chunks, i);
|
||||||
guint8 buf[128+7];
|
guint8 buf[128+7];
|
||||||
@ -82,7 +84,7 @@ fu_wac_module_touch_write_firmware (FuDevice *device, GBytes *blob, GError **err
|
|||||||
fu_device_set_progress_full (device, blocks_total, blocks_total);
|
fu_device_set_progress_full (device, blocks_total, blocks_total);
|
||||||
|
|
||||||
/* reboot */
|
/* reboot */
|
||||||
fu_device_set_status (FU_DEVICE (self), FWUPD_STATUS_DEVICE_RESTART);
|
fu_device_set_status (device, FWUPD_STATUS_DEVICE_RESTART);
|
||||||
return fu_wac_device_update_reset (parent, error);
|
return fu_wac_device_update_reset (parent, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user