From 9e585a9525c65e9c7bb3e3467cf94a6845c72268 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 7 Aug 2016 21:30:40 +0200 Subject: [PATCH] Fix the Aeris 500AI serial number. The Aeris 500AI serial number appears to be located at a slightly different offset, and with an unusual encoding. It's a BCD encoded number, but with the digits of each byte swapped. --- src/oceanic_common.c | 7 ++++++- src/oceanic_vtpro.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/oceanic_common.c b/src/oceanic_common.c index b4bc1c7..a463038 100644 --- a/src/oceanic_common.c +++ b/src/oceanic_common.c @@ -646,8 +646,13 @@ oceanic_common_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac devinfo.firmware = 0; if (layout->pt_mode_serial == 0) devinfo.serial = bcd2dec (id[10]) * 10000 + bcd2dec (id[11]) * 100 + bcd2dec (id[12]); - else + else if (layout->pt_mode_serial == 1) devinfo.serial = id[11] * 10000 + id[12] * 100 + id[13]; + else + devinfo.serial = + (id[11] & 0x0F) * 100000 + ((id[11] & 0xF0) >> 4) * 10000 + + (id[12] & 0x0F) * 1000 + ((id[12] & 0xF0) >> 4) * 100 + + (id[13] & 0x0F) * 10 + ((id[13] & 0xF0) >> 4) * 1; device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); // Memory buffer for the logbook data. diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index 1fe5cde..6d14e85 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -127,7 +127,7 @@ static const oceanic_common_layout_t aeris_500ai_layout = { 0x20000, /* rb_profile_end */ 0, /* pt_mode_global */ 1, /* pt_mode_logbook */ - 0, /* pt_mode_serial */ + 2, /* pt_mode_serial */ }; static dc_status_t