From 29b7ac3ddb17619a101d8bdb989286e786c3b475 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 27 Mar 2011 16:01:10 -0500 Subject: [PATCH] samsung: fix up disconnect Two issues here, first we dont' need to chain up to the parent because it's not doing anything we need (it's mainly for PPP-based devices) and second we need to wait a bit for the disconnect command to complete by specifying a callback, otherwise the command may get discarded when the port is shut down afterward. --- plugins/mm-modem-samsung-gsm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/mm-modem-samsung-gsm.c b/plugins/mm-modem-samsung-gsm.c index effd0f75..6566b0fe 100755 --- a/plugins/mm-modem-samsung-gsm.c +++ b/plugins/mm-modem-samsung-gsm.c @@ -672,24 +672,33 @@ do_connect (MMModem *modem, Samsung_call_control (MM_MODEM_SAMSUNG_GSM (info->modem), FALSE, old_context_clear_done, info); } +static void +disconnect_ipdpact_done (MMAtSerialPort *port, + GString *response, + GError *error, + gpointer user_data) +{ + mm_callback_info_schedule ((MMCallbackInfo *) user_data); +} + static void do_disconnect (MMGenericGsm *gsm, gint cid, MMModemFn callback, gpointer user_data) { + MMCallbackInfo *info; MMAtSerialPort *primary; char *command; + info = mm_callback_info_new (MM_MODEM (gsm), callback, user_data); + primary = mm_generic_gsm_get_at_port (gsm, MM_PORT_TYPE_PRIMARY); g_assert (primary); command = g_strdup_printf ("AT%%IPDPACT=%d,0", cid); - - mm_at_serial_port_queue_command (primary, command, 3, NULL, NULL); + mm_at_serial_port_queue_command (primary, command, 3, disconnect_ipdpact_done, info); g_free (command); - - MM_GENERIC_GSM_CLASS (mm_modem_samsung_gsm_parent_class)->do_disconnect (gsm, cid, callback, user_data); } static void