plugin: renamed custom-init' property to custom-at-probe'

The `custom-at-probe' property is just to modify the way we check for AT port
support.
This commit is contained in:
Aleksander Morgado
2012-08-06 20:06:46 +02:00
parent 89b3c01328
commit 9b0f6c83f2
6 changed files with 47 additions and 74 deletions
+11 -11
View File
@@ -60,7 +60,7 @@ struct _MMPluginPrivate {
gboolean at;
gboolean single_at;
gboolean qcdm;
MMPortProbeAtCommand *custom_init;
MMPortProbeAtCommand *custom_at_probe;
guint64 send_delay;
};
@@ -77,7 +77,7 @@ enum {
PROP_ALLOWED_AT,
PROP_ALLOWED_SINGLE_AT,
PROP_ALLOWED_QCDM,
PROP_CUSTOM_INIT,
PROP_CUSTOM_AT_PROBE,
PROP_SEND_DELAY,
LAST_PROP
};
@@ -524,7 +524,7 @@ mm_plugin_supports_port (MMPlugin *self,
mm_port_probe_run (probe,
ctx->flags,
self->priv->send_delay,
self->priv->custom_init,
self->priv->custom_at_probe,
(GAsyncReadyCallback)port_probe_run_ready,
ctx);
@@ -646,9 +646,9 @@ set_property (GObject *object,
/* Construct only */
self->priv->qcdm = g_value_get_boolean (value);
break;
case PROP_CUSTOM_INIT:
case PROP_CUSTOM_AT_PROBE:
/* Construct only */
self->priv->custom_init = g_value_dup_boxed (value);
self->priv->custom_at_probe = g_value_dup_boxed (value);
break;
case PROP_SEND_DELAY:
/* Construct only */
@@ -702,8 +702,8 @@ get_property (GObject *object,
case PROP_ALLOWED_UDEV_TAGS:
g_value_set_boxed (value, self->priv->udev_tags);
break;
case PROP_CUSTOM_INIT:
g_value_set_boxed (value, self->priv->custom_init);
case PROP_CUSTOM_AT_PROBE:
g_value_set_boxed (value, self->priv->custom_at_probe);
break;
case PROP_SEND_DELAY:
g_value_set_uint64 (value, self->priv->send_delay);
@@ -833,10 +833,10 @@ mm_plugin_class_init (MMPluginClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(object_class, PROP_CUSTOM_INIT,
g_param_spec_boxed (MM_PLUGIN_CUSTOM_INIT,
"Custom initialization",
"List of custom initializations this plugin needs, "
(object_class, PROP_CUSTOM_AT_PROBE,
g_param_spec_boxed (MM_PLUGIN_CUSTOM_AT_PROBE,
"Custom AT Probe",
"Custom set of commands to probe for AT support, "
"should be an array of MMPortProbeAtCommand structs "
"finished with 'NULL'",
MM_TYPE_POINTER_ARRAY,
+1 -1
View File
@@ -48,7 +48,7 @@
#define MM_PLUGIN_ALLOWED_AT "allowed-at"
#define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at"
#define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm"
#define MM_PLUGIN_CUSTOM_INIT "custom-init"
#define MM_PLUGIN_CUSTOM_AT_PROBE "custom-at-probe"
#define MM_PLUGIN_SEND_DELAY "send-delay"
#define MM_PLUGIN_SORT_LAST "sort-last"
+10 -29
View File
@@ -37,7 +37,6 @@
/*
* Steps and flow of the Probing process:
* ----> AT Serial Open
* |----> Custom Init
* |----> AT?
* |----> Vendor
* |----> Product
@@ -69,8 +68,8 @@ typedef struct {
guint64 at_send_delay;
/* Number of times we tried to open the AT port */
guint at_open_tries;
/* Custom initialization commands for the AT port */
const MMPortProbeAtCommand *at_custom_init;
/* Custom commands to look for AT support */
const MMPortProbeAtCommand *at_custom_probe;
/* Current group of AT commands to be sent */
const MMPortProbeAtCommand *at_commands;
/* Current AT Result processor */
@@ -438,21 +437,6 @@ serial_probe_at_result_processor (MMPortProbe *self,
mm_port_probe_set_result_at (self, FALSE);
}
static void
serial_probe_at_custom_init_result_processor (MMPortProbe *self,
GVariant *result)
{
PortProbeRunTask *task = self->priv->task;
/* No result is really expected here, but we could get a boolean to indicate
* AT support */
if (result)
serial_probe_at_result_processor (self, result);
/* Reset so that it doesn't get scheduled again */
task->at_custom_init = NULL;
}
static void
serial_probe_at_parse_response (MMAtSerialPort *port,
GString *response,
@@ -589,18 +573,15 @@ serial_probe_schedule (MMPortProbe *self)
task->at_result_processor = NULL;
task->at_commands = NULL;
/* If we got some custom initialization commands requested, go on with them
* first. */
if (task->at_custom_init) {
task->at_result_processor = serial_probe_at_custom_init_result_processor;
task->at_commands = task->at_custom_init;
}
/* AT check requested and not already probed? */
else if ((task->flags & MM_PORT_PROBE_AT) &&
!(self->priv->flags & MM_PORT_PROBE_AT)) {
if ((task->flags & MM_PORT_PROBE_AT) &&
!(self->priv->flags & MM_PORT_PROBE_AT)) {
/* Prepare AT probing */
if (task->at_custom_probe)
task->at_commands = task->at_custom_probe;
else
task->at_commands = at_probing;
task->at_result_processor = serial_probe_at_result_processor;
task->at_commands = at_probing;
}
/* Vendor requested and not already probed? */
else if ((task->flags & MM_PORT_PROBE_AT_VENDOR) &&
@@ -851,7 +832,7 @@ void
mm_port_probe_run (MMPortProbe *self,
MMPortProbeFlag flags,
guint64 at_send_delay,
const MMPortProbeAtCommand *at_custom_init,
const MMPortProbeAtCommand *at_custom_probe,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -869,7 +850,7 @@ mm_port_probe_run (MMPortProbe *self,
task = g_new0 (PortProbeRunTask, 1);
task->at_send_delay = at_send_delay;
task->flags = MM_PORT_PROBE_NONE;
task->at_custom_init = at_custom_init;
task->at_custom_probe = at_custom_probe;
task->result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
+1 -1
View File
@@ -78,7 +78,7 @@ void mm_port_probe_set_result_qcdm (MMPortProbe *self,
void mm_port_probe_run (MMPortProbe *self,
MMPortProbeFlag flags,
guint64 at_send_delay,
const MMPortProbeAtCommand *at_custom_init,
const MMPortProbeAtCommand *at_custom_probe,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_port_probe_run_finish (MMPortProbe *self,