aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-serial-port.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index b116997e..70e33672 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -745,6 +745,7 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
char *devfile;
const char *device;
struct serial_struct sinfo;
+ GTimeVal tv_start, tv_end;
g_return_val_if_fail (MM_IS_SERIAL_PORT (self), FALSE);
@@ -759,6 +760,8 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
mm_info ("(%s) opening serial port...", device);
+ g_get_current_time (&tv_start);
+
/* Only open a new file descriptor if we weren't given one already */
if (priv->fd < 0) {
devfile = g_strdup_printf ("/dev/%s", device);
@@ -807,6 +810,11 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
ioctl (priv->fd, TIOCSSERIAL, &sinfo);
}
+ g_get_current_time (&tv_end);
+
+ if (tv_end.tv_sec - tv_start.tv_sec > 7)
+ mm_warn ("(%s): open blocked by driver for more than 7 seconds!", device);
+
priv->channel = g_io_channel_unix_new (priv->fd);
g_io_channel_set_encoding (priv->channel, NULL, NULL);
priv->watch_id = g_io_add_watch (priv->channel,
@@ -896,8 +904,8 @@ mm_serial_port_close (MMSerialPort *self)
* that data to send before giving up and returning from close().
* Log that. See GNOME bug #630670 for more details.
*/
- if (tv_end.tv_sec - tv_start.tv_sec > 20)
- mm_warn ("(%s): close blocked by driver for more than 20 seconds!", device);
+ if (tv_end.tv_sec - tv_start.tv_sec > 7)
+ mm_warn ("(%s): close blocked by driver for more than 7 seconds!", device);
}
/* Clear the command queue */