mbus_connect() and mbus_disconnect() return 0 on success and -1 otherwise

This commit is contained in:
jakubovsky
2012-07-09 12:33:32 +02:00
parent 5f9052b284
commit b95f29fcc8
12 changed files with 21 additions and 21 deletions

View File

@ -37,11 +37,11 @@ mbus_serial_connect(mbus_handle *handle)
struct termios *term;
if (handle == NULL)
return 0;
return -1;
serial_data = (mbus_serial_data *) handle->auxdata;
if (serial_data == NULL || serial_data->device == NULL)
return 0;
return -1;
device = serial_data->device;
term = &(serial_data->t);
@ -53,7 +53,7 @@ mbus_serial_connect(mbus_handle *handle)
if ((handle->fd = open(device, O_RDWR | O_NOCTTY)) < 0)
{
fprintf(stderr, "%s: failed to open tty.", __PRETTY_FUNCTION__);
return 0;
return -1;
}
memset(term, 0, sizeof(*term));
@ -88,7 +88,7 @@ mbus_serial_connect(mbus_handle *handle)
tcsetattr(handle->fd, TCSANOW, term);
return 1;
return 0;
}
//------------------------------------------------------------------------------