diff options
author | Dan Williams <dcbw@redhat.com> | 2011-04-26 19:41:30 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-04-26 19:43:40 -0500 |
commit | 0befde3ce9bec9167a331e921da1f3e3dddda5af (patch) | |
tree | b020673f156053843ef66741b3303827608b4e36 /plugins/mm-plugin-zte.c | |
parent | 0b757465ffe6108066d32312ab4e895c372c8f72 (diff) |
plugins: simplify custom init commands
Instead of having two places that custom init stuff got processed
(a hook in the MMPluginBase class itself and a callback too) just
use a callback, and simplify it somewhat so that the plugin tracks
how many tries it cares about and what to do based on the response
or error.
Diffstat (limited to 'plugins/mm-plugin-zte.c')
-rw-r--r-- | plugins/mm-plugin-zte.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/mm-plugin-zte.c b/plugins/mm-plugin-zte.c index 6bffa150..81268cd5 100644 --- a/plugins/mm-plugin-zte.c +++ b/plugins/mm-plugin-zte.c @@ -61,6 +61,22 @@ probe_result (MMPluginBase *base, mm_plugin_base_supports_task_complete (task, get_level_for_capabilities (capabilities)); } +static gboolean +custom_init_response_cb (MMPluginBaseSupportsTask *task, + GString *response, + GError *error, + guint32 tries, + gboolean *out_fail, + guint32 *out_level, + gpointer user_data) +{ + if (error) + return tries <= 4 ? TRUE : FALSE; + + /* No error, assume success */ + return FALSE; +} + static MMPluginSupportsResult supports_port (MMPluginBase *base, MMModem *existing, @@ -113,7 +129,11 @@ supports_port (MMPluginBase *base, * 1235f71b20c92cded4abd976ccc5010649aae1a0 and * f38ad328acfdc6ce29dd1380602c546b064161ae for more details. */ - mm_plugin_base_supports_task_set_custom_init_command (task, "ATE0+CPMS?", 3, 4, FALSE, NULL, NULL); + mm_plugin_base_supports_task_set_custom_init_command (task, + "ATE0+CPMS?", + 3, + custom_init_response_cb, + NULL); if (mm_plugin_base_probe_port (base, task, 100000, NULL)) return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS; |