aboutsummaryrefslogtreecommitdiff
path: root/src/mm-serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-serial.c')
-rw-r--r--src/mm-serial.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mm-serial.c b/src/mm-serial.c
index 0f267a21..29ac5161 100644
--- a/src/mm-serial.c
+++ b/src/mm-serial.c
@@ -295,7 +295,6 @@ mm_serial_set_pending (MMSerial *self,
G_PRIORITY_DEFAULT,
G_IO_IN | G_IO_ERR | G_IO_HUP,
callback, user_data, notify);
-
mm_serial_add_timeout (self, timeout);
return priv->pending_id;
@@ -355,6 +354,10 @@ mm_serial_open (MMSerial *self)
priv = MM_SERIAL_GET_PRIVATE (self);
+ if (priv->fd)
+ /* Already open */
+ return TRUE;
+
g_debug ("(%s) opening serial device...", priv->device);
priv->fd = open (priv->device, O_RDWR | O_EXCL | O_NONBLOCK | O_NOCTTY);
@@ -371,6 +374,7 @@ mm_serial_open (MMSerial *self)
if (!config_fd (self)) {
close (priv->fd);
+ priv->fd = 0;
return FALSE;
}