diff options
author | Dan Williams <dcbw@redhat.com> | 2010-03-09 11:44:25 -0800 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-03-09 11:44:25 -0800 |
commit | 81dc2dde459ca91a8fce3c19a3aec79734179dfa (patch) | |
tree | c5ded515f18d4c2a3e56ac033fcf881a7d2b62e5 /src | |
parent | fbf3efc1e3feac3acb340bbd70617a702b33a42c (diff) |
serial: default to XON/XOFF flow control
This seems to help with Huawei and ZTE devices which often
appeared to stop responding on either primary or secondary ports
at various times. We had this problem a long time ago, but it was
fixed then by always picking the right serial port via the USB
interface number (Huawei) or udev rules files (ZTE). Now that we're
using the second serial port more extensively the problem came
up again, so lets try to fix it for real.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-generic-gsm.c | 3 | ||||
-rw-r--r-- | src/mm-serial-port.c | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index 9b693096..8d013a52 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -698,6 +698,9 @@ mm_generic_gsm_enable_complete (MMGenericGsm *self, } } + /* Try to enable XON/XOFF flow control */ + mm_serial_port_queue_command (priv->primary, "+IFC=1,1", 3, NULL, NULL); + /* Get allowed mode */ if (MM_GENERIC_GSM_GET_CLASS (self)->get_allowed_mode) MM_GENERIC_GSM_GET_CLASS (self)->get_allowed_mode (self, get_allowed_mode_done, NULL); diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index 07010e1d..1d98a537 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c @@ -357,8 +357,14 @@ config_fd (MMSerialPort *self, GError **error) stbuf.c_cc[VTIME] = 0; stbuf.c_cc[VEOF] = 1; - stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB); - stbuf.c_cflag |= (speed | bits | CREAD | 0 | parity | stopbits); + /* Use software handshaking */ + stbuf.c_iflag |= (IXON | IXOFF | IXANY); + + /* Set up port speed and serial attributes; also ignore modem control + * lines since most drivers don't implement RTS/CTS anyway. + */ + stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | PARENB | CRTSCTS); + stbuf.c_cflag |= (speed | bits | CREAD | 0 | parity | stopbits | CLOCAL); if (ioctl (priv->fd, TCSETA, &stbuf) < 0) { g_set_error (error, |