diff options
-rw-r--r-- | docs/reference/api/ModemManager-overview.xml | 50 | ||||
-rw-r--r-- | plugins/nokia/mm-plugin-nokia.c | 6 | ||||
-rw-r--r-- | src/mm-plugin.c | 22 | ||||
-rw-r--r-- | src/mm-plugin.h | 2 | ||||
-rw-r--r-- | src/mm-port-probe.c | 39 | ||||
-rw-r--r-- | src/mm-port-probe.h | 2 |
6 files changed, 47 insertions, 74 deletions
diff --git a/docs/reference/api/ModemManager-overview.xml b/docs/reference/api/ModemManager-overview.xml index dee7b5ae..f5661e6f 100644 --- a/docs/reference/api/ModemManager-overview.xml +++ b/docs/reference/api/ModemManager-overview.xml @@ -172,26 +172,6 @@ </para> <itemizedlist> <listitem> - <para><emphasis>Custom AT initialization</emphasis></para> - <para> - This property allows plugins to specify custom initialization sequences to - run in the modem before any additional probing happens. This helps in the cases - where modems require commands to, for example, shutdown unsolicited messages. - </para> - <para> - An additional benefit of the custom initialization through AT commands is that - it can already provide information on whether the port is AT or not. In other - words, a plugin with custom initialization sequence which reports that the - port being initialized is AT won't run the generic checks to see if the port is - AT or not. - </para> - <para> - This configuration is specified by the <type>MM_PLUGIN_CUSTOM_INIT</type> - property in the <structname>MMPlugin</structname> object provided - by the plugin. - </para> - </listitem> - <listitem> <para><emphasis>AT allowed</emphasis></para> <para> This boolean property allows plugins to specify that they expect and support @@ -217,6 +197,18 @@ </para> </listitem> <listitem> + <para><emphasis>Custom AT probing</emphasis></para> + <para> + This property allows plugins to specify custom commands to check whether a port + is AT or not. By default, the 'AT' command will be used if no custom one specified. + </para> + <para> + This configuration is specified by the <type>MM_PLUGIN_CUSTOM_AT_PROBE</type> + property in the <structname>MMPlugin</structname> object provided + by the plugin. + </para> + </listitem> + <listitem> <para><emphasis>QCDM allowed</emphasis></para> <para> This boolean property allows plugins to specify that they expect and support @@ -352,10 +344,10 @@ mm_plugin_create (void) <title>Probing setup for a plugin with custom initialization requirements</title> <programlisting> static gboolean -parse_init (const gchar *response, - const GError *error, - GValue *result, - GError **result_error) +parse_custom_at (const gchar *response, + const GError *error, + GValue *result, + GError **result_error) { if (error) { *result_error = g_error_copy (error); @@ -368,8 +360,8 @@ parse_init (const gchar *response, return TRUE; } -static const MMPortProbeAtCommand custom_init[] = { - { "ATE1 E0", parse_init }, +static const MMPortProbeAtCommand custom_at_probe[] = { + { "AT+SOMETHING", parse_custom_at }, { NULL } }; @@ -380,7 +372,7 @@ mm_plugin_create (void) static const guint16 vendor_ids[] = { 0xabcd, 0 }; return MM_PLUGIN ( - g_object_new (MM_TYPE_PLUGIN_NOKIA, + g_object_new (MM_TYPE_PLUGIN_EXAMPLE, MM_PLUGIN_NAME, "Example", /* Next items are pre-probing filters */ @@ -388,8 +380,8 @@ mm_plugin_create (void) MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids, /* Next items are probing sequence setup */ - MM_PLUGIN_CUSTOM_INIT, custom_init, - MM_PLUGIN_ALLOWED_AT, TRUE, + MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe, + MM_PLUGIN_ALLOWED_AT, TRUE, /* No post-probing filters */ NULL)); diff --git a/plugins/nokia/mm-plugin-nokia.c b/plugins/nokia/mm-plugin-nokia.c index 53480d10..101c7a62 100644 --- a/plugins/nokia/mm-plugin-nokia.c +++ b/plugins/nokia/mm-plugin-nokia.c @@ -30,9 +30,9 @@ int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION; /*****************************************************************************/ -/* CUSTOM INIT */ +/* Custom commands for AT probing */ -static const MMPortProbeAtCommand custom_init[] = { +static const MMPortProbeAtCommand custom_at_probe[] = { { "ATE1 E0", 3, mm_port_probe_response_processor_is_at }, { "ATE1 E0", 3, mm_port_probe_response_processor_is_at }, { "ATE1 E0", 3, mm_port_probe_response_processor_is_at }, @@ -104,7 +104,7 @@ mm_plugin_create (void) MM_PLUGIN_NAME, "Nokia", MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems, MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids, - MM_PLUGIN_CUSTOM_INIT, custom_init, + MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe, MM_PLUGIN_ALLOWED_SINGLE_AT, TRUE, /* only 1 AT port expected! */ NULL)); } diff --git a/src/mm-plugin.c b/src/mm-plugin.c index 8970dfc7..e50211bb 100644 --- a/src/mm-plugin.c +++ b/src/mm-plugin.c @@ -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, diff --git a/src/mm-plugin.h b/src/mm-plugin.h index f7b544df..bba5db26 100644 --- a/src/mm-plugin.h +++ b/src/mm-plugin.h @@ -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" diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c index 64db79cc..adcf8b87 100644 --- a/src/mm-port-probe.c +++ b/src/mm-port-probe.c @@ -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 */ @@ -439,21 +438,6 @@ serial_probe_at_result_processor (MMPortProbe *self, } 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, GError *error, @@ -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, diff --git a/src/mm-port-probe.h b/src/mm-port-probe.h index e952a198..282ce70d 100644 --- a/src/mm-port-probe.h +++ b/src/mm-port-probe.h @@ -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, |