core: allow plugins to stop probing and not support a modem
Previously plugins could only stop probing, *or* stop probing and indicate support for a device. For the Alcatel X200/X060s debacle we need to stop probing and indicate that the plugin does not support the device at all.
This commit is contained in:
@@ -79,7 +79,7 @@ getportmode_response_cb (MMPluginBaseSupportsTask *task,
|
|||||||
GString *response,
|
GString *response,
|
||||||
GError *error,
|
GError *error,
|
||||||
guint32 tries,
|
guint32 tries,
|
||||||
gboolean *out_fail,
|
gboolean *out_stop,
|
||||||
guint32 *out_level,
|
guint32 *out_level,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ curc_response_cb (MMPluginBaseSupportsTask *task,
|
|||||||
GString *response,
|
GString *response,
|
||||||
GError *error,
|
GError *error,
|
||||||
guint32 tries,
|
guint32 tries,
|
||||||
gboolean *out_fail,
|
gboolean *out_stop,
|
||||||
guint32 *out_level,
|
guint32 *out_level,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
@@ -66,7 +66,7 @@ custom_init_response_cb (MMPluginBaseSupportsTask *task,
|
|||||||
GString *response,
|
GString *response,
|
||||||
GError *error,
|
GError *error,
|
||||||
guint32 tries,
|
guint32 tries,
|
||||||
gboolean *out_fail,
|
gboolean *out_stop,
|
||||||
guint32 *out_level,
|
guint32 *out_level,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
@@ -757,20 +757,13 @@ custom_init_response (MMAtSerialPort *port,
|
|||||||
MMPluginBaseSupportsTaskPrivate *task_priv = MM_PLUGIN_BASE_SUPPORTS_TASK_GET_PRIVATE (task);
|
MMPluginBaseSupportsTaskPrivate *task_priv = MM_PLUGIN_BASE_SUPPORTS_TASK_GET_PRIVATE (task);
|
||||||
CustomInit *custom = task_priv->cur_custom->data;
|
CustomInit *custom = task_priv->cur_custom->data;
|
||||||
gboolean retry = FALSE;
|
gboolean retry = FALSE;
|
||||||
gboolean fail = FALSE;
|
gboolean stop = FALSE;
|
||||||
guint32 level = 0;
|
guint32 level = 0;
|
||||||
|
|
||||||
custom->tries++;
|
custom->tries++;
|
||||||
retry = custom->callback (task, response, error, custom->tries, &fail, &level, custom->callback_data);
|
retry = custom->callback (task, response, error, custom->tries, &stop, &level, custom->callback_data);
|
||||||
|
|
||||||
if (fail) {
|
if (stop) {
|
||||||
/* Plugin said to fail the probe */
|
|
||||||
probe_complete (task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (level > 0) {
|
|
||||||
/* Plugin supports the modem */
|
|
||||||
task_priv->probed_caps = level;
|
task_priv->probed_caps = level;
|
||||||
probe_complete (task);
|
probe_complete (task);
|
||||||
return;
|
return;
|
||||||
|
@@ -60,20 +60,19 @@ GType mm_plugin_base_supports_task_get_type (void);
|
|||||||
* response: the response string from the modem, if no error occurred
|
* response: the response string from the modem, if no error occurred
|
||||||
* error: the error returned by the modem or serial stack, if any
|
* 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
|
* 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_stop: on return, TRUE means stop the probe and close the port
|
||||||
* out_level: if the custom init command has determined that the modem is
|
* out_level: on return, if out_stop is TRUE this should indicate the plugin's
|
||||||
* supported, return the support level here, and probing will cease
|
* support level for this modem
|
||||||
*
|
*
|
||||||
* Function should return TRUE if the custom init command should be retried,
|
* 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
|
* 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
|
* if out_stop == FALSE.
|
||||||
* probing will stop, or if out_level > 0 the port will be claimed.
|
|
||||||
*/
|
*/
|
||||||
typedef gboolean (*MMBaseSupportsTaskCustomInitResultFunc) (MMPluginBaseSupportsTask *task,
|
typedef gboolean (*MMBaseSupportsTaskCustomInitResultFunc) (MMPluginBaseSupportsTask *task,
|
||||||
GString *response,
|
GString *response,
|
||||||
GError *error,
|
GError *error,
|
||||||
guint32 tries,
|
guint32 tries,
|
||||||
gboolean *out_fail,
|
gboolean *out_stop,
|
||||||
guint32 *out_level,
|
guint32 *out_level,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user