aboutsummaryrefslogtreecommitdiff
path: root/plugins/mm-modem-mbm.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2009-09-08 17:31:54 -0700
committerDan Williams <dcbw@redhat.com>2009-09-08 17:34:04 -0700
commit14e5c52f78e7ad23b18b111e3271cbecad6acf3f (patch)
treeee6929c990c63139e4209a94f3e2d8c617547f4a /plugins/mm-modem-mbm.c
parent6cf01d2ab698d05eb58bffa7e85f41024f5c0546 (diff)
core: don't allow concurrent flashes on the same device
Previously, a few operations (like disable) could trigger a modem flash in parallel with another flash. That's wrong, don't allow that. At the same time, add in finer-grained error checking on serial port speed operations, and fix a GSM generic bug that would send the POWER_UP string on disable.
Diffstat (limited to 'plugins/mm-modem-mbm.c')
-rw-r--r--plugins/mm-modem-mbm.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
index 5a8aa2ef..3267402c 100644
--- a/plugins/mm-modem-mbm.c
+++ b/plugins/mm-modem-mbm.c
@@ -402,11 +402,17 @@ mbm_emrdy_done (MMSerialPort *port,
}
static void
-enable_flash_done (MMSerialPort *port, gpointer user_data)
+enable_flash_done (MMSerialPort *port, GError *error, gpointer user_data)
{
MMCallbackInfo *info = user_data;
MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
+ if (error) {
+ info->error = g_error_copy (error);
+ mm_callback_info_schedule (info);
+ return;
+ }
+
if (priv->have_emrdy) {
/* Modem is ready, no need to check EMRDY */
do_init (port, info);
@@ -427,8 +433,16 @@ disable_done (MMSerialPort *port,
}
static void
-disable_flash_done (MMSerialPort *port, gpointer user_data)
+disable_flash_done (MMSerialPort *port, GError *error, gpointer user_data)
{
+ MMCallbackInfo *info = (MMCallbackInfo *) user_data;
+
+ if (error) {
+ info->error = g_error_copy (error);
+ mm_callback_info_schedule (info);
+ return;
+ }
+
mm_serial_port_queue_command (port, "+CMER=0", 5, disable_done, user_data);
}
@@ -449,18 +463,20 @@ enable (MMModem *modem,
g_assert (primary);
if (do_enable) {
- if (mm_serial_port_open (primary, &info->error))
- mm_serial_port_flash (primary, 100, enable_flash_done, info);
-
- if (info->error)
+ if (!mm_serial_port_open (primary, &info->error)) {
+ g_assert (info->error);
mm_callback_info_schedule (info);
+ return;
+ }
+
+ mm_serial_port_flash (primary, 100, enable_flash_done, info);
} else {
mm_serial_port_queue_command (primary, "+CREG=0", 100, NULL, NULL);
mm_generic_gsm_pending_registration_stop (MM_GENERIC_GSM (modem));
if (mm_port_get_connected (MM_PORT (primary)))
mm_serial_port_flash (primary, 1000, disable_flash_done, info);
else
- disable_flash_done (primary, info);
+ disable_flash_done (primary, NULL, info);
}
}