diff --git a/src/descriptor.c b/src/descriptor.c index 6a2d695..52186f4 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -139,6 +139,7 @@ static const dc_descriptor_t g_descriptors[] = { /* Scubapro G2 */ #ifdef USBHID {"Scubapro", "Aladin Sport Matrix", DC_FAMILY_UWATEC_G2, 0x17}, + {"Scubapro", "Aladin Square", DC_FAMILY_UWATEC_G2, 0x22}, {"Scubapro", "G2", DC_FAMILY_UWATEC_G2, 0x32}, #endif /* Reefnet */ diff --git a/src/device.c b/src/device.c index 6277c90..349ed1d 100644 --- a/src/device.c +++ b/src/device.c @@ -140,7 +140,7 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr rc = uwatec_meridian_device_open (&device, context, name); break; case DC_FAMILY_UWATEC_G2: - rc = uwatec_g2_device_open (&device, context); + rc = uwatec_g2_device_open (&device, context, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_REEFNET_SENSUS: rc = reefnet_sensus_device_open (&device, context, name); diff --git a/src/uwatec_g2.c b/src/uwatec_g2.c index 4ef949f..5f62f4b 100644 --- a/src/uwatec_g2.c +++ b/src/uwatec_g2.c @@ -35,6 +35,8 @@ #define RX_PACKET_SIZE 64 #define TX_PACKET_SIZE 32 +#define ALADINSQUARE 0x22 + typedef struct uwatec_g2_device_t { dc_device_t base; dc_usbhid_t *usbhid; @@ -178,7 +180,7 @@ uwatec_g2_handshake (uwatec_g2_device_t *device) dc_status_t -uwatec_g2_device_open (dc_device_t **out, dc_context_t *context) +uwatec_g2_device_open (dc_device_t **out, dc_context_t *context, unsigned int model) { dc_status_t status = DC_STATUS_SUCCESS; uwatec_g2_device_t *device = NULL; @@ -200,7 +202,15 @@ uwatec_g2_device_open (dc_device_t **out, dc_context_t *context) device->devtime = 0; // Open the irda socket. - status = dc_usbhid_open (&device->usbhid, context, 0x2e6c, 0x3201); + unsigned int vid = 0, pid = 0; + if (model == ALADINSQUARE) { + vid = 0xc251; + pid = 0x2006; + } else { + vid = 0x2e6c; + pid = 0x3201; + } + status = dc_usbhid_open (&device->usbhid, context, vid, pid); if (status != DC_STATUS_SUCCESS) { ERROR (context, "Failed to open USB device"); goto error_free; diff --git a/src/uwatec_g2.h b/src/uwatec_g2.h index c7ac7ca..801e15d 100644 --- a/src/uwatec_g2.h +++ b/src/uwatec_g2.h @@ -31,7 +31,7 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -uwatec_g2_device_open (dc_device_t **device, dc_context_t *context); +uwatec_g2_device_open (dc_device_t **device, dc_context_t *context, unsigned int model); #ifdef __cplusplus } diff --git a/src/uwatec_smart_parser.c b/src/uwatec_smart_parser.c index e0726e4..a70acb7 100644 --- a/src/uwatec_smart_parser.c +++ b/src/uwatec_smart_parser.c @@ -46,6 +46,7 @@ #define GALILEOTRIMIX 0x19 #define SMARTZ 0x1C #define MERIDIAN 0x20 +#define ALADINSQUARE 0x22 #define CHROMIS 0x24 #define MANTIS2 0x26 #define G2 0x32 @@ -522,7 +523,8 @@ uwatec_smart_parser_cache (uwatec_smart_parser_t *parser) if (parser->model == GALILEO || parser->model == GALILEOTRIMIX || parser->model == ALADIN2G || parser->model == MERIDIAN || parser->model == CHROMIS || parser->model == MANTIS2 || - parser->model == G2 || parser->model == ALADINSPORTMATRIX) { + parser->model == G2 || parser->model == ALADINSPORTMATRIX || + parser->model == ALADINSQUARE) { unsigned int offset = header->tankpressure + 2 * i; endpressure = array_uint16_le(data + offset); beginpressure = array_uint16_le(data + offset + 2 * header->ngases); @@ -600,6 +602,7 @@ uwatec_smart_parser_create (dc_parser_t **out, dc_context_t *context, unsigned i case MERIDIAN: case CHROMIS: case MANTIS2: + case ALADINSQUARE: parser->headersize = 152; parser->header = &uwatec_smart_galileo_header; parser->samples = uwatec_smart_galileo_samples; @@ -952,7 +955,8 @@ uwatec_smart_parse (uwatec_smart_parser_t *parser, dc_sample_callback_t callback if (parser->model == GALILEO || parser->model == GALILEOTRIMIX || parser->model == ALADIN2G || parser->model == MERIDIAN || parser->model == CHROMIS || parser->model == MANTIS2 || - parser->model == G2 || parser->model == ALADINSPORTMATRIX) { + parser->model == G2 || parser->model == ALADINSPORTMATRIX || + parser->model == ALADINSQUARE) { // Uwatec Galileo id = uwatec_galileo_identify (data[offset]); } else {