~ubuntu-branches/ubuntu/precise/modemmanager/precise

« back to all changes in this revision

Viewing changes to libqcdm/src/com.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-02-08 15:47:24 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20120208154724-8j99jwe6secj5tdm
Tags: 0.5.1.96+git201202081807.635fce1-0ubuntu1
* upstream snapshot 2012-02-08 18:07:13 (GMT)
  + 635fce193ff3a1dbbdee2abab9aa3ab121df25f0
* debian/rules: as for NetworkManager, drop a few characters from the version
  number for git snapshots.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <string.h>
22
22
 
23
23
#include "com.h"
24
 
#include "error.h"
 
24
#include "errors.h"
25
25
 
26
 
gboolean
27
 
qcdm_port_setup (int fd, GError **error)
 
26
int
 
27
qcdm_port_setup (int fd)
28
28
{
29
29
    struct termios stbuf;
30
30
 
31
 
    g_type_init ();
32
 
 
33
31
    errno = 0;
34
32
    memset (&stbuf, 0, sizeof (stbuf));
35
33
    if (tcgetattr (fd, &stbuf) != 0) {
36
 
        g_set_error (error,
37
 
                     QCDM_SERIAL_ERROR, QCDM_SERIAL_CONFIG_FAILED,
38
 
                     "tcgetattr() error: %d", errno);
 
34
        qcdm_err (0, "tcgetattr() error: %d", errno);
 
35
        return -QCDM_ERROR_SERIAL_CONFIG_FAILED;
39
36
    }
40
37
 
41
38
    stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB);
50
47
 
51
48
    errno = 0;
52
49
    if (tcsetattr (fd, TCSANOW, &stbuf) < 0) {
53
 
        g_set_error (error,
54
 
                     QCDM_SERIAL_ERROR, QCDM_SERIAL_CONFIG_FAILED,
55
 
                     "tcsetattr() error: %d", errno);
56
 
        return FALSE;
 
50
        qcdm_err (0, "tcgetattr() error: %d", errno);
 
51
        return -QCDM_ERROR_SERIAL_CONFIG_FAILED;
57
52
    }
58
53
 
59
 
    return TRUE;
 
54
    return QCDM_SUCCESS;
60
55
}
61
56