Search for the end of te profile ringbuffer.
Because some devices appear to store the end-of-profile pointer at different locations, we search all know positions for a valid value.
This commit is contained in:
parent
3afc32b499
commit
bb8255a116
@ -319,7 +319,13 @@ mares_iconhd_extract_dives (device_t *abstract, const unsigned char data[], unsi
|
|||||||
return DEVICE_STATUS_ERROR;
|
return DEVICE_STATUS_ERROR;
|
||||||
|
|
||||||
// Get the end of the profile ring buffer.
|
// Get the end of the profile ring buffer.
|
||||||
unsigned int eop = array_uint32_le (data + 0x2001);
|
unsigned int eop = 0;
|
||||||
|
const unsigned int config[] = {0x2001, 0x3001};
|
||||||
|
for (unsigned int i = 0; i < sizeof (config) / sizeof (*config); ++i) {
|
||||||
|
eop = array_uint32_le (data + config[i]);
|
||||||
|
if (eop != 0xFFFFFFFF)
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (eop < RB_PROFILE_BEGIN || eop >= RB_PROFILE_END) {
|
if (eop < RB_PROFILE_BEGIN || eop >= RB_PROFILE_END) {
|
||||||
WARNING ("Ringbuffer pointer out of range.");
|
WARNING ("Ringbuffer pointer out of range.");
|
||||||
return DEVICE_STATUS_ERROR;
|
return DEVICE_STATUS_ERROR;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user