Commit Graph

35 Commits

Author SHA1 Message Date
Aleksander Morgado
c52762ea67 build: require gudev >= 147
Since udev 147 the gudev API is no longer marked as experimental, and therefore
`G_UDEV_API_IS_SUBJECT_TO_CHANGE' is no longer needed.
2012-03-16 14:53:25 +01:00
Aleksander Morgado
9fbddcb8a9 plugin-base: new property to specify that only one single AT port is expected
Will allow us to cancel other AT probings as soon as the first AT port is
grabbed.
2012-03-16 14:53:22 +01:00
Aleksander Morgado
86aa9df849 core: start using MMBroadbandModem objects
We chain up the Generic plugin created MMBroadbandModem objects within the
GDBusObjectManagerServer in MMManager, so that they get properly exported in
DBus.
2012-03-15 14:14:24 +01:00
Aleksander Morgado
4ad9374159 plugin-base: explicitly request to probe for AT capabilities 2012-03-15 14:14:24 +01:00
Aleksander Morgado
fa01e7a6d3 core: no need to check Capabilities during port probing
Capabilities checking is done during the Modem interface initialization.
2012-03-15 14:14:24 +01:00
Aleksander Morgado
a67d5dc1b8 plugin-base: make the plugin base use the new port probing mechanism
The previous 'MMPluginBaseSupportsTask' object is more or less equivalent to the
new `MMPortProbe' in terms of what information it contains. The main difference
being that the new `MMPortProbe' object handles internally the whole probing
flow as needed: only the needed probing sequences are done. For example, vendor
or product string probing will only be performed if a plugin requests it.
2012-03-15 14:14:21 +01:00
Aleksander Morgado
963eb873e1 plugin-base: new 'allowed-udev-tags' property
The plugins can set this property to filter support check requests by the
availability of a given udev tag in the port. The value given to the property
should be a NULL-terminated array of C strings, e.g.:

    const gchar *tags[] = { "ID_MM_X22X_TAGGED", NULL };
2012-03-15 14:14:20 +01:00
Aleksander Morgado
18238ed50e plugin-base: new 'allowed-drivers' property
The plugins can set this property to filter support check requests by physical
device driver. The value given to the property should be a NULL-terminated array
of C strings, e.g.:

    const gchar *drivers[] = { "qcserial", NULL };
2012-03-15 14:14:20 +01:00
Aleksander Morgado
24ebb00ed2 plugin-base: new 'allowed-qcdm' property
The plugins can set this boolean property to specify whether they can handle
QCDM ports, and therefore probing for them is needed.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
8f95a2d78d plugin-base: new 'send-delay' property
The plugins can set this property to provide a custom value for the send delay
used for characters sent to the AT port during probing.

The value given to the property should be a guint64 specifying the delay in
microseconds.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
a935cd9fb6 plugin-base: new 'allowed-capabilities' property
The plugins can set this property to filter support check requests by probed
capabilities.
The value given to the property should be a guint built as a mask of
MM_PORT_PROBE_CAPABILITY flags, e.g.:

    const guint capabilities = (MM_PORT_PROBE_CAPABILITY_GSM |
                                MM_PORT_PROBE_CAPABILITY_CDMA);
2012-03-15 14:14:20 +01:00
Aleksander Morgado
8ccb222978 plugin-base: new 'allowed-vendor-strings' and 'allowed-product-strings' properties
The plugins can set these properties to filter support check requests by
AT-reported Vendor string and Product string.

The value given to the properties should be a NULL-terminated array of strings,
e.g.,

    static const gchar *vendor_strings[] = { "cinterion" , NULL };
2012-03-15 14:14:20 +01:00
Aleksander Morgado
2d8fb51c6b plugin-base: new 'custom-init' property
The plugins can set this property to provide custom initialization commands that
should be issued to the modem before real probing starts.

The value given to the property should be an array of MMPortProbeAtCommand
variables finished with a last one exposing a NULL command, e.g.:

    static gboolean
    parse_init (const gchar *response,
                const GError *error,
                GValue *result,
                GError **result_error)
    {
        if (error)
            return FALSE;

        /* If we didn't get any error, it is an AT port */
        g_value_init (result, G_TYPE_BOOLEAN);
        g_value_set_boolean (result, TRUE);
        return TRUE;
    }

    static gboolean
    parse_init_last (const gchar *response,
                     const GError *error,
                     GValue *result,
                     GError **result_error)
    {
        g_value_init (result, G_TYPE_BOOLEAN);
        /* On last error, report as not being an AT port */
        g_value_set_boolean (result, error ? FALSE : TRUE);
        return TRUE;
    }

    static const MMPortProbeAtCommand custom_init[] = {
        { "ATE1 E0", parse_init },
        { "ATE1 E0", parse_init },
        { "ATE1 E0", parse_init_last },
        { NULL }
    };
2012-03-15 14:14:20 +01:00
Aleksander Morgado
806aabd22d plugin-base: new 'allowed-vendor-ids' and 'allowed-product-ids' properties
The plugins can set these properties to filter support check requests by
udev-reported Vendor ID and Product ID.

The value given to the properties should be a 0-terminated array of guint16s,
e.g.,

    static const guint16 vendor_ids[] = { 0x0421 , 0 };
2012-03-15 14:14:20 +01:00
Aleksander Morgado
59c783eb61 plugin-base: new 'allowed-subsystems' property
The plugins can set this property to filter support check requests by subsystem.
The value given to the property should be a NULL-terminated array of C strings,
e.g.:

    const gchar *subsystems[] = { "tty", NULL };
2012-03-15 14:14:20 +01:00
Dan Williams
4dad94d500 core: rework port grabbing and organization
Make port roles more flexible.  We have modems that do PPP
on interfaces other than the primary interface, and that
wasn't possible with the old code.  So clean up all that
logic and move the port organization code into the core
so we can reduce code in the plugins.

In the new world order, the plugins say whether the port
is a QCDM port, an AT port, or ignored.  If it's an AT
port the plugins get to tag it as primary, secondary, or
PPP, or any combination of the 3.  This allows for modems
where PPP should really be done on the secondary port
(Huawei E220, Sierra devices) so that the primary port
stays open for command and status.

Modem subclasses no longer get asked to handle port grabbing
themselves.  Instead, that's now done by the generic classes
(MMGenericCdma and MMGenericGsm) and the plugins are notified
when a port is grabbed so they can add unsolicited response
handlers for it.  After all ports are grabbed by the generic
classes, they get "organized", which assigns various ports
to the roles of PRIMARY, SECONDARY, DATA, and QCDM based
on specific rules and hints that the plugin provided (which
are expressed as MMAtPortFlags).  The plugins then have
a chance to perform fixups on the primary port if they choose.

The plugin code is responsible for determining the port
hints (ie MMAtPortFlags) at probe time, instead of having
a combination of the plugin and the modem class do the
job.  This simplifies things greatly for the plugins at
the expense of more complicated logic in the core.
2012-02-28 10:06:04 -06:00
Aleksander Morgado
670f560b3d iridium: add initial dummy plugin 2012-02-17 13:25:02 +01:00
Aleksander Morgado
28f64090df core: don't include private headers from glib
The "glib/gtypes.h" is now considered private, and only "glib.h" should be
included directly.
2011-10-24 21:44:30 +02:00
Dan Williams
8799f4da1f core: when probing mark ports as AT capable too
On a ZTE MF626, sometimes the aux port will respond only with
"ERROR" to probing commands (while the SIM is starting up) and
previously we'd lose the port because we were only looking for
valid probe responses.  But if the port returns ERROR or CME ERROR
etc we know it's an AT port and that we can use it once we've
gotten the type response (CDMA or GSM) from the main port.
2011-08-14 16:02:41 -05:00
Aleksander Morgado
f9f6d1dfdb plugins: propagate cached probing result to supports task
We need to ensure that the supports task always has the results of the probing,
no matter if the probing was just launched by the plugin grabbing the port, or
by a previous plugin. We do this during supports_port(), by propagating to the
supports task any possible previously cached probing results.
2011-06-06 17:21:47 +02:00
Aleksander Morgado
df0d9b480c plugin base: let plugins decide if they should be sorted last
Note that even if a plugin says it wants to be sorted last, the generic plugin
will always be the last one. Also, there is no order guaranteed between two
plugins that request to be sorted last.
2011-06-06 17:20:17 +02:00
Aleksander Morgado
5a2078a2a5 plugin base: include vendor ID and product ID retrieval during AT port probing
Port probing is extended to also query for Vendor ID and Product ID. This allows
plugins to check whether the reported IDs are expected, and thus we enable
plugins to handle modems connected via RS232 ports (where udev doesn't give any
vendor ID) or modems connected via a USB adapter (where udev gives the vendor ID
of the adapter).

Note that this effectively means that a plugin which expects these kind of modem
connections will end up always launching port probing as they won't only rely on
the vendor ID reported by udev.
2011-06-06 17:20:17 +02:00
Dan Williams
b122938ab5 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.
2011-06-05 20:58:13 -05:00
Dan Williams
1cf7a4da44 plugins: allow multiple custom init commands in sequence
Huawei will need this.
2011-04-26 23:44:56 -05:00
Dan Williams
0befde3ce9 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.
2011-04-26 19:43:40 -05:00
Dan Williams
ed5aefb3cb serial: allow plugins to specify probe-time send_delay
Let modems we know don't suck use a zero send-delay at probe time,
which greatly reduces time required to probe AT-compatible ports.
2011-04-08 16:19:36 -05:00
Thomas Bechtold
b3b1d5309a core: allow plugins to handle custom init responses 2011-03-11 20:25:22 -06:00
Dan Williams
df08f6a43f core: find the existing modem for a port in the manager 2010-03-30 15:03:35 -07:00
Dan Williams
720e38aec0 core: move physical device checking into the manager
It turns out that the manager needs to know about the physical
device so we can prevent multiple plugins from claiming ports on
the same modem.
2010-03-30 14:50:40 -07:00
Dan Williams
2e62a2e0a6 core: probe ports for QCDM capability too 2010-03-20 03:39:10 -07:00
Dan Williams
8d42094608 zte: handle unsolicited messages during probe
This implements the same fixes that NetworkManager's 0.7 branch
implemented in commits f38ad328acfdc6ce29dd1380602c546b064161ae and
1235f71b20c92cded4abd976ccc5010649aae1a0.  Many ZTE devices will
spam the port with messages about waiting voicemail/SMS which buffer
up and cause the device to eventually crash if not suppressed.
2009-12-16 15:26:05 -08:00
Dan Williams
853af00142 plugin-base: fix finding the physical device again
Don't mis-use udev's ID_BUS key.
2009-06-29 14:24:43 -04:00
Dan Williams
6077763d90 asynchronous and deferred port detection
Allow plugins to perform asynchronous port detection, and to defer port detection
until later.  This moves the prober bits into MMPluginBase so that all plugins
can take adavantage of it only when needed; the probing is not done at udev time.
Furthermore, plugins like Novatel can flip the secondary ports over the AT mode
through	deferred detection, by deferring the secondary ports until the main port
has been detected and AT$NWDMAT	has been sent.

This commit also finishes the port of the rest of the plugins (except mbm) over
to the new port detection methods and plugin API.
2009-06-28 14:05:05 -04:00
Dan Williams
05ab7b2a7c plugins: implement mm_plugin_base_get_device_ids()
We'll need it in more than one place, so make it generic.
2009-06-20 18:18:08 -04:00
Dan Williams
88bdb5d29a plugin: add a base class to handle modem tracking 2009-06-19 11:55:31 -04:00