diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-30 14:03:31 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-12-12 12:56:47 +0100 |
commit | dc9bbefbc083a328fad0b770d1e716e704c72c65 (patch) | |
tree | 1a4dc17a08e8add583225cddc30856071f822a19 /src | |
parent | f20922ba9d766bfbb198a3c2e41981b4d9473cfa (diff) |
icera,hso: don't wait to get connected if the primary port is removed
If the primary port is gone (e.g. when going to sleep) and we are just in the
middle of a connection attempt, we won't be able to receive any unsolicited
message regarding the status of the attempt. So, if we detect that the port is
forced to get closed, we'll just treat it as a connection failure.
http://code.google.com/p/chromium-os/issues/detail?id=35391
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-serial-port.c | 13 | ||||
-rw-r--r-- | src/mm-serial-port.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index 04cac88c..87f06e27 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c @@ -57,6 +57,7 @@ enum { enum { BUFFER_FULL, TIMED_OUT, + FORCED_CLOSE, LAST_SIGNAL }; @@ -1093,6 +1094,9 @@ mm_serial_port_close_force (MMSerialPort *self) /* Mark as having forced the close, so that we don't warn about incorrect * open counts */ priv->forced_close = TRUE; + + /* Notify about the forced close status */ + g_signal_emit (self, signals[FORCED_CLOSE], 0); } static void @@ -1670,4 +1674,13 @@ mm_serial_port_class_init (MMSerialPortClass *klass) NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); + + signals[FORCED_CLOSE] = + g_signal_new ("forced-close", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (MMSerialPortClass, forced_close), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } diff --git a/src/mm-serial-port.h b/src/mm-serial-port.h index 77db3219..31cd5a78 100644 --- a/src/mm-serial-port.h +++ b/src/mm-serial-port.h @@ -100,6 +100,7 @@ struct _MMSerialPortClass { /* Signals */ void (*buffer_full) (MMSerialPort *port, const GByteArray *buffer); void (*timed_out) (MMSerialPort *port, guint n_consecutive_replies); + void (*forced_close) (MMSerialPort *port); }; GType mm_serial_port_get_type (void); |