plugin: let plugins decide if they want echo removal during AT probing
This is the port to git master of the following patch: commit 21e66dfa1774ac2ee037ac8b6e8bb4d71a6f7931 Author: Dan Williams <dcbw@redhat.com> Date: Thu Aug 23 21:13:35 2012 -0500 core: add function to open probe ports without removing echo Some devices (Sierra GSM ones) return stuff we need but don't bother to prefix it with <CR><LF>, so we need to optionally turn off the echo removal at probe time.
This commit is contained in:
@@ -69,6 +69,7 @@ struct _MMPluginPrivate {
|
||||
MMPortProbeAtCommand *custom_at_probe;
|
||||
MMAsyncMethod *custom_init;
|
||||
guint64 send_delay;
|
||||
gboolean remove_echo;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -93,6 +94,7 @@ enum {
|
||||
PROP_CUSTOM_AT_PROBE,
|
||||
PROP_CUSTOM_INIT,
|
||||
PROP_SEND_DELAY,
|
||||
PROP_REMOVE_ECHO,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@@ -658,6 +660,7 @@ mm_plugin_supports_port (MMPlugin *self,
|
||||
mm_port_probe_run (probe,
|
||||
ctx->flags,
|
||||
self->priv->send_delay,
|
||||
self->priv->remove_echo,
|
||||
self->priv->custom_at_probe,
|
||||
self->priv->custom_init,
|
||||
(GAsyncReadyCallback)port_probe_run_ready,
|
||||
@@ -737,6 +740,7 @@ mm_plugin_init (MMPlugin *self)
|
||||
|
||||
/* Defaults */
|
||||
self->priv->send_delay = 100000;
|
||||
self->priv->remove_echo = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -828,6 +832,10 @@ set_property (GObject *object,
|
||||
/* Construct only */
|
||||
self->priv->send_delay = (guint64)g_value_get_uint64 (value);
|
||||
break;
|
||||
case PROP_REMOVE_ECHO:
|
||||
/* Construct only */
|
||||
self->priv->remove_echo = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -903,6 +911,9 @@ get_property (GObject *object,
|
||||
case PROP_SEND_DELAY:
|
||||
g_value_set_uint64 (value, self->priv->send_delay);
|
||||
break;
|
||||
case PROP_REMOVE_ECHO:
|
||||
g_value_set_boolean (value, self->priv->remove_echo);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -1104,4 +1115,12 @@ mm_plugin_class_init (MMPluginClass *klass)
|
||||
"in microseconds",
|
||||
0, G_MAXUINT64, 100000,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_REMOVE_ECHO,
|
||||
g_param_spec_boolean (MM_PLUGIN_REMOVE_ECHO,
|
||||
"Remove echo",
|
||||
"Remove echo out of the AT responses",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
Reference in New Issue
Block a user