Commit Graph

1627 Commits

Author SHA1 Message Date
Aleksander Morgado
afd386738d plugin-base: improve the logic to check whether vendor or product probing needed
If the plugin does a Vendor ID check and it passes, it doesn't need Vendor
string probing.

If the plugin does a Vendor ID check and it fails:
  - If Vendor strings reported, it needs Vendor probing.
  - If Vendor strings not reported, fail as unsupported.

If the plugin does a Product ID check and it passes, it doesn't need Product
string probing.

If the plugin does a Product ID check and it fails:
  - If Product strings reported, it needs Product probing.
  - If Product strings not reported, fail as unsupported.
2012-03-15 14:14:21 +01:00
Aleksander Morgado
0646fc9d99 plugin-base: apply post-probing filtering
Once probing is finished, the plugin will check whether the port is supported
or not based on the following filters:
 - Capabilities
 - Reported Vendor string
 - Reported Product string
2012-03-15 14:14:21 +01:00
Aleksander Morgado
f92fbcc906 plugin-base: apply pre-probing filtering
Before any real probing is launched in the port, the plugin will check whether
it can skip the request based on the following filters:
 - Subsystems
 - Drivers
 - udev-reported Vendor ID
 - udev-reported Product ID
 - udev-reported Tags
2012-03-15 14:14:21 +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
7b687b4aae build: temporarily disable compilation of plugins 2012-03-15 14:14:21 +01:00
Aleksander Morgado
c112e19896 port-probe: properly handle Core errors
Fixes compilation of the Port Probe object.
2012-03-15 14:14:20 +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
Aleksander Morgado
27e1d97aca port-probe: new cache of Port Probe results
Whenever a plugin has probed for some information in a given port, that data
should be available for any other plugin wanting it during its own probing
process. This new cache of Port Probe results allows to easily retrieve the
already probed information.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
a3ace206b0 port-probe: add comment explaining the probing process flow 2012-03-15 14:14:20 +01:00
Aleksander Morgado
fa3fa38e0d port-probe: allow providing custom initialization AT commands 2012-03-15 14:14:20 +01:00
Aleksander Morgado
610bffc4e8 port-probe: enable probing for QCDM support 2012-03-15 14:14:20 +01:00
Aleksander Morgado
b73fb8e8f2 port-probe: enable probing for Product 2012-03-15 14:14:20 +01:00
Aleksander Morgado
1f9fd9e0be port-probe: enable probing for Vendor 2012-03-15 14:14:20 +01:00
Aleksander Morgado
05f8493ee7 port-probe: enable probing for Capabilities 2012-03-15 14:14:20 +01:00
Aleksander Morgado
6816c2e61d port-probe: enable probing for AT support
We will initially probe for AT support in the port.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
d7238403c4 port-probe: new type to define commands used during probing
The new `MMPortProbeAtCommand' type defines what command will be sent to the
serial AT port, and also a response processor method to parse the string
returned by the port.

The response processor gets as input either the text reply string or an error,
and it should give as output either a GValue (type depends on the probing kind
being done) or a new error (which will force the whole probing process to be
aborted.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
f7b1d99fa0 port-probe: allow cancelling the probing operation
The new `mm_port_probe_cancel()' will cancel the probing operation currently in
progress, if any. Note that we don't need to pass any argument to specify which
operation to cancel, as there can only be one.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
f227572d8f port-probe: setup an asynchronous method for port probing
The new method `mm_port_probe_run()' will run the whole probing process
asynchronously. Result of the probing can be later obtained with
`mm_port_probe_run_finish()'.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
1b84994feb port-probe: set port details when creating the object
Each port probe is always associated to one specific port.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
74145f5af7 port-probe: new MMPortProbe object 2012-03-15 14:14:20 +01:00
Aleksander Morgado
916cf5dd3e manager: integrate the Plugin Manager
All plugin handling and port support checks now done by the Plugin Manager.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
fad89b1d7e plugin-manager: new methods to check for ongoing port support operations
The new mm_plugin_manager_is_finding_port_support() allows to check whether the
Plugin Manager is looking for support in a specific port.

The new mm_plugin_manager_is_checking_device_support() allows to check whether
the Plugin Manager is looking for support in any port of a given device.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
5f2d0d474c plugin-manager: allow suggesting a plugin when launching support checks
The newly launched support check will start probing with the suggested plugin
right away.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
8fed241767 plugin-manager: propagate support check results to tasks in the same device
As soon as the first support check of a port in a given device finishes with a
valid best plugin and level > 0, propagate the result to other support tasks
corresponding to ports in the same physical device.

Previously, this propagation of support check results was only done once the
port was grabbed by a plugin, not just when the plugin reported that it
supported it. This change in behaviour isn't probably a big deal, as there
should not be any case where a plugin says it supports a port and then cannot
grab it.
2012-03-15 14:14:20 +01:00
Aleksander Morgado
0626de0879 plugin-manager: keep track of all launched support checks
We will keep a reference to each of the support checks currently in progress,
grouped by physical device path. The stored SupportsInfo structs as well as
the support check operations, are guaranteed to be kept valid as long as the
Plugin Manager exists. Or in other words, the Plugin Manager cannot be disposed
if there is still an ongoing supports check operation.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
1e32139707 plugin-manager: new method to look for best plugin supporting a given port
The new `mm_plugin_manager_find_port_support()' method requests the Plugin
Manager to iterate over the list of plugins internally handled, launching
supports task for the given port in each of them.

The method is fully asynchronous, and the result can be retrieved with
`mm_plugin_manager_find_port_support_finish()' once the operation is ready.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
7007825781 plugin-manager: ensure we always print paths in UTF-8
There is little chance of having a PLUGINDIR which is not UTF-8, but it may
happen, and g_log() won't like it.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
035be28730 plugin-manager: find and load plugins when the manager object is created
Ported the plugin finding and loading code from the MMManager object.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
51a8dc6ff3 plugin-manager: let it be initable
Looking for plugins and loading them will be done during the object creation,
so the operation may fail and we need to report it.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
03655fcf9f plugin-manager: new MMPluginManager object 2012-03-15 14:14:19 +01:00
Aleksander Morgado
62030debf2 plugin-base: rename 'cancel_supports_port' to 'supports_port_cancel'
We now have 'supports_port' (async method) and 'supports_port_finish' (to get
the result of the async method), so it makes sense to rename the method to
'supports_port_cancel'.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
dc30536456 plugin-base: rewrite port supports check as fully asynchronous
Before this change, supports check was either synchronous (e.g. in some
UNSUPPORTED cases) or asynchronous (when IN_PROGRESS was returned).

With this fix, the supports check requested to the plugin will always be
completed asynchronously; either directly in an idle before launching any real
probing operation, or once the probing operation is finished.

Therefore, it is not expected to get a IN_PROGRESS reply in
mm_plugin_supports_port_finish(), only UNSUPPORTED|SUPPORTED|DEFERRED.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
d47176a32c core: avoid using DBusGMethodInvocation in auth API
While porting to GDBus, use opaque pointers. This allows us to include either a
DBusGMethodInvocation or a GDBusMethodInvocation in the 'context' pointer.

Once fully ported to GDBus, we can safely change it back to make the context be
a GDBusMethodInvocation.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
1e79a2d292 build: install DBus service and data files for the new API 2012-03-15 14:14:19 +01:00
Aleksander Morgado
8d97538c72 build: setup all data (polkit, icon, dbus...) in the same `data' directory
Also fixed dist when not using polkit, the icon was no longer included in the
tarball.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
6b69605633 build: chain up new 0.6 API and link against libmm-common
Also removed the MMSerialError implementation from `src/mm-errors.[h|c]', as it
is now included in the new `include/ModemManager-errors.h' header file. All the
other enums and errors without clashing names will be ported afterwards to the
new base code.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
49bbaf8e31 build: disable autogeneration of the 0.5 API header file
But keep it around as a static file, while we do the migration to the new
interface.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
3b976c4399 docs: added new man page for the modem-manager daemon 2012-03-15 14:14:19 +01:00
Aleksander Morgado
09f40c8369 docs: setup generation of gtk-doc based DBus API documentation
It includes gdbus-codegen generated API documentation, plus the common Enums,
Flags and Errors, which will also be used in libmm-glib.
2012-03-15 14:14:19 +01:00
Aleksander Morgado
a57c3bcf36 docs: remove generation of previous DBus API documentation 2012-03-15 14:14:18 +01:00
Aleksander Morgado
23367c7186 libmm-common: include Errors type information
The code to handle the Errors type information is automatically built with
`glib-mkenums' and the new templates kept under `build-aux'.
2012-03-15 14:14:18 +01:00
Aleksander Morgado
0e9ed6e5fe libmm-common: include Enums and Flags type information
The code to handle the Enums and Flags type information is automatically built
with `glib-mkenums' and the new templates kept under `build-aux'.

Note: We currently skip the type information of `MMModemBand'. GFlagsValue
can hold only 32-bit types, and we're working with a 64-bit flag here.
See: https://bugzilla.gnome.org/show_bug.cgi?id=663054
2012-03-15 14:14:18 +01:00