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:
parent
9c7d1102d4
commit
8932b2a936
@ -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).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user