From 2443d3ea47aa3efc7c34ad2ed361f09c3b61876c Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 12 May 2022 16:24:55 +0200 Subject: [PATCH] Add an address parameter to the memory dump helper function To support devices where not all memory is readable, the memory dump helper function needs an extra parameter to specify the start address. --- src/cressi_edy.c | 2 +- src/device-private.h | 2 +- src/device.c | 4 ++-- src/liquivision_lynx.c | 2 +- src/mares_darwin.c | 2 +- src/mares_iconhd.c | 2 +- src/mares_puck.c | 2 +- src/oceanic_common.c | 2 +- src/sporasub_sp2.c | 2 +- src/suunto_common2.c | 2 +- src/suunto_vyper.c | 2 +- src/zeagle_n2ition3.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cressi_edy.c b/src/cressi_edy.c index e23eee7..86ed76e 100644 --- a/src/cressi_edy.c +++ b/src/cressi_edy.c @@ -386,7 +386,7 @@ cressi_edy_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) devinfo.serial = 0; device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); - return device_dump_read (abstract, dc_buffer_get_data (buffer), + return device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), SZ_PACKET); } diff --git a/src/device-private.h b/src/device-private.h index 7ca6610..04ee68b 100644 --- a/src/device-private.h +++ b/src/device-private.h @@ -92,7 +92,7 @@ int device_is_cancelled (dc_device_t *device); dc_status_t -device_dump_read (dc_device_t *device, unsigned char data[], unsigned int size, unsigned int blocksize); +device_dump_read (dc_device_t *device, unsigned int address, unsigned char data[], unsigned int size, unsigned int blocksize); #ifdef __cplusplus } diff --git a/src/device.c b/src/device.c index 3cd3e3a..affebc8 100644 --- a/src/device.c +++ b/src/device.c @@ -342,7 +342,7 @@ dc_device_dump (dc_device_t *device, dc_buffer_t *buffer) dc_status_t -device_dump_read (dc_device_t *device, unsigned char data[], unsigned int size, unsigned int blocksize) +device_dump_read (dc_device_t *device, unsigned int address, unsigned char data[], unsigned int size, unsigned int blocksize) { if (device == NULL) return DC_STATUS_UNSUPPORTED; @@ -363,7 +363,7 @@ device_dump_read (dc_device_t *device, unsigned char data[], unsigned int size, len = blocksize; // Read the packet. - dc_status_t rc = device->vtable->read (device, nbytes, data + nbytes, len); + dc_status_t rc = device->vtable->read (device, address + nbytes, data + nbytes, len); if (rc != DC_STATUS_SUCCESS) return rc; diff --git a/src/liquivision_lynx.c b/src/liquivision_lynx.c index 56abb37..a0d8e0a 100644 --- a/src/liquivision_lynx.c +++ b/src/liquivision_lynx.c @@ -382,7 +382,7 @@ liquivision_lynx_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) } // Download the memory dump. - return device_dump_read (abstract, dc_buffer_get_data (buffer), + return device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), SEGMENTSIZE); } diff --git a/src/mares_darwin.c b/src/mares_darwin.c index cefa717..cac1717 100644 --- a/src/mares_darwin.c +++ b/src/mares_darwin.c @@ -201,7 +201,7 @@ mares_darwin_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) } // Download the memory dump. - status = device_dump_read (abstract, dc_buffer_get_data (buffer), + status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), PACKETSIZE); if (status != DC_STATUS_SUCCESS) { return status; diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index e3f8ee5..55b684f 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -664,7 +664,7 @@ mares_iconhd_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) device_event_emit (abstract, DC_EVENT_VENDOR, &vendor); // Download the memory dump. - status = device_dump_read (abstract, dc_buffer_get_data (buffer), + status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), device->packetsize); if (status != DC_STATUS_SUCCESS) { return status; diff --git a/src/mares_puck.c b/src/mares_puck.c index aaf1c41..14a25a2 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -204,7 +204,7 @@ mares_puck_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) } // Download the memory dump. - status = device_dump_read (abstract, dc_buffer_get_data (buffer), + status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), PACKETSIZE); if (status != DC_STATUS_SUCCESS) { return status; diff --git a/src/oceanic_common.c b/src/oceanic_common.c index d2a4818..c33655b 100644 --- a/src/oceanic_common.c +++ b/src/oceanic_common.c @@ -209,7 +209,7 @@ oceanic_common_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) device_event_emit (abstract, DC_EVENT_VENDOR, &vendor); // Download the memory dump. - status = device_dump_read (abstract, dc_buffer_get_data (buffer), + status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), PAGESIZE * device->multipage); if (status != DC_STATUS_SUCCESS) { return status; diff --git a/src/sporasub_sp2.c b/src/sporasub_sp2.c index 4593f6d..8112305 100644 --- a/src/sporasub_sp2.c +++ b/src/sporasub_sp2.c @@ -363,7 +363,7 @@ sporasub_sp2_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) vendor.size = sizeof (device->version); device_event_emit (abstract, DC_EVENT_VENDOR, &vendor); - return device_dump_read (abstract, dc_buffer_get_data (buffer), + return device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), SZ_READ); } diff --git a/src/suunto_common2.c b/src/suunto_common2.c index e8f7c51..063ea2b 100644 --- a/src/suunto_common2.c +++ b/src/suunto_common2.c @@ -218,7 +218,7 @@ suunto_common2_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) vendor.size = sizeof (device->version); device_event_emit (abstract, DC_EVENT_VENDOR, &vendor); - return device_dump_read (abstract, dc_buffer_get_data (buffer), + return device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), SZ_PACKET); } diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index 02bd42f..90ef702 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -435,7 +435,7 @@ suunto_vyper_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) } // Download the memory dump. - status = device_dump_read (abstract, dc_buffer_get_data (buffer), + status = device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), SZ_PACKET); if (status != DC_STATUS_SUCCESS) { return status; diff --git a/src/zeagle_n2ition3.c b/src/zeagle_n2ition3.c index 5d0c3bd..420ac0c 100644 --- a/src/zeagle_n2ition3.c +++ b/src/zeagle_n2ition3.c @@ -241,7 +241,7 @@ zeagle_n2ition3_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) return DC_STATUS_NOMEMORY; } - return device_dump_read (abstract, dc_buffer_get_data (buffer), + return device_dump_read (abstract, 0, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), SZ_PACKET); }