aboutsummaryrefslogtreecommitdiff
path: root/src/mm-plugin-base.h
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-04-26 19:41:30 -0500
committerDan Williams <dcbw@redhat.com>2011-04-26 19:43:40 -0500
commit0befde3ce9bec9167a331e921da1f3e3dddda5af (patch)
treeb020673f156053843ef66741b3303827608b4e36 /src/mm-plugin-base.h
parent0b757465ffe6108066d32312ab4e895c372c8f72 (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 'src/mm-plugin-base.h')
-rw-r--r--src/mm-plugin-base.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h
index 9633e962..bd07c147 100644
--- a/src/mm-plugin-base.h
+++ b/src/mm-plugin-base.h
@@ -56,8 +56,26 @@ typedef struct {
GType mm_plugin_base_supports_task_get_type (void);
-typedef guint32 (*MMBaseSupportsTaskCustomInitResultFunc) (GString* response,
- gpointer user_data);
+/*
+ * response: the response string from the modem, if no error occurred
+ * error: the error returned by the modem or serial stack, if any
+ * tries: number of times the custom init command has been sent to the modem
+ * out_fail: on return, TRUE means fail the probe and close the port
+ * out_level: if the custom init command has determined that the modem is
+ * supported, return the support level here, and probing will cease
+ *
+ * Function should return TRUE if the custom init command should be retried,
+ * FALSE if it should not. If FALSE is returned, generic probing will continue
+ * if out_fail == FALSE and out_level == 0, otherwise if out_fail == FALSE
+ * probing will stop, or if out_level > 0 the port will be claimed.
+ */
+typedef gboolean (*MMBaseSupportsTaskCustomInitResultFunc) (MMPluginBaseSupportsTask *task,
+ GString *response,
+ GError *error,
+ guint32 tries,
+ gboolean *out_fail,
+ guint32 *out_level,
+ gpointer user_data);
MMPlugin *mm_plugin_base_supports_task_get_plugin (MMPluginBaseSupportsTask *task);
@@ -75,8 +93,6 @@ void mm_plugin_base_supports_task_complete (MMPluginBaseSupportsTask *task,
void mm_plugin_base_supports_task_set_custom_init_command (MMPluginBaseSupportsTask *task,
const char *cmd,
guint32 delay_seconds,
- guint32 max_tries,
- gboolean fail_if_timeout,
MMBaseSupportsTaskCustomInitResultFunc callback,
gpointer callback_data);
@@ -113,15 +129,13 @@ struct _MMPluginBaseClass {
void (*cancel_task) (MMPluginBase *plugin,
MMPluginBaseSupportsTask *task);
+ /* Lets plugins read the probe response before the generic plugin processes it */
void (*handle_probe_response) (MMPluginBase *plugin,
MMPluginBaseSupportsTask *task,
const char *command,
const char *response,
const GError *error);
- void (*handle_custom_init_response) (MMPluginBaseSupportsTask *task,
- GString *response);
-
/* Signals */
void (*probe_result) (MMPluginBase *self,
MMPluginBaseSupportsTask *task,