sierra: fix ICCID requests

Depending on when the core requested the ICCID, the port may or may
not be open.  Stuff that needs an open serial port needs to make sure
that the port gets opened itself.
This commit is contained in:
Dan Williams
2010-10-25 21:00:26 -05:00
parent 1684d8b173
commit f93e24dda3

View File

@@ -293,26 +293,33 @@ get_sim_iccid_done (MMAtSerialPort *port,
} }
done: done:
mm_serial_port_close (MM_SERIAL_PORT (port));
mm_callback_info_schedule (info); mm_callback_info_schedule (info);
} }
static void static void
get_sim_iccid (MMGenericGsm *modem, get_sim_iccid (MMGenericGsm *modem,
MMModemStringFn callback, MMModemStringFn callback,
gpointer user_data) gpointer callback_data)
{ {
MMAtSerialPort *port; MMAtSerialPort *port;
MMCallbackInfo *info; MMCallbackInfo *info;
GError *error = NULL;
info = mm_callback_info_string_new (MM_MODEM (modem), callback, user_data); port = mm_generic_gsm_get_best_at_port (modem, &error);
if (!port)
goto error;
port = mm_generic_gsm_get_best_at_port (modem, &info->error); if (!mm_serial_port_open (MM_SERIAL_PORT (port), &error))
if (!port) { goto error;
mm_callback_info_schedule (info);
return;
}
info = mm_callback_info_string_new (MM_MODEM (modem), callback, callback_data);
mm_at_serial_port_queue_command (port, "!ICCID?", 3, get_sim_iccid_done, info); mm_at_serial_port_queue_command (port, "!ICCID?", 3, get_sim_iccid_done, info);
return;
error:
callback (MM_MODEM (modem), NULL, error, callback_data);
g_clear_error (&error);
} }
/*****************************************************************************/ /*****************************************************************************/