Add support for the Suunto Eon Core

The Suunto Eon Core uses a different USB PID, but otherwise it's
compatible with the Eon Steel. It's probably an Eon Steel internally,
but with a smaller form factor.

To be able to distinguish between the two models and use the correct USB
PID, each model is assigned a different (artificial) model number.

Reported-by: Nick Shore <support@mac-dive.com>
This commit is contained in:
Jef Driesen 2017-11-19 12:37:39 +01:00
parent 812db650d4
commit 4ffd514f76
4 changed files with 17 additions and 5 deletions

View File

@ -99,6 +99,7 @@ static const dc_descriptor_t g_descriptors[] = {
/* Suunto EON Steel */
#ifdef USBHID
{"Suunto", "EON Steel", DC_FAMILY_SUUNTO_EONSTEEL, 0},
{"Suunto", "EON Core", DC_FAMILY_SUUNTO_EONSTEEL, 1},
#endif
/* Uwatec Aladin */
{"Uwatec", "Aladin Air Twin", DC_FAMILY_UWATEC_ALADIN, 0x1C},

View File

@ -125,7 +125,7 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr
rc = suunto_d9_device_open (&device, context, name, dc_descriptor_get_model (descriptor));
break;
case DC_FAMILY_SUUNTO_EONSTEEL:
rc = suunto_eonsteel_device_open (&device, context);
rc = suunto_eonsteel_device_open (&device, context, dc_descriptor_get_model (descriptor));
break;
case DC_FAMILY_UWATEC_ALADIN:
rc = uwatec_aladin_device_open (&device, context, name);

View File

@ -30,9 +30,13 @@
#include "usbhid.h"
#include "platform.h"
#define EONSTEEL 0
#define EONCORE 1
typedef struct suunto_eonsteel_device_t {
dc_device_t base;
dc_usbhid_t *usbhid;
unsigned int model;
unsigned int magic;
unsigned short seq;
unsigned char version[0x30];
@ -551,7 +555,7 @@ static int initialize_eonsteel(suunto_eonsteel_device_t *eon)
}
dc_status_t
suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context)
suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, unsigned int model)
{
dc_status_t status = DC_STATUS_SUCCESS;
suunto_eonsteel_device_t *eon = NULL;
@ -564,12 +568,19 @@ suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context)
return DC_STATUS_NOMEMORY;
// Set up the magic handshake fields
eon->model = model;
eon->magic = INIT_MAGIC;
eon->seq = INIT_SEQ;
memset (eon->version, 0, sizeof (eon->version));
memset (eon->fingerprint, 0, sizeof (eon->fingerprint));
status = dc_usbhid_open(&eon->usbhid, context, 0x1493, 0x0030);
unsigned int vid = 0x1493, pid = 0;
if (model == EONCORE) {
pid = 0x0033;
} else {
pid = 0x0030;
}
status = dc_usbhid_open(&eon->usbhid, context, vid, pid);
if (status != DC_STATUS_SUCCESS) {
ERROR(context, "unable to open device");
goto error_free;
@ -622,7 +633,7 @@ suunto_eonsteel_device_foreach(dc_device_t *abstract, dc_dive_callback_t callbac
// Emit a device info event.
dc_event_devinfo_t devinfo;
devinfo.model = 0;
devinfo.model = eon->model;
devinfo.firmware = array_uint32_be (eon->version + 0x20);
devinfo.serial = array_convert_str2num(eon->version + 0x10, 16);
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);

View File

@ -31,7 +31,7 @@ extern "C" {
#endif /* __cplusplus */
dc_status_t
suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context);
suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context, unsigned int model);
dc_status_t
suunto_eonsteel_parser_create(dc_parser_t **parser, dc_context_t *context, unsigned int model);