diff options
author | Dan Williams <dcbw@redhat.com> | 2010-03-22 22:28:36 -0700 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-03-22 22:28:36 -0700 |
commit | c36aacee0a287f1d9b7365fd79a48555b92e1356 (patch) | |
tree | 4c62cf8c10528da3d5f03e1044d957a161bb1941 /libqcdm/src | |
parent | 76130862ed0aefce244e98a740c826a3452857e6 (diff) | |
download | ModemManager-c36aacee0a287f1d9b7365fd79a48555b92e1356.tar.gz |
qcdm: use tcsetattr/tcgetattr for better compatibility
With Alpha, mainly.
Diffstat (limited to 'libqcdm/src')
-rw-r--r-- | libqcdm/src/com.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libqcdm/src/com.c b/libqcdm/src/com.c index 59f2c6f84..353103a73 100644 --- a/libqcdm/src/com.c +++ b/libqcdm/src/com.c @@ -16,10 +16,9 @@ */ #include <errno.h> -#include <sys/ioctl.h> +#include <termios.h> #include <fcntl.h> #include <string.h> -#include <termio.h> #include "com.h" #include "error.h" @@ -27,20 +26,20 @@ gboolean qcdm_port_setup (int fd, GError **error) { - struct termio stbuf; + struct termios stbuf; g_type_init (); errno = 0; - memset (&stbuf, 0, sizeof (struct termio)); - if (ioctl (fd, TCGETA, &stbuf) != 0) { + memset (&stbuf, 0, sizeof (stbuf)); + if (tcgetattr (fd, &stbuf) != 0) { g_set_error (error, QCDM_SERIAL_ERROR, QCDM_SERIAL_CONFIG_FAILED, - "TCGETA error: %d", errno); + "tcgetattr() error: %d", errno); } stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB); - stbuf.c_iflag &= ~(HUPCL | IUTF8 | IUCLC | ISTRIP | IXON | ICRNL); + stbuf.c_iflag &= ~(HUPCL | IUTF8 | IUCLC | ISTRIP | IXON | IXOFF | IXANY | ICRNL); stbuf.c_oflag &= ~(OPOST | OCRNL | ONLCR | OLCUC | ONLRET); stbuf.c_lflag &= ~(ICANON | ISIG | IEXTEN | ECHO | ECHOE | ECHOK | ECHONL); stbuf.c_lflag &= ~(NOFLSH | XCASE | TOSTOP | ECHOPRT | ECHOCTL | ECHOKE); @@ -50,10 +49,10 @@ qcdm_port_setup (int fd, GError **error) stbuf.c_cflag |= (B115200 | CS8 | CREAD | 0 | 0); /* No parity, 1 stop bit */ errno = 0; - if (ioctl (fd, TCSETA, &stbuf) < 0) { + if (tcsetattr (fd, TCSANOW, &stbuf) < 0) { g_set_error (error, QCDM_SERIAL_ERROR, QCDM_SERIAL_CONFIG_FAILED, - "TCSETA error: %d", errno); + "tcsetattr() error: %d", errno); return FALSE; } |