iface-modem: close primary port during disable

This commit is contained in:
Aleksander Morgado
2012-03-15 14:14:27 +01:00
parent 589c6419d2
commit 8b1515b2a0
+12
View File
@@ -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);