Commit Graph

45 Commits

Author SHA1 Message Date
Aleksander Morgado
c9dc702eaa plugin-manager: fix defer-until-suggested probing tasks
If a task is marked as defer-until-suggested (e.g. a wwan port) and there was
already a 'best' plugin set in the parent device, use it to complete the
deferred task.

This may happen in e.g. MBIM devices if the WWAN port arrives later than the
already probed /dev/cdc-wdm character device.
2014-06-02 17:41:49 +02:00
Ben Chan
37b0402ee5 core: minor coding style fixes 2014-05-20 09:32:29 +02:00
Aleksander Morgado
247a945950 context: new '--test-plugin-dir' to allow specifying where the plugins are 2014-02-13 13:41:50 +01:00
Aleksander Morgado
abb88a5e0a plugin-manager: allow looking plugins by name 2014-02-13 13:41:36 +01:00
Aleksander Morgado
a9ebec949e plugin-manager: handle modems where only some ports report being Icera
Icera-based Nokia modems may reply correctly to the Icera probing only in some
AT ports, not in all. In order to handle this situation we override the final
plugin selected to be the Icera-based one if we find that the mismatched plugins
have the 'icera-allowed' and 'icera-forbidden' filters.

https://bugzilla.gnome.org/show_bug.cgi?id=703022
2013-06-26 11:07:40 +02:00
Aleksander Morgado
3cb639a6bb plugin-manager: handle race condition during probing
The specific case:
 * Modem exposes cdc-wdm port, Generic plugin probes it successfully as QMI.
 * Modem exposes new ports, including the wwan one. All ttys fail probing
   because they're neither AT nor QCDM (CnS in this case).
 * The wwan port ends up without a port being suggested and is not grabbed.

The root cause of this is that we do not propagate the suggested plugin to newly
added ports when it's the Generic one. If it wasn't the Generic one, the newly
added ports would start with the suggested one for probing.

Now, handle this by looking for the device-specified plugin when the port
probing ends without a specific port given. If there is such a device-specified
plugin accept the port, and otherwise, reject it.
2013-04-18 16:46:47 +02:00
Aleksander Morgado
8d74b11bd3 plugin-manager: cancelled tasks are no longer deferred-until-suggested
The deferred-until-suggested tasks specify tasks that are open/ongoing;
cancelled tasks shouldn't have this flag set.

https://bugzilla.gnome.org/show_bug.cgi?id=694603
2013-02-25 15:28:47 +01:00
Aleksander Morgado
f9583cb530 core: update logging levels of several messages
'info' log level, the default if none specified, included too many logs which
aren't that useful, to try to minimize the noise we produce by default.
2013-02-19 13:13:57 +01:00
Aleksander Morgado
37ddfe202e plugin-manager: log time required for device probing 2013-02-19 12:52:01 +01:00
Aleksander Morgado
ed2b32c682 plugin-manager: if minimum time consumed and all deferred tasks, abort probing
For the case where we just get a device with all net ports (i.e. all deferred
until result suggested), just abort the probing if the minimum probing time is
consumed.
2013-02-19 12:45:10 +01:00
Aleksander Morgado
8403a48b31 plugin-manager: new debug logs to help track probing issues 2013-01-11 12:20:57 +01:00
Aleksander Morgado
80b68ac0ae plugin-manager: initially never start with the Generic plugin suggested
The generic plugin should be a fallback, so when starting to probe the port,
never start with the Generic plugin first.
2012-12-27 12:44:50 +01:00
Aleksander Morgado
0ca6ae1b4b plugin-manager,plugin: run pre-probing filters early
For each port, we will construct the list of plugins to test with. In that list
we will include those plugins which are likely to handle a given port, so we
will skip all those which aren't.

To see if a plugin is likely or not, we will run the pre-probing filters before
adding them to the list, with the new `mm_plugin_discard_port_early()'. This
method will return one of these hints:

 * UNSUPPORTED: The plugin will not be able to handle this port.
 * MAYBE: The plugin may handle this port.
 * LIKELY: The plugin may (very likely) handle this port.
 * SUPPORTED: If any plugin should support the port, this is it.

Plugins reported to be 'likely' supporting the port will be probed before the
ones reported just as 'maybe'.

If a plugin reports 'supported' only that one and the fallback generic ones will
be tried.
2012-10-30 15:35:58 +01:00
Aleksander Morgado
e5b4b4d0e5 plugin-manager: use dispose() as we're holding plugin objects 2012-10-30 15:35:58 +01:00
Aleksander Morgado
3f255b628a plugin-manager,plugin: improve logging
Logging which are the reasons for a plugin to filter a given port really help
when trying to debug user issues. Some other general logging improvements also
done.
2012-10-30 15:35:58 +01:00
Aleksander Morgado
ee099fcd08 plugin-manager: never suggest the Generic plugin to others
Some modems, e.g. Huawei E367, will probe first the QMI port and for some reason
it doesn't report a proper VID/PID so the Generic plugin is the one finally
accepting that port. When we probe the AT ports afterwards we already got the
Generic plugin as suggestion, and we end up not grabbing the proper primary and
secondary ports as we skipped the AT^GETPORTMODE reply.

So, from now on the Generic plugin is never suggested to other probes; except
for the case where we need the suggestion to finish a probing task which was
'deferred until suggested'.

Also, the device-level plugin can now be overwritten, if and only if, the
previously set plugin was the Generic one.
2012-09-19 10:18:38 +02:00
Aleksander Morgado
4114eabaa3 plugin-manager: never suggest result to the probe which generated the suggestion 2012-08-30 00:33:30 +02:00
Aleksander Morgado
f6415a71b6 device: keep all unsupported ports in a separate list
Ports being marked as unsupported should not be passed to the plugin specific
create_modem() or grab_port() methods.
2012-08-06 20:07:50 +02:00
Aleksander Morgado
1811bb015c plugin-manager: relaunch probing when suggestion comes to deferred tasks
If a port support task was deferred until suggested, do not assume that the
suggested plugin actually supports the port, instead re-launch support check.

This covers the cases where a net port appears in a modem which only supports
AT ports (e.g. Nokia case).
2012-08-06 20:07:50 +02:00
Aleksander Morgado
bfc3cb27e1 device,plugin: let the MMPlugin' API know about MMDevice' 2012-08-06 20:06:46 +02:00
Aleksander Morgado
884aa7f2eb plugin-manager: simplify by iterating the list ourselves 2012-08-06 20:06:46 +02:00
Aleksander Morgado
9be646f274 plugin-manager: use a double-linked list for the plugin list 2012-08-06 20:06:46 +02:00
Aleksander Morgado
86f4923d7f plugin: new method to compare plugins
Instead of providing a method to get if a plugin is requesting to get sorted
last, we provide a way to comparing two plugins, compatible with the
GCompareFunc required in g_list_sort().
2012-08-06 20:06:46 +02:00
Aleksander Morgado
74dd724669 plugin: simplify interface by passing around the device and/or port objects 2012-08-06 20:06:45 +02:00
Aleksander Morgado
aaa487094e plugin-manager: simplify device/port probing logic
The plugin manager no longer needs to take care of keeping track of which probes
are being run and to which physical device they correspond, as the upper layer's
`MMDevice' already does this. This simplifies the internal logic quite a lot, as
we can now easily suggest plugins to the remaining port probes of the same
device directly.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
a1ffbdf1c8 plugin-manager: find port support is now only an internal operation 2012-08-06 20:06:45 +02:00
Aleksander Morgado
c1c3702f53 plugin-manager: remove unneeded methods
We no longer need to query the plugin manager whether we're checking support for
a specific port, as the ports are now grabbed only once in the MMDevice, and
therefore we ensure that supports check is launched only once in the
PluginManager for that specific port.

Also, we no longer need to query the plugin manager whether we're checking
support for a given device, as the logic to check when all ports of the device
are probed is now maintained internally.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
b35d6a65fa plugin-manager: define a minimum probing time of 2s
Effectively, we're now letting the kernel up to 2s to show all the ports of the
device, starting from the time where the first port is exposed.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
5b4abce64a plugin-manager: new method to check support for a given device and all its ports
The new `mm_plugin_manager_find_device_support()' will be an async method which
waits for ports to be added in the given `MMDevice'. As soon as all added ports
are probed, the device support check is considered finished.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
52ff02323d plugin-manager: avoid race when port deferred until suggested and suggestion already there
It may happen that we launch the supports task in the port AFTER having received
the suggestion.
2012-03-16 14:53:20 +01:00
Aleksander Morgado
d178fb1f09 plugin-manager: fix loop of deferred tasks when no best plugin found
If deferring tasks until result suggested, and we never got a suggestion, the
tasks may have been left deferred in loop forever. We now remove the defer
timeout in the case of waiting for suggestion, and ensure that we cancel tasks
if the last valid probing ended without best plugin found.
2012-03-15 14:14:46 +01:00
Aleksander Morgado
32a0c8fbb7 plugin-manager: new defer-until-suggested support check result handling
'net' ports will be supported as soon as there is another port reporting
successful support.
2012-03-15 14:14:45 +01:00
Aleksander Morgado
c58db4e015 core: start using our newly defined errors 2012-03-15 14:14:25 +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
95ade9c617 plugin-base: remove `MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS' status
Support checks are fully asynchronous and result is always reported when the
check is considered ready, so in-progress replies to
`mm_plugin_supports_port_finish()' don't make any sense.
2012-03-15 14:14:21 +01:00
Aleksander Morgado
2b20955489 plugin-base: don't report numeric support level in the [0-100] range
There is no single case where more than one plugin may end up wanting to support
a given port, and therefore there is no need to report the numeric support level
when reporting SUPPORTED.
2012-03-15 14:14:21 +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