Shearwater PNF support: fall back to default logbook style

On Android we appear to mis-interpret the response to the RDBI command.
Instead of failing, fall back to the default value (PNF for Teric,
Predator-like for everything else).

With this I can successfully download dive data from my Teric on
Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-09-11 21:30:45 -07:00
parent ee7c14ecc3
commit 348387c6f6

View File

@ -263,25 +263,27 @@ shearwater_petrel_device_foreach (dc_device_t *abstract, dc_dive_callback_t call
return rc;
}
unsigned int base_addr = array_uint_be (dc_buffer_get_data (buffer), dc_buffer_get_size (buffer));
INFO(abstract->context, "RDBI command completed with %d bytes, evaluated as %08x", dc_buffer_get_size (buffer), base_addr);
base_addr &= 0xFF000000u;
switch (base_addr) {
case 0xDD000000: // Predator or Predator-Like Format
// on a Predator, use the old format, otherwise use the Predator-Like Format (what we called Petrel so far)
if (model != PREDATOR)
base_addr = 0xC0000000;
base_addr = 0xC0000000u;
break;
case 0x90000000: // some firmware versions supported an earlier version of PNF without final record
// use the Predator-Like Format instead
base_addr = 0xC0000000;
base_addr = 0xC0000000u;
break;
case 0x80000000: // new Petrel Native Format with final record
// that's the correct address
break;
default: // unknown format
ERROR (abstract->context, "Unknown logbook format %08x", base_addr);
dc_buffer_free (buffer);
dc_buffer_free (manifests);
return DC_STATUS_UNSUPPORTED;
// use the defaults for the models
if (model >= TERIC)
base_addr = 0x80000000u;
else
base_addr = 0xC0000000u;
}
// Read the manifest pages