Automatically switch the device into download mode.
This commit is contained in:
parent
da684c1fcf
commit
24f0f66efd
@ -42,15 +42,6 @@ test_dump_memory (const char* name, const char* filename)
|
||||
return rc;
|
||||
}
|
||||
|
||||
message ("device_version\n");
|
||||
unsigned char version[OCEANIC_ATOM2_PACKET_SIZE] = {0};
|
||||
rc = device_version (device, version, sizeof (version));
|
||||
if (rc != DEVICE_STATUS_SUCCESS) {
|
||||
WARNING ("Cannot identify computer.");
|
||||
device_close (device);
|
||||
return rc;
|
||||
}
|
||||
|
||||
message ("device_read\n");
|
||||
rc = device_read (device, 0x00, data, sizeof (data));
|
||||
if (rc != DEVICE_STATUS_SUCCESS) {
|
||||
|
||||
@ -42,15 +42,6 @@ test_dump_memory (const char* name, const char* filename)
|
||||
return rc;
|
||||
}
|
||||
|
||||
message ("device_version\n");
|
||||
unsigned char version[OCEANIC_VEO250_PACKET_SIZE] = {0};
|
||||
rc = device_version (device, version, sizeof (version));
|
||||
if (rc != DEVICE_STATUS_SUCCESS) {
|
||||
WARNING ("Cannot identify computer.");
|
||||
device_close (device);
|
||||
return rc;
|
||||
}
|
||||
|
||||
message ("device_read\n");
|
||||
rc = device_read (device, 0x00, data, sizeof (data));
|
||||
if (rc != DEVICE_STATUS_SUCCESS) {
|
||||
|
||||
@ -42,15 +42,6 @@ test_dump_memory (const char* name, const char* filename)
|
||||
return rc;
|
||||
}
|
||||
|
||||
message ("device_version\n");
|
||||
unsigned char version[OCEANIC_VTPRO_PACKET_SIZE] = {0};
|
||||
rc = device_version (device, version, sizeof (version));
|
||||
if (rc != DEVICE_STATUS_SUCCESS) {
|
||||
WARNING ("Cannot identify computer.");
|
||||
device_close (device);
|
||||
return rc;
|
||||
}
|
||||
|
||||
message ("oceanic_vtpro_device_calibrate\n");
|
||||
unsigned char calibration = 0;
|
||||
rc = oceanic_vtpro_device_calibrate (device, &calibration, 1);
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
typedef struct oceanic_atom2_device_t {
|
||||
oceanic_common_device_t base;
|
||||
struct serial *port;
|
||||
unsigned char version[OCEANIC_ATOM2_PACKET_SIZE];
|
||||
} oceanic_atom2_device_t;
|
||||
|
||||
static device_status_t oceanic_atom2_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
|
||||
@ -244,6 +245,7 @@ oceanic_atom2_device_open (device_t **out, const char* name)
|
||||
|
||||
// Set the default values.
|
||||
device->port = NULL;
|
||||
memset (device->version, 0, sizeof (device->version));
|
||||
|
||||
// Open the device.
|
||||
int rc = serial_open (&device->port, name);
|
||||
@ -279,6 +281,11 @@ oceanic_atom2_device_open (device_t **out, const char* name)
|
||||
// Send the init command.
|
||||
oceanic_atom2_init (device);
|
||||
|
||||
// Switch the device from surface mode into download mode. Before sending
|
||||
// this command, the device needs to be in PC mode (automatically activated
|
||||
// by connecting the device), or already in download mode.
|
||||
oceanic_atom2_device_version ((device_t *) device, device->version, sizeof (device->version));
|
||||
|
||||
*out = (device_t*) device;
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
|
||||
@ -50,6 +50,7 @@ typedef struct oceanic_veo250_device_t {
|
||||
oceanic_common_device_t base;
|
||||
struct serial *port;
|
||||
unsigned int last;
|
||||
unsigned char version[OCEANIC_VEO250_PACKET_SIZE];
|
||||
} oceanic_veo250_device_t;
|
||||
|
||||
static device_status_t oceanic_veo250_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
|
||||
@ -243,6 +244,7 @@ oceanic_veo250_device_open (device_t **out, const char* name)
|
||||
// Set the default values.
|
||||
device->port = NULL;
|
||||
device->last = 0;
|
||||
memset (device->version, 0, sizeof (device->version));
|
||||
|
||||
// Open the device.
|
||||
int rc = serial_open (&device->port, name);
|
||||
@ -287,6 +289,11 @@ oceanic_veo250_device_open (device_t **out, const char* name)
|
||||
// Initialize the data cable (PPS mode).
|
||||
oceanic_veo250_init (device);
|
||||
|
||||
// Switch the device from surface mode into download mode. Before sending
|
||||
// this command, the device needs to be in PC mode (manually activated by
|
||||
// the user), or already in download mode.
|
||||
oceanic_veo250_device_version ((device_t *) device, device->version, sizeof (device->version));
|
||||
|
||||
*out = (device_t*) device;
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
@ -313,7 +320,7 @@ oceanic_veo250_device_close (device_t *abstract)
|
||||
if (! device_is_oceanic_veo250 (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
// Send the quit command.
|
||||
// Switch the device back to surface mode.
|
||||
oceanic_veo250_quit (device);
|
||||
|
||||
// Close the device.
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
typedef struct oceanic_vtpro_device_t {
|
||||
oceanic_common_device_t base;
|
||||
struct serial *port;
|
||||
unsigned char version[OCEANIC_VTPRO_PACKET_SIZE];
|
||||
} oceanic_vtpro_device_t;
|
||||
|
||||
static device_status_t oceanic_vtpro_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
|
||||
@ -236,6 +237,7 @@ oceanic_vtpro_device_open (device_t **out, const char* name)
|
||||
|
||||
// Set the default values.
|
||||
device->port = NULL;
|
||||
memset (device->version, 0, sizeof (device->version));
|
||||
|
||||
// Open the device.
|
||||
int rc = serial_open (&device->port, name);
|
||||
@ -280,6 +282,11 @@ oceanic_vtpro_device_open (device_t **out, const char* name)
|
||||
// Initialize the data cable (MOD mode).
|
||||
oceanic_vtpro_init (device);
|
||||
|
||||
// Switch the device from surface mode into download mode. Before sending
|
||||
// this command, the device needs to be in PC mode (manually activated by
|
||||
// the user), or already in download mode.
|
||||
oceanic_vtpro_device_version ((device_t *) device, device->version, sizeof (device->version));
|
||||
|
||||
*out = (device_t*) device;
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
@ -294,7 +301,7 @@ oceanic_vtpro_device_close (device_t *abstract)
|
||||
if (! device_is_oceanic_vtpro (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
// Send the quit command.
|
||||
// Switch the device back to surface mode.
|
||||
oceanic_vtpro_quit (device);
|
||||
|
||||
// Close the device.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user