diff options
author | Ben Chan <benchan@chromium.org> | 2013-07-05 11:09:54 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-07-08 08:46:21 +0200 |
commit | dd2b4672623919ddf7916234ce11fc6c15e959a7 (patch) | |
tree | 3a4fdddd2442927eabe3bb7f9dfdff56355f2988 | |
parent | f0490b4fffef6566bf01995489a6cc87ff5f4547 (diff) |
serial-port: warn if ioctl(TIOCSSERIAL) fails to set closing_wait
Prints out a warning if ioctl(TIOCSSERIAL) fails to set closing_wait to
none. This helps debug issues when a serial driver does not support or
properly handle closing_wait, which may cause closing of the serial port
to block.
-rw-r--r-- | src/mm-serial-port.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index f5d87747..0f81c7bf 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c @@ -937,7 +937,9 @@ mm_serial_port_open (MMSerialPort *self, GError **error) */ if (ioctl (priv->fd, TIOCGSERIAL, &sinfo) == 0) { sinfo.closing_wait = ASYNC_CLOSING_WAIT_NONE; - ioctl (priv->fd, TIOCSSERIAL, &sinfo); + if (ioctl (priv->fd, TIOCSSERIAL, &sinfo) < 0) + mm_warn ("(%s): couldn't set serial port closing_wait to none: %s", + device, g_strerror (errno)); } g_get_current_time (&tv_end); @@ -1027,7 +1029,9 @@ mm_serial_port_close (MMSerialPort *self) if (sinfo.closing_wait != ASYNC_CLOSING_WAIT_NONE) { mm_warn ("(%s): serial port closing_wait was reset!", device); sinfo.closing_wait = ASYNC_CLOSING_WAIT_NONE; - (void) ioctl (priv->fd, TIOCSSERIAL, &sinfo); + if (ioctl (priv->fd, TIOCSSERIAL, &sinfo) < 0) + mm_warn ("(%s): couldn't set serial port closing_wait to none: %s", + device, g_strerror (errno)); } } |