Fix dc_serial_native_open return check for Shearwater family

The dc_serial_native_open method doesn't return -1 on failures.
The failure errors can be DC_STATUS_INVALIDARGS, DC_STATUS_NOMEMORY,
DC_STATUS_IO.

Therefore we should check if the returned value is equal to
DC_STATUS_SUCCESS and pass it further.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Claudiu Olteanu 2015-09-07 00:54:31 +03:00 committed by Dirk Hohndel
parent 9c7d1102d4
commit 8932b2a936

View File

@ -43,9 +43,9 @@ shearwater_common_open (shearwater_common_device_t *device, dc_context_t *contex
{
// Open the device.
int rc = dc_serial_native_open (&device->serial, context, name);
if (rc == -1) {
if (rc != DC_STATUS_SUCCESS) {
ERROR (context, "Failed to open the serial port.");
return DC_STATUS_IO;
return rc;
}
// Set the serial communication protocol (115200 8N1).