diff --git a/configure.ac b/configure.ac index aa676e9..78af57b 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,9 @@ AC_CONFIG_MACRO_DIR([m4]) # Initialize automake. AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +# Fix for automake >= 1.12 +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) + # Initialize libtool. LT_PREREQ([2.2.0]) LT_INIT([win32-dll]) diff --git a/src/atomics_cobalt.c b/src/atomics_cobalt.c index 66907a3..ea8fd30 100644 --- a/src/atomics_cobalt.c +++ b/src/atomics_cobalt.c @@ -37,9 +37,11 @@ #include "checksum.h" #include "array.h" +#define EXITCODE(rc) (rc == LIBUSB_ERROR_TIMEOUT ? DEVICE_STATUS_TIMEOUT : DEVICE_STATUS_IO) + #define VID 0x0471 #define PID 0x0888 -#define TIMEOUT 1000 +#define TIMEOUT 2000 #define FP_OFFSET 20 @@ -219,7 +221,7 @@ atomics_cobalt_device_version (dc_device_t *abstract, unsigned char data[], unsi bRequest, 0, 0, NULL, 0, TIMEOUT); if (rc != LIBUSB_SUCCESS) { WARNING ("Failed to send the command."); - return DC_STATUS_IO; + return EXITCODE(rc); } // Receive the answer from the dive computer. @@ -229,7 +231,7 @@ atomics_cobalt_device_version (dc_device_t *abstract, unsigned char data[], unsi packet, sizeof (packet), &length, TIMEOUT); if (rc != LIBUSB_SUCCESS || length != sizeof (packet)) { WARNING ("Failed to receive the answer."); - return DC_STATUS_IO; + return EXITCODE(rc); } // Verify the checksum of the packet. @@ -275,19 +277,19 @@ atomics_cobalt_read_dive (dc_device_t *abstract, dc_buffer_t *buffer, int init, bRequest, 0, 0, NULL, 0, TIMEOUT); if (rc != LIBUSB_SUCCESS) { WARNING ("Failed to send the command."); - return DC_STATUS_IO; + return EXITCODE(rc); } unsigned int nbytes = 0; while (1) { // Receive the answer from the dive computer. int length = 0; - unsigned char packet[10 * 1024] = {0}; + unsigned char packet[8 * 1024] = {0}; rc = libusb_bulk_transfer (device->handle, 0x82, packet, sizeof (packet), &length, TIMEOUT); - if (rc != LIBUSB_SUCCESS && rc != LIBUSB_ERROR_TIMEOUT) { + if (rc != LIBUSB_SUCCESS) { WARNING ("Failed to receive the answer."); - return DC_STATUS_IO; + return EXITCODE(rc); } // Update and emit a progress event. diff --git a/src/hw_ostc.c b/src/hw_ostc.c index 7391474..750664a 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -404,7 +404,7 @@ hw_ostc_device_eeprom_read (dc_device_t *abstract, unsigned int bank, unsigned c if (! device_is_hw_ostc (abstract)) return DC_STATUS_INVALIDARGS; - if (bank > 1) { + if (bank > 2) { WARNING ("Invalid eeprom bank specified."); return DC_STATUS_INVALIDARGS; } @@ -415,8 +415,8 @@ hw_ostc_device_eeprom_read (dc_device_t *abstract, unsigned int bank, unsigned c } // Send the command. - unsigned char command = (bank == 0) ? 'g' : 'j'; - dc_status_t rc = hw_ostc_send (device, command, 0); + const unsigned char command[] = {'g', 'j', 'm'}; + dc_status_t rc = hw_ostc_send (device, command[bank], 0); if (rc != DC_STATUS_SUCCESS) return rc; @@ -439,7 +439,7 @@ hw_ostc_device_eeprom_write (dc_device_t *abstract, unsigned int bank, const uns if (! device_is_hw_ostc (abstract)) return DC_STATUS_INVALIDARGS; - if (bank > 1) { + if (bank > 2) { WARNING ("Invalid eeprom bank specified."); return DC_STATUS_INVALIDARGS; } @@ -450,8 +450,8 @@ hw_ostc_device_eeprom_write (dc_device_t *abstract, unsigned int bank, const uns } // Send the command. - unsigned char command = (bank == 0) ? 'd' : 'i'; - dc_status_t rc = hw_ostc_send (device, command, 1); + const unsigned char command[] = {'d', 'i', 'n'}; + dc_status_t rc = hw_ostc_send (device, command[bank], 1); if (rc != DC_STATUS_SUCCESS) return rc; diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 64b260b..f67ce48 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -442,7 +442,7 @@ mares_iconhd_extract_dives (dc_device_t *abstract, const unsigned char data[], u // equals the calculated length. If both values are different, // something is wrong and an error is returned. unsigned int length = array_uint32_le (buffer + offset); - if (length == 0) + if (length == 0 || length == 0xFFFFFFFF) break; if (length != nbytes) { WARNING ("Calculated and stored size are not equal."); diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 5bdf973..81945c1 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -64,6 +64,7 @@ static const device_backend_t oceanic_atom2_device_backend = { oceanic_atom2_device_close /* close */ }; +static const unsigned char aeris_manta_version[] = "MANTA R\0\0 512K"; static const unsigned char aeris_atmosai_version[] = "ATMOSAI R\0\0 512K"; static const unsigned char aeris_epic_version[] = "2M EPIC r\0\0 512K"; static const unsigned char aeris_f10_version[] = "FREEWAER \0\0 512K"; @@ -86,7 +87,6 @@ static const unsigned char tusa_element2_version[] = "ELEMENT2 \0\0 512K"; static const unsigned char tusa_zen_version[] = "TUSAZEN \0\0 512K"; static const unsigned char tusa_zenair_version[] = "TUZENAIR \0\0 512K"; - static const oceanic_common_layout_t aeris_f10_layout = { 0x10000, /* memsize */ 0x0000, /* cf_devinfo */ @@ -383,6 +383,7 @@ oceanic_atom2_device_open (dc_device_t **out, const char *name) device->base.layout = &oceanic_atom1_layout; else if (oceanic_common_match (sherwood_insight_version, device->version, sizeof (device->version)) || oceanic_common_match (sherwood_wisdom2_version, device->version, sizeof (device->version)) || + oceanic_common_match (aeris_manta_version, device->version, sizeof (device->version)) || oceanic_common_match (aeris_atmosai_version, device->version, sizeof (device->version)) || oceanic_common_match (oceanic_geo2_version, device->version, sizeof (device->version)) || oceanic_common_match (oceanic_veo3_version, device->version, sizeof (device->version)) || diff --git a/src/serial_posix.c b/src/serial_posix.c index f1807ba..cf13abf 100644 --- a/src/serial_posix.c +++ b/src/serial_posix.c @@ -664,7 +664,7 @@ serial_set_break (serial_t *device, int level) if (device == NULL) return -1; // EINVAL (Invalid argument) - int action = (level ? TIOCSBRK : TIOCCBRK); + unsigned long action = (level ? TIOCSBRK : TIOCCBRK); if (ioctl (device->fd, action, NULL) != 0) { TRACE ("ioctl"); @@ -678,7 +678,7 @@ serial_set_break (serial_t *device, int level) static int serial_set_status (int fd, int value, int level) { - int action = (level ? TIOCMBIS : TIOCMBIC); + unsigned long action = (level ? TIOCMBIS : TIOCMBIC); if (ioctl (fd, action, &value) != 0) { TRACE ("ioctl"); diff --git a/src/suunto_d9.c b/src/suunto_d9.c index d0cc3d8..386194d 100644 --- a/src/suunto_d9.c +++ b/src/suunto_d9.c @@ -76,7 +76,7 @@ static const suunto_common2_layout_t suunto_d9tx_layout = { 0x10000, /* memsize */ 0x0024, /* serial */ 0x019A, /* rb_profile_begin */ - 0xFFFE /* rb_profile_end */ + 0xEBF0 /* rb_profile_end */ }; static int