aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTambet Ingo <tambet@gmail.com>2008-09-18 12:33:25 +0300
committerTambet Ingo <tambet@gmail.com>2008-09-18 12:33:25 +0300
commit447bca91b00fb6be9bf572d7adaf2adc87036bfa (patch)
treeca6c988f651e35999118f98835240d038c0171fc /src
parent36acdcb70e5f7cf5c295010e89008ade51bc778d (diff)
Reduce the amount of power used to minimum when modem is disabled.
Diffstat (limited to 'src')
-rw-r--r--src/mm-generic-gsm.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index f12a5fdc..f7d87ef9 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -87,6 +87,20 @@ mm_generic_gsm_set_operator (MMGenericGsm *modem,
/*****************************************************************************/
static void
+enable_done (MMSerial *serial,
+ GString *response,
+ GError *error,
+ gpointer user_data)
+{
+ MMCallbackInfo *info = (MMCallbackInfo *) user_data;
+
+ if (error)
+ info->error = g_error_copy (error);
+
+ mm_callback_info_schedule (info);
+}
+
+static void
init_done (MMSerial *serial,
GString *response,
GError *error,
@@ -94,10 +108,11 @@ init_done (MMSerial *serial,
{
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
- if (error)
+ if (error) {
info->error = g_error_copy (error);
-
- mm_callback_info_schedule (info);
+ mm_callback_info_schedule (info);
+ } else
+ mm_serial_queue_command (serial, "+CFUN=1", 5, enable_done, user_data);
}
static void
@@ -107,13 +122,22 @@ enable_flash_done (MMSerial *serial, gpointer user_data)
}
static void
-disable_flash_done (MMSerial *serial, gpointer user_data)
+disable_done (MMSerial *serial,
+ GString *response,
+ GError *error,
+ gpointer user_data)
{
mm_serial_close (serial);
mm_callback_info_schedule ((MMCallbackInfo *) user_data);
}
static void
+disable_flash_done (MMSerial *serial, gpointer user_data)
+{
+ mm_serial_queue_command (serial, "+CFUN=0", 5, disable_done, user_data);
+}
+
+static void
enable (MMModem *modem,
gboolean enable,
MMModemFn callback,
@@ -126,10 +150,8 @@ enable (MMModem *modem,
if (!enable) {
if (mm_serial_is_connected (MM_SERIAL (modem)))
mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info);
- else {
- mm_serial_close (MM_SERIAL (modem));
- mm_callback_info_schedule (info);
- }
+ else
+ disable_flash_done (MM_SERIAL (modem), info);
} else {
if (mm_serial_open (MM_SERIAL (modem), &info->error))
mm_serial_flash (MM_SERIAL (modem), 100, enable_flash_done, info);