From 034819cd2dd4639a5277542a2ec6c7c8c3c1da92 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 7 Feb 2021 23:11:14 +0100 Subject: [PATCH] Fix the McLean Extreme fingerprint feature Currently the fingerprint feature uses the first 7 bytes of the computer configuration data. Since this information does not uniquely identify a dive, and is actually often identical for several dives, no new dives are detected anymore. Fixed by using the date/time timestamp at the start of the dive configuration data instead. Reported-by: David Carron --- src/mclean_extreme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mclean_extreme.c b/src/mclean_extreme.c index 5c8060c..b69546f 100644 --- a/src/mclean_extreme.c +++ b/src/mclean_extreme.c @@ -42,7 +42,7 @@ #define CMD_FIRMWARE 0xAD #define SZ_PACKET 512 -#define SZ_FINGERPRINT 7 +#define SZ_FINGERPRINT 4 #define SZ_CFG 0x002D #define SZ_COMPUTER (SZ_CFG + 0x6A) #define SZ_HEADER (SZ_CFG + 0x31) @@ -580,10 +580,10 @@ mclean_extreme_device_foreach(dc_device_t *abstract, dc_dive_callback_t callback unsigned char *data = dc_buffer_get_data(buffer); unsigned int size = dc_buffer_get_size(buffer); - if (memcmp(data, device->fingerprint, sizeof(device->fingerprint)) == 0) + if (memcmp(data + SZ_CFG, device->fingerprint, sizeof(device->fingerprint)) == 0) break; - if (callback && !callback (data, size, data, sizeof(device->fingerprint), userdata)) { + if (callback && !callback (data, size, data + SZ_CFG, sizeof(device->fingerprint), userdata)) { break; } }