Support for the Scubapro Aladin Sport Matrix.
The protocol is identical to the G2 protocol, with the exception of a missing handshake. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0099aeeb70
commit
8a84ece7d0
@ -139,7 +139,8 @@ static const dc_descriptor_t g_descriptors[] = {
|
|||||||
{"Scubapro", "Mantis 2", DC_FAMILY_UWATEC_MERIDIAN, 0x26},
|
{"Scubapro", "Mantis 2", DC_FAMILY_UWATEC_MERIDIAN, 0x26},
|
||||||
/* Scubapro G2 */
|
/* Scubapro G2 */
|
||||||
#ifdef USBHID
|
#ifdef USBHID
|
||||||
{"Scubapro", "G2", DC_FAMILY_UWATEC_G2, 0x32}, // BLE
|
{"Scubapro", "G2", DC_FAMILY_UWATEC_G2, 0x32}, // BLE
|
||||||
|
{"Scubapro", "Aladin Sport Matrix", DC_FAMILY_UWATEC_G2, 0xa5}, // BLE
|
||||||
#endif
|
#endif
|
||||||
/* Reefnet */
|
/* Reefnet */
|
||||||
{"Reefnet", "Sensus", DC_FAMILY_REEFNET_SENSUS, 1},
|
{"Reefnet", "Sensus", DC_FAMILY_REEFNET_SENSUS, 1},
|
||||||
|
|||||||
@ -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);
|
rc = uwatec_meridian_device_open (&device, context, name);
|
||||||
break;
|
break;
|
||||||
case DC_FAMILY_UWATEC_G2:
|
case DC_FAMILY_UWATEC_G2:
|
||||||
rc = scubapro_g2_device_open (&device, context, name);
|
rc = scubapro_g2_device_open (&device, context, name, dc_descriptor_get_model (descriptor));
|
||||||
break;
|
break;
|
||||||
case DC_FAMILY_REEFNET_SENSUS:
|
case DC_FAMILY_REEFNET_SENSUS:
|
||||||
rc = reefnet_sensus_device_open (&device, context, name);
|
rc = reefnet_sensus_device_open (&device, context, name);
|
||||||
|
|||||||
@ -35,6 +35,8 @@
|
|||||||
#define RX_PACKET_SIZE 64
|
#define RX_PACKET_SIZE 64
|
||||||
#define TX_PACKET_SIZE 32
|
#define TX_PACKET_SIZE 32
|
||||||
|
|
||||||
|
#define ALADINSPORTMATRIX 0xa5
|
||||||
|
|
||||||
typedef struct scubapro_g2_device_t {
|
typedef struct scubapro_g2_device_t {
|
||||||
dc_device_t base;
|
dc_device_t base;
|
||||||
unsigned int timestamp;
|
unsigned int timestamp;
|
||||||
@ -149,7 +151,7 @@ scubapro_g2_transfer(scubapro_g2_device_t *g2, const unsigned char command[], un
|
|||||||
|
|
||||||
|
|
||||||
static dc_status_t
|
static dc_status_t
|
||||||
scubapro_g2_handshake (scubapro_g2_device_t *device)
|
scubapro_g2_handshake (scubapro_g2_device_t *device, unsigned int model)
|
||||||
{
|
{
|
||||||
dc_device_t *abstract = (dc_device_t *) device;
|
dc_device_t *abstract = (dc_device_t *) device;
|
||||||
|
|
||||||
@ -157,6 +159,11 @@ scubapro_g2_handshake (scubapro_g2_device_t *device)
|
|||||||
unsigned char answer[1] = {0};
|
unsigned char answer[1] = {0};
|
||||||
unsigned char command[5] = {0x00, 0x10, 0x27, 0, 0};
|
unsigned char command[5] = {0x00, 0x10, 0x27, 0, 0};
|
||||||
|
|
||||||
|
// The vendor software does not do a handshake for the Aladin Sport Matrix,
|
||||||
|
// so let's not do any either.
|
||||||
|
if (model == ALADINSPORTMATRIX)
|
||||||
|
return DC_STATUS_SUCCESS;
|
||||||
|
|
||||||
// Handshake (stage 1).
|
// Handshake (stage 1).
|
||||||
command[0] = 0x1B;
|
command[0] = 0x1B;
|
||||||
dc_status_t rc = scubapro_g2_transfer (device, command, 1, answer, 1);
|
dc_status_t rc = scubapro_g2_transfer (device, command, 1, answer, 1);
|
||||||
@ -186,7 +193,7 @@ scubapro_g2_handshake (scubapro_g2_device_t *device)
|
|||||||
|
|
||||||
|
|
||||||
dc_status_t
|
dc_status_t
|
||||||
scubapro_g2_device_open(dc_device_t **out, dc_context_t *context, const char *name)
|
scubapro_g2_device_open(dc_device_t **out, dc_context_t *context, const char *name, unsigned int model)
|
||||||
{
|
{
|
||||||
dc_status_t status = DC_STATUS_SUCCESS;
|
dc_status_t status = DC_STATUS_SUCCESS;
|
||||||
scubapro_g2_device_t *device = NULL;
|
scubapro_g2_device_t *device = NULL;
|
||||||
@ -219,7 +226,7 @@ scubapro_g2_device_open(dc_device_t **out, dc_context_t *context, const char *na
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform the handshaking.
|
// Perform the handshaking.
|
||||||
status = scubapro_g2_handshake(device);
|
status = scubapro_g2_handshake(device, model);
|
||||||
if (status != DC_STATUS_SUCCESS) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
ERROR (context, "Failed to handshake with the device.");
|
ERROR (context, "Failed to handshake with the device.");
|
||||||
goto error_close;
|
goto error_close;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
dc_status_t
|
dc_status_t
|
||||||
scubapro_g2_device_open (dc_device_t **device, dc_context_t *context, const char *name);
|
scubapro_g2_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,19 +35,20 @@
|
|||||||
|
|
||||||
#define NBITS 8
|
#define NBITS 8
|
||||||
|
|
||||||
#define SMARTPRO 0x10
|
#define SMARTPRO 0x10
|
||||||
#define GALILEO 0x11
|
#define GALILEO 0x11
|
||||||
#define ALADINTEC 0x12
|
#define ALADINTEC 0x12
|
||||||
#define ALADINTEC2G 0x13
|
#define ALADINTEC2G 0x13
|
||||||
#define SMARTCOM 0x14
|
#define SMARTCOM 0x14
|
||||||
#define ALADIN2G 0x15
|
#define ALADIN2G 0x15
|
||||||
#define SMARTTEC 0x18
|
#define SMARTTEC 0x18
|
||||||
#define GALILEOTRIMIX 0x19
|
#define GALILEOTRIMIX 0x19
|
||||||
#define SMARTZ 0x1C
|
#define SMARTZ 0x1C
|
||||||
#define MERIDIAN 0x20
|
#define MERIDIAN 0x20
|
||||||
#define CHROMIS 0x24
|
#define CHROMIS 0x24
|
||||||
#define MANTIS2 0x26
|
#define MANTIS2 0x26
|
||||||
#define G2 0x32
|
#define G2 0x32
|
||||||
|
#define ALADINSPORTMATRIX 0xa5
|
||||||
|
|
||||||
#define UNSUPPORTED 0xFFFFFFFF
|
#define UNSUPPORTED 0xFFFFFFFF
|
||||||
|
|
||||||
@ -519,7 +520,7 @@ uwatec_smart_parser_cache (uwatec_smart_parser_t *parser)
|
|||||||
if (parser->model == GALILEO || parser->model == GALILEOTRIMIX ||
|
if (parser->model == GALILEO || parser->model == GALILEOTRIMIX ||
|
||||||
parser->model == ALADIN2G || parser->model == MERIDIAN ||
|
parser->model == ALADIN2G || parser->model == MERIDIAN ||
|
||||||
parser->model == CHROMIS || parser->model == MANTIS2 ||
|
parser->model == CHROMIS || parser->model == MANTIS2 ||
|
||||||
parser->model == G2) {
|
parser->model == G2 || parser->model == ALADINSPORTMATRIX) {
|
||||||
unsigned int offset = header->tankpressure + 2 * i;
|
unsigned int offset = header->tankpressure + 2 * i;
|
||||||
endpressure = array_uint16_le(data + offset);
|
endpressure = array_uint16_le(data + offset);
|
||||||
beginpressure = array_uint16_le(data + offset + 2 * header->ngases);
|
beginpressure = array_uint16_le(data + offset + 2 * header->ngases);
|
||||||
@ -609,6 +610,7 @@ uwatec_smart_parser_create (dc_parser_t **out, dc_context_t *context, unsigned i
|
|||||||
parser->nevents[2] = C_ARRAY_SIZE (uwatec_smart_galileo_events_2);
|
parser->nevents[2] = C_ARRAY_SIZE (uwatec_smart_galileo_events_2);
|
||||||
break;
|
break;
|
||||||
case G2:
|
case G2:
|
||||||
|
case ALADINSPORTMATRIX:
|
||||||
parser->headersize = 84;
|
parser->headersize = 84;
|
||||||
parser->header = &uwatec_smart_trimix_header;
|
parser->header = &uwatec_smart_trimix_header;
|
||||||
parser->samples = uwatec_smart_galileo_samples;
|
parser->samples = uwatec_smart_galileo_samples;
|
||||||
@ -948,7 +950,7 @@ uwatec_smart_parse (uwatec_smart_parser_t *parser, dc_sample_callback_t callback
|
|||||||
if (parser->model == GALILEO || parser->model == GALILEOTRIMIX ||
|
if (parser->model == GALILEO || parser->model == GALILEOTRIMIX ||
|
||||||
parser->model == ALADIN2G || parser->model == MERIDIAN ||
|
parser->model == ALADIN2G || parser->model == MERIDIAN ||
|
||||||
parser->model == CHROMIS || parser->model == MANTIS2 ||
|
parser->model == CHROMIS || parser->model == MANTIS2 ||
|
||||||
parser->model == G2) {
|
parser->model == G2 || parser->model == ALADINSPORTMATRIX) {
|
||||||
// Uwatec Galileo
|
// Uwatec Galileo
|
||||||
id = uwatec_galileo_identify (data[offset]);
|
id = uwatec_galileo_identify (data[offset]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user