Add support for Scubapro Aladin Square
It works like the G2, but has a different model number, and different USB device ID. Lots-of-testing-by: Vincent <vavincavent@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9d7335dc6d
commit
a2f358f0b5
@ -140,6 +140,7 @@ static const dc_descriptor_t g_descriptors[] = {
|
||||
/* Scubapro G2 */
|
||||
#ifdef USBHID
|
||||
{"Scubapro", "Aladin Sport Matrix", DC_FAMILY_UWATEC_G2, 0x17}, // BLE
|
||||
{"Scubapro", "Aladin Square", DC_FAMILY_UWATEC_G2, 0x22},
|
||||
{"Scubapro", "G2", DC_FAMILY_UWATEC_G2, 0x32}, // BLE
|
||||
#endif
|
||||
/* Reefnet */
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#define TX_PACKET_SIZE 32
|
||||
|
||||
#define ALADINSPORTMATRIX 0x17
|
||||
#define ALADINSQUARE 0x22
|
||||
#define G2 0x32
|
||||
|
||||
typedef struct scubapro_g2_device_t {
|
||||
dc_device_t base;
|
||||
@ -191,6 +193,28 @@ scubapro_g2_handshake (scubapro_g2_device_t *device, unsigned int model)
|
||||
return DC_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
struct usb_id {
|
||||
unsigned int model;
|
||||
unsigned short vendor, device;
|
||||
};
|
||||
#define C_ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
|
||||
|
||||
static const struct usb_id *get_usb_id(unsigned int model)
|
||||
{
|
||||
int i;
|
||||
static const struct usb_id model_to_usb[] = {
|
||||
{ G2, 0x2e6c, 0x3201 }, // Scubapro G2
|
||||
{ ALADINSQUARE, 0xc251, 0x2006 }, // Scubapro Aladin Square
|
||||
};
|
||||
|
||||
for (i = 0; i < C_ARRAY_SIZE(model_to_usb); i++) {
|
||||
const struct usb_id *id = model_to_usb+i;
|
||||
|
||||
if (id->model == model)
|
||||
return id;
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
dc_status_t
|
||||
scubapro_g2_device_open(dc_device_t **out, dc_context_t *context, const char *name, unsigned int model)
|
||||
@ -217,8 +241,14 @@ scubapro_g2_device_open(dc_device_t **out, dc_context_t *context, const char *na
|
||||
dc_custom_io_t *io = _dc_context_custom_io(context);
|
||||
if (io && io->packet_open)
|
||||
status = io->packet_open(io, context, name);
|
||||
else
|
||||
status = dc_usbhid_custom_io(context, 0x2e6c, 0x3201);
|
||||
else {
|
||||
const struct usb_id *id = get_usb_id(model);
|
||||
if (!id) {
|
||||
ERROR(context, "Unknown USB ID for Scubapro model %#04x", model);
|
||||
return DC_STATUS_IO;
|
||||
}
|
||||
status = dc_usbhid_custom_io(context, id->vendor, id->device);
|
||||
}
|
||||
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to open Scubapro G2 device");
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
#define GALILEOTRIMIX 0x19
|
||||
#define SMARTZ 0x1C
|
||||
#define MERIDIAN 0x20
|
||||
#define SQUARE 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 == SQUARE) {
|
||||
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 SQUARE:
|
||||
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 == SQUARE) {
|
||||
// Uwatec Galileo
|
||||
id = uwatec_galileo_identify (data[offset]);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user