From 238a3734a57dbc80eb282bdc5a3b5043b628a7e5 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 19 Nov 2017 15:36:39 -1000 Subject: [PATCH] Add support for new Suunto EON Core dive computer Nick Shore reports that it seems to act exactly like an EON Steel, just with a different USB device ID. Acting like the EON Steel is not a surprise: it does seem to be the same dive computer, just in a smaller and lighter package (same screen size, but more compact body and without the stainless steel to make it less than half the weight). Looks like the battery is smaller, but the electronics are likely the same. We probably really should have some way to add new device ID's without having to add whole new model numbers etc. It's not the first time this happens (see the Scubapro Aladin Square vs the G2), and it's likely not the last time. Reported-by: Nick Shore Signed-off-by: Linus Torvalds --- src/descriptor.c | 1 + src/device.c | 2 +- src/suunto_eonsteel.c | 10 +++++++--- src/suunto_eonsteel.h | 2 +- src/usbhid.c | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/descriptor.c b/src/descriptor.c index f049d82..01dbd69 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -100,6 +100,7 @@ static const dc_descriptor_t g_descriptors[] = { /* Suunto EON Steel */ #ifdef USBHID {"Suunto", "EON Steel", DC_FAMILY_SUUNTO_EONSTEEL, 0}, // BLE + {"Suunto", "EON Core", DC_FAMILY_SUUNTO_EONSTEEL, 1}, // BLE #endif /* Uwatec Aladin */ {"Uwatec", "Aladin Air Twin", DC_FAMILY_UWATEC_ALADIN, 0x1C}, // FTDI diff --git a/src/device.c b/src/device.c index 35e0951..7980186 100644 --- a/src/device.c +++ b/src/device.c @@ -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, name); + rc = suunto_eonsteel_device_open (&device, context, name, dc_descriptor_get_model(descriptor)); break; case DC_FAMILY_UWATEC_ALADIN: rc = uwatec_aladin_device_open (&device, context, name); diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 0c78359..0f656ad 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -727,7 +727,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, const char *name) +suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) { dc_status_t status = DC_STATUS_SUCCESS; suunto_eonsteel_device_t *eon = NULL; @@ -748,8 +748,12 @@ suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, const char dc_custom_io_t *io = _dc_context_custom_io(eon->base.context); if (io && io->packet_open) status = io->packet_open(io, context, name); - else - status = dc_usbhid_custom_io(context, 0x1493, 0x0030); + else { + /* We really need some way to specify USB ID's in the descriptor */ + unsigned int vendor_id = 0x1493; + unsigned int device_id = model ? 0x0033 : 0x0030; + status = dc_usbhid_custom_io(context, vendor_id, device_id); + } if (status != DC_STATUS_SUCCESS) { ERROR(context, "unable to open device"); diff --git a/src/suunto_eonsteel.h b/src/suunto_eonsteel.h index ad3d292..4d34478 100644 --- a/src/suunto_eonsteel.h +++ b/src/suunto_eonsteel.h @@ -31,7 +31,7 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context, const char *name); +suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); dc_status_t suunto_eonsteel_parser_create(dc_parser_t **parser, dc_context_t *context, unsigned int model); diff --git a/src/usbhid.c b/src/usbhid.c index 2d1916d..06a6165 100644 --- a/src/usbhid.c +++ b/src/usbhid.c @@ -319,7 +319,7 @@ dc_usbhid_open (dc_usbhid_t **out, dc_context_t *context, unsigned int vid, unsi } if (device == NULL) { - ERROR (context, "No matching USB device found."); + ERROR (context, "No matching USB device (%04x:%04x) found.", vid, pid); status = DC_STATUS_NODEVICE; goto error_usb_free_list; }