From 43a518b1d29d7edaa979a0eca7f687ff36f2e10b Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 1 Dec 2012 12:58:51 +0100 Subject: [PATCH] Autodetect the three OSTC variants. The exact OSTC variant can be detected by means of the serial number. Each of the three variants is now assigned an artifical model number, and included explicitly in the list of supported models. --- src/descriptor.c | 4 +++- src/hw_ostc.c | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index 5a04025..d35c690 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -150,7 +150,9 @@ static const dc_descriptor_t g_descriptors[] = { {"Mares", "Icon HD", DC_FAMILY_MARES_ICONHD , 0x14}, {"Mares", "Icon HD Net Ready", DC_FAMILY_MARES_ICONHD , 0x15}, /* Heinrichs Weikamp */ - {"Heinrichs Weikamp", "OSTC", DC_FAMILY_HW_OSTC, 0}, + {"Heinrichs Weikamp", "OSTC", DC_FAMILY_HW_OSTC, 0}, + {"Heinrichs Weikamp", "OSTC Mk2", DC_FAMILY_HW_OSTC, 1}, + {"Heinrichs Weikamp", "OSTC 2N", DC_FAMILY_HW_OSTC, 2}, {"Heinrichs Weikamp", "Frog", DC_FAMILY_HW_FROG, 0}, /* Cressi Edy */ {"Cressi", "Edy", DC_FAMILY_CRESSI_EDY, 0}, diff --git a/src/hw_ostc.c b/src/hw_ostc.c index a2eabf7..c500858 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -323,9 +323,14 @@ hw_ostc_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void // Emit a device info event. unsigned char *data = dc_buffer_get_data (buffer); dc_event_devinfo_t devinfo; - devinfo.model = 0; devinfo.firmware = array_uint16_be (data + 264); devinfo.serial = array_uint16_le (data + 6); + if (devinfo.serial > 2048) + devinfo.model = 2; // OSTC 2N + else if (devinfo.serial > 300) + devinfo.model = 1; // OSTC Mk2 + else + devinfo.model = 0; // OSTC device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); rc = hw_ostc_extract_dives (abstract, dc_buffer_get_data (buffer),