novatel: flip secondary ports to AT mode during port setup

This commit is contained in:
Aleksander Morgado
2012-07-30 23:49:11 +02:00
parent 058fd0256d
commit b8e5dbcaf4
3 changed files with 49 additions and 0 deletions

View File

@@ -31,6 +31,26 @@
G_DEFINE_TYPE (MMBroadbandModemNovatel, mm_broadband_modem_novatel, MM_TYPE_BROADBAND_MODEM);
/*****************************************************************************/
/* Setup ports (Broadband modem class) */
static const MMBaseModemAtCommand nwdmat_sequence[] = {
{ "$NWDMAT=1", 3, FALSE, mm_base_modem_response_processor_continue_on_error },
{ "$NWDMAT=1", 3, FALSE, mm_base_modem_response_processor_continue_on_error },
{ "$NWDMAT=1", 3, FALSE, NULL },
{ NULL }
};
static void
setup_ports (MMBroadbandModem *self)
{
/* Call parent's setup ports first always */
MM_BROADBAND_MODEM_CLASS (mm_broadband_modem_novatel_parent_class)->setup_ports (self);
/* Flip secondary ports to AT mode */
mm_base_modem_at_sequence (MM_BASE_MODEM (self), nwdmat_sequence, NULL, NULL, NULL, NULL);
}
/*****************************************************************************/
MMBroadbandModemNovatel *
@@ -57,4 +77,7 @@ mm_broadband_modem_novatel_init (MMBroadbandModemNovatel *self)
static void
mm_broadband_modem_novatel_class_init (MMBroadbandModemNovatelClass *klass)
{
MMBroadbandModemClass *broadband_modem_class = MM_BROADBAND_MODEM_CLASS (klass);
broadband_modem_class->setup_ports = setup_ports;
}

View File

@@ -397,6 +397,23 @@ mm_base_modem_response_processor_no_result_continue (MMBaseModem *self,
return FALSE;
}
gboolean
mm_base_modem_response_processor_continue_on_error (MMBaseModem *self,
gpointer none,
const gchar *command,
const gchar *response,
gboolean last_command,
const GError *error,
GVariant **result,
GError **result_error)
{
if (error)
return FALSE;
*result = NULL;
return TRUE;
}
/*****************************************************************************/
/* Single AT command handling */

View File

@@ -120,6 +120,15 @@ gboolean mm_base_modem_response_processor_no_result_continue (MMBaseModem *self,
const GError *error,
GVariant **result,
GError **result_error);
/* If error, continue sequence, otherwise finish it */
gboolean mm_base_modem_response_processor_continue_on_error (MMBaseModem *self,
gpointer none,
const gchar *command,
const gchar *response,
gboolean last_command,
const GError *error,
GVariant **result,
GError **result_error);
/* Generic AT command handling, using the best AT port available and without
* explicit cancellations. */