diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-02-05 08:38:27 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-02-05 08:38:27 +0100 |
commit | 14d771b90f5a7d3887e5e900d1fb4737477ad305 (patch) | |
tree | f382e3359d20916ae60d28361e59635e373224f8 /libqcdm/src/com.c | |
parent | a09050a7f63a262bf90dcb1c7a41f9cfd205db43 (diff) |
Imported Upstream version 0.5.2.0upstream/0.5.2.0
Diffstat (limited to 'libqcdm/src/com.c')
-rw-r--r-- | libqcdm/src/com.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/libqcdm/src/com.c b/libqcdm/src/com.c index 353103a..ad50dd0 100644 --- a/libqcdm/src/com.c +++ b/libqcdm/src/com.c @@ -21,21 +21,18 @@ #include <string.h> #include "com.h" -#include "error.h" +#include "errors.h" -gboolean -qcdm_port_setup (int fd, GError **error) +int +qcdm_port_setup (int fd) { struct termios stbuf; - g_type_init (); - errno = 0; memset (&stbuf, 0, sizeof (stbuf)); if (tcgetattr (fd, &stbuf) != 0) { - g_set_error (error, - QCDM_SERIAL_ERROR, QCDM_SERIAL_CONFIG_FAILED, - "tcgetattr() error: %d", errno); + qcdm_err (0, "tcgetattr() error: %d", errno); + return -QCDM_ERROR_SERIAL_CONFIG_FAILED; } stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB); @@ -50,12 +47,10 @@ qcdm_port_setup (int fd, GError **error) errno = 0; if (tcsetattr (fd, TCSANOW, &stbuf) < 0) { - g_set_error (error, - QCDM_SERIAL_ERROR, QCDM_SERIAL_CONFIG_FAILED, - "tcsetattr() error: %d", errno); - return FALSE; + qcdm_err (0, "tcgetattr() error: %d", errno); + return -QCDM_ERROR_SERIAL_CONFIG_FAILED; } - return TRUE; + return QCDM_SUCCESS; } |