diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-08 16:07:02 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:02 +0100 |
commit | a826e7c8ae11cd6a469bcb726fb0daf8f32cb5bf (patch) | |
tree | 838519ee1bd4afb01aa1a2cceb91ad9a29eba673 | |
parent | 7bc586258d9d63c05b7e103e79a11a31d70e0a57 (diff) |
cinterion: fix power down sequence
Need to complete the operation result at some point!
-rw-r--r-- | plugins/mm-broadband-modem-cinterion.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/plugins/mm-broadband-modem-cinterion.c b/plugins/mm-broadband-modem-cinterion.c index 0a80856b..d14c1a16 100644 --- a/plugins/mm-broadband-modem-cinterion.c +++ b/plugins/mm-broadband-modem-cinterion.c @@ -93,8 +93,27 @@ modem_power_down_finish (MMIfaceModem *self, GAsyncResult *res, GError **error) { + return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); +} + +static void +sleep_ready (MMBaseModem *self, + GAsyncResult *res, + GSimpleAsyncResult *operation_result) +{ + GError *error = NULL; + + mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); + /* Ignore errors */ - return TRUE; + if (error) { + mm_dbg ("Couldn't send power down command: '%s'", error->message); + g_error_free (error); + } + + g_simple_async_result_set_op_res_gboolean (operation_result, TRUE); + g_simple_async_result_complete_in_idle (operation_result); + g_object_unref (operation_result); } static void @@ -102,10 +121,21 @@ send_sleep_mode_command (MMBroadbandModemCinterion *self, GSimpleAsyncResult *operation_result) { if (self->priv->sleep_mode_cmd && - self->priv->sleep_mode_cmd[0]) - mm_base_modem_at_command_ignore_reply (MM_BASE_MODEM (self), - self->priv->sleep_mode_cmd, - 5); + self->priv->sleep_mode_cmd[0]) { + mm_base_modem_at_command (MM_BASE_MODEM (self), + self->priv->sleep_mode_cmd, + 5, + FALSE, + NULL, /* cancellable */ + (GAsyncReadyCallback)sleep_ready, + operation_result); + return; + } + + /* No default command; just finish without sending anything */ + g_simple_async_result_set_op_res_gboolean (operation_result, TRUE); + g_simple_async_result_complete_in_idle (operation_result); + g_object_unref (operation_result); } static void |