[PATCH v2 11/15] Add code to send upgrade firmware command to OSTC3
Jef Driesen
jef at libdivecomputer.org
Fri Dec 19 08:03:28 PST 2014
On 2014-12-17 23:11, Anton Lundin wrote:
> @@ -329,7 +331,7 @@ hw_ostc3_device_close (dc_device_t *abstract)
> dc_status_t rc = DC_STATUS_SUCCESS;
>
> // Send the exit command
> - if (device->state != OPEN) {
> + if (device->state != REBOOTING && device->state != OPEN) {
> rc = hw_ostc3_transfer (device, NULL, EXIT, NULL, 0, NULL, 0);
> if (rc != DC_STATUS_SUCCESS) {
> ERROR (abstract->context, "Failed to send the command.");
This condition in the if statement is a bit counter intuitive. You
basically list all the states when you should NOT send the exit command.
I find it easier to understand when doing the opposite:
if (device->state == DOWNLOAD || device->state == SERVICE) {
...
}
Jef
More information about the devel
mailing list