diff options
author | Tambet Ingo <tambet@gmail.com> | 2008-07-31 14:58:38 +0300 |
---|---|---|
committer | Tambet Ingo <tambet@gmail.com> | 2008-07-31 14:58:38 +0300 |
commit | 911b2b69260aee6450a16d406e5c79d97255c725 (patch) | |
tree | dec4fa075de3508156446f01db511d0d70051aeb | |
parent | f0a2dc606c20a65a45152127b0450ae31476adbf (diff) |
Handle serial device opening when it's already open.
-rw-r--r-- | src/mm-serial.c | 6 |
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; } |