diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-01-01 11:50:10 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-01-11 10:05:45 +0100 |
commit | e3db373be45464b8c14d4c38f23105aaa7354ba2 (patch) | |
tree | 392f00ac8261e71da5b758d5bfe6b161041675ab /plugins/wavecom | |
parent | 952d96234bf179f26ec757eed7325518445327f0 (diff) |
wavecom: no need to check if already powered up before powering up
This logic is now implemented by the parent broadband modem object.
Diffstat (limited to 'plugins/wavecom')
-rw-r--r-- | plugins/wavecom/mm-broadband-modem-wavecom.c | 74 |
1 files changed, 6 insertions, 68 deletions
diff --git a/plugins/wavecom/mm-broadband-modem-wavecom.c b/plugins/wavecom/mm-broadband-modem-wavecom.c index e6afb730..3011e725 100644 --- a/plugins/wavecom/mm-broadband-modem-wavecom.c +++ b/plugins/wavecom/mm-broadband-modem-wavecom.c @@ -1040,56 +1040,14 @@ modem_power_up_finish (MMIfaceModem *self, GAsyncResult *res, GError **error) { - return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); -} - -static void -full_functionality_status_ready (MMBaseModem *self, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - GError *error = NULL; - - if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error)) - g_simple_async_result_take_error (simple, error); - else - g_simple_async_result_set_op_res_gboolean (simple, TRUE); - g_simple_async_result_complete (simple); - g_object_unref (simple); + return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error); } static void -get_current_functionality_status_ready (MMBaseModem *self, - GAsyncResult *res, - GSimpleAsyncResult *simple) +modem_power_up (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) { - const gchar *response; - GError *error = NULL; - - response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); - if (!response) { - mm_warn ("Failed checking if power-up command is needed: '%s'. " - "Will assume it isn't.", - error->message); - g_error_free (error); - /* On error, just assume we don't need the power-up command */ - g_simple_async_result_set_op_res_gboolean (simple, TRUE); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - response = mm_strip_tag (response, "+CFUN:"); - if (response && *response == '1') { - /* If reported functionality status is '1', then we do not need to - * issue the power-up command. Otherwise, do it. */ - mm_dbg ("Already in full functionality status, skipping power-up command"); - g_simple_async_result_set_op_res_gboolean (simple, TRUE); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - mm_warn ("Not in full functionality status, power-up command is needed. " "Note that it may reboot the modem."); @@ -1100,28 +1058,8 @@ get_current_functionality_status_ready (MMBaseModem *self, "+CFUN=1,0", 3, FALSE, - (GAsyncReadyCallback)full_functionality_status_ready, - simple); -} - -static void -modem_power_up (MMIfaceModem *self, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *result; - - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - modem_power_up); - - mm_base_modem_at_command (MM_BASE_MODEM (self), - "+CFUN?", - 3, - FALSE, - (GAsyncReadyCallback)get_current_functionality_status_ready, - result); + callback, + user_data); } /*****************************************************************************/ |