Add support for the Scubapro Aladin Square

The communication protocol is identical to the G2 protocol, but with a
different USB VID/PID (c251:2006).

Note that unlike the G2, the Aladin Square seems to support only 33 byte
USB HID packets (1 byte report id and 32 bytes payload), even when the
actual command is much smaller. Without padding the commands, the dive
computer doesn't reply at all. Because the padding is already there, to
support the Windows api, no further changes are necessary.
This commit is contained in:
Jef Driesen 2017-11-13 09:30:41 +01:00
parent 20d7d03a0d
commit 428704b538
5 changed files with 21 additions and 6 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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
}

View File

@ -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 {