diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-30 23:49:11 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-20 16:26:55 +0200 |
commit | b8e5dbcaf45aa34423e066e2af669f9c87af9f6f (patch) | |
tree | 9e3a8ac22ec2579712300d8c3879ca66ff1e51c6 | |
parent | 058fd0256de7e374660088387f291df63880cdb4 (diff) |
novatel: flip secondary ports to AT mode during port setup
-rw-r--r-- | plugins/novatel/mm-broadband-modem-novatel.c | 23 | ||||
-rw-r--r-- | src/mm-base-modem-at.c | 17 | ||||
-rw-r--r-- | src/mm-base-modem-at.h | 9 |
3 files changed, 49 insertions, 0 deletions
diff --git a/plugins/novatel/mm-broadband-modem-novatel.c b/plugins/novatel/mm-broadband-modem-novatel.c index 7006bf64..e4e3e169 100644 --- a/plugins/novatel/mm-broadband-modem-novatel.c +++ b/plugins/novatel/mm-broadband-modem-novatel.c @@ -32,6 +32,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 * mm_broadband_modem_novatel_new (const gchar *device, @@ -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; } diff --git a/src/mm-base-modem-at.c b/src/mm-base-modem-at.c index 04a350f9..657d1df2 100644 --- a/src/mm-base-modem-at.c +++ b/src/mm-base-modem-at.c @@ -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 */ diff --git a/src/mm-base-modem-at.h b/src/mm-base-modem-at.h index fb98669d..a5d83bb3 100644 --- a/src/mm-base-modem-at.h +++ b/src/mm-base-modem-at.h @@ -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. */ |