summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-02-16 19:33:37 +0000
committerRichard Hughes <richard@hughsie.com>2015-02-16 19:33:50 +0000
commitd4c31cc698c1085fd5f9a83b614772ea0119a8c2 (patch)
tree31ab8b6e43e916c616c4e39ea344300d1b603fb4
parentd8bc0e74f608753f84c89ff0d8d5e6babc1a1b62 (diff)
downloadcolord-d4c31cc698c1085fd5f9a83b614772ea0119a8c2.tar.gz
colorhug: Return the exact address on verification failure
-rw-r--r--lib/colorhug/ch-device-queue.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/colorhug/ch-device-queue.c b/lib/colorhug/ch-device-queue.c
index e65c3f3..e63de84 100644
--- a/lib/colorhug/ch-device-queue.c
+++ b/lib/colorhug/ch-device-queue.c
@@ -2537,6 +2537,7 @@ ch_device_queue_buffer_verify_flash_cb (guint8 *output_buffer,
GError **error)
{
ChDeviceQueueReadFlashHelper *helper = (ChDeviceQueueReadFlashHelper *) user_data;
+ guint16 i;
guint8 expected_checksum;
/* check buffer size */
@@ -2559,9 +2560,13 @@ ch_device_queue_buffer_verify_flash_cb (guint8 *output_buffer,
/* verify data */
if (memcmp (helper->data, output_buffer + 1, helper->len) != 0) {
+ for (i = 0; i < helper->len; i++) {
+ if (helper->data[i] != output_buffer[i + 1])
+ break;
+ }
g_set_error (error, 1, 0,
"Failed to verify at @0x%04x",
- helper->address);
+ helper->address + i);
return FALSE;
}
return TRUE;