diff options
author | Michael Biebl <biebl@debian.org> | 2010-03-17 11:59:29 -0700 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-03-17 11:59:29 -0700 |
commit | 857dcd7bcfd909a9c4dad8dcbe562e75c8a66116 (patch) | |
tree | 56f9df9a4f8a6f76d58cefdaf86ec291fa7d252c /src | |
parent | 0815597d8db7f59ed6030ff11ce070b2a8eb4f11 (diff) |
serial: use termios instead of old terminal ioctls
Makes sure we build on Alpha, plus the right thing to do.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-serial-port.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index bdef2784..15b6a0a9 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c @@ -18,7 +18,7 @@ #include <stdio.h> #include <stdlib.h> -#include <termio.h> +#include <termios.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -139,12 +139,12 @@ void mm_serial_port_print_config (MMSerialPort *port, const char *detail) { MMSerialPortPrivate *priv = MM_SERIAL_PORT_GET_PRIVATE (port); - struct termio stbuf; + struct termios stbuf; int err; - err = ioctl (priv->fd, TCGETA, &stbuf); + err = tcgetattr (priv->fd, &stbuf); if (err) { - g_warning ("*** %s (%s): (%s) TCGETA error %d", + g_warning ("*** %s (%s): (%s) tcgetattr() error %d", __func__, detail, mm_port_get_device (MM_PORT (port)), errno); return; } @@ -294,7 +294,7 @@ static gboolean real_config_fd (MMSerialPort *self, int fd, GError **error) { MMSerialPortPrivate *priv = MM_SERIAL_PORT_GET_PRIVATE (self); - struct termio stbuf; + struct termios stbuf; int speed; int bits; int parity; @@ -305,9 +305,9 @@ real_config_fd (MMSerialPort *self, int fd, GError **error) parity = parse_parity (priv->parity); stopbits = parse_stopbits (priv->stopbits); - memset (&stbuf, 0, sizeof (struct termio)); - if (ioctl (fd, TCGETA, &stbuf) != 0) { - g_warning ("%s (%s): TCGETA error: %d", + memset (&stbuf, 0, sizeof (struct termios)); + if (tcgetattr (fd, &stbuf) != 0) { + g_warning ("%s (%s): tcgetattr() error: %d", __func__, mm_port_get_device (MM_PORT (self)), errno); @@ -330,7 +330,7 @@ real_config_fd (MMSerialPort *self, int fd, GError **error) stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | PARENB | CRTSCTS); stbuf.c_cflag |= (speed | bits | CREAD | 0 | parity | stopbits | CLOCAL); - if (ioctl (fd, TCSETA, &stbuf) < 0) { + if (tcsetattr (fd, TCSANOW, &stbuf) < 0) { g_set_error (error, MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, @@ -747,7 +747,7 @@ mm_serial_port_open (MMSerialPort *self, GError **error) return FALSE; } - if (ioctl (priv->fd, TCGETA, &priv->old_t) < 0) { + if (tcgetattr (priv->fd, &priv->old_t) < 0) { g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_OPEN_FAILED, "Could not open serial device %s: %s", device, strerror (errno)); close (priv->fd); @@ -817,7 +817,7 @@ mm_serial_port_close (MMSerialPort *self) priv->flash_id = 0; } - ioctl (priv->fd, TCSETA, &priv->old_t); + tcsetattr (priv->fd, TCSANOW, &priv->old_t); close (priv->fd); priv->fd = -1; } |