From 4530c44f2d8bfe884d6f907c6ffd0b12dbc9744a Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 4 Feb 2019 12:58:07 +0000 Subject: [PATCH] wacom-usb: Fix flashing failure with latest Intuos Pro tablet The checksum is now stored as the very last flash descriptor, so we need to pad the SREC data to include the 'missing' data range. As we're doing that, we should optimize like the Wacom updater does and skip writing descriptors that are unused. --- plugins/wacom-usb/fu-wac-device.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/wacom-usb/fu-wac-device.c b/plugins/wacom-usb/fu-wac-device.c index abb047977..b821eb8a0 100644 --- a/plugins/wacom-usb/fu-wac-device.c +++ b/plugins/wacom-usb/fu-wac-device.c @@ -597,6 +597,13 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error) if (blob_block == NULL) break; + /* ignore empty blocks */ + if (dfu_utils_bytes_is_empty (blob_block)) { + g_debug ("empty block, ignoring"); + fu_device_set_progress_full (device, blocks_done++, blocks_total); + continue; + } + /* erase entire block */ if (!fu_wac_device_erase_block (self, i, error)) return FALSE; @@ -637,6 +644,7 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error) return FALSE; for (guint16 i = 0; i < self->flash_descriptors->len; i++) { FuWacFlashDescriptor *fd = g_ptr_array_index (self->flash_descriptors, i); + GBytes *blob_block; guint32 csum_rom; /* if page is protected */ @@ -644,8 +652,11 @@ fu_wac_device_write_firmware (FuDevice *device, GBytes *blob, GError **error) continue; /* no more written pages */ - if (g_hash_table_lookup (fd_blobs, fd) == NULL) - break; + blob_block = g_hash_table_lookup (fd_blobs, fd); + if (blob_block == NULL) + continue; + if (dfu_utils_bytes_is_empty (blob_block)) + continue; /* check checksum matches */ csum_rom = g_array_index (self->checksums, guint32, i);