aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-11-25 15:14:27 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:27 +0100
commit8b1515b2a0e75e98a7938052a6b754890a684862 (patch)
tree4c5564a008f1fabf801c685b1fbfac820a329dc9
parent589c6419d2d247e53a50d3bd8d96be5b9d51fea3 (diff)
iface-modem: close primary port during disable
-rw-r--r--src/mm-iface-modem.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index f0d5b18f..cfc2a9dd 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -756,6 +756,7 @@ typedef enum {
DISABLING_STEP_FIRST,
DISABLING_STEP_FLASH_PORT,
DISABLING_STEP_MODEM_POWER_DOWN,
+ DISABLING_STEP_CLOSE_PORT,
DISABLING_STEP_LAST
} DisablingStep;
@@ -908,6 +909,17 @@ interface_disabling_step (DisablingContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case DISABLING_STEP_CLOSE_PORT:
+ /* While the modem is enabled ports are kept open, so we need to close
+ * them when the modem gets disabled. As this (should) be the last
+ * closing in order to get it really closed (open count = 1), it should
+ * be safe to check whether they are really open before trying to close.
+ */
+ if (mm_serial_port_is_open (MM_SERIAL_PORT (ctx->primary)))
+ mm_serial_port_close (MM_SERIAL_PORT (ctx->primary));
+ /* Fall down to next step */
+ ctx->step++;
+
case DISABLING_STEP_LAST:
/* We are done without errors! */
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);