Commit Graph

69 Commits

Author SHA1 Message Date
Aleksander Morgado
51ab292802 plugin: let vendor/product filter be complementary
So that a plugin can specify a full VID and a specific PID subset of another VID
as supported.
2015-02-16 17:30:38 +01:00
Aleksander Morgado
dc38332224 plugin: avoid segfault when port driver is unknown
Based on a patch from Bastiaan Jacques <bastiaan@bjacques.org>

https://bugzilla.redhat.com/show_bug.cgi?id=1177799
https://bugs.freedesktop.org/show_bug.cgi?id=88864
2015-01-29 12:23:31 +01:00
Aleksander Morgado
31f81725e6 plugin: allow to explicitly ignore any kind of port via udev
The new 'ID_MM_PORT_IGNORE' tag will tell ModemManager to fully avoid using a
given port.

Note that it is key to not only flag the port probe as ignored, but also to
fully ignore the ports in e.g. mm_port_probe_list_has_qmi_port() as those
methods will be used to decide which kind of modem object to create. We don't
want to create a QMI-based modem which may have all QMI ports blacklisted.
2014-09-05 09:54:55 +02:00
Aleksander Morgado
8450e563bb plugin: if no QMI or no MBIM still grab the WWAN ports, flagged as ignored
E.g. this would be the result when having ModemManager compiled without QMI
support, and a modem with 2 QMI/WWAN pairs:

    $ mmcli -m 2

    /org/freedesktop/ModemManager1/Modem/2 (device id '417e4dcff7f232b62cfe6c972e2099701848fd7f')
      -------------------------
      Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
               |          model: 'MC7304'
               |       revision: 'SWI9X15C_05.05.02.00 r19147 carmd-fwbuild1 2013/11/15 13:54:28'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: 'unknown'
      -------------------------
      System   |         device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7'
               |        drivers: 'qcserial, qmi_wwan'
               |         plugin: 'Gobi'
               |   primary port: 'ttyUSB8'
               |          ports: 'ttyUSB8 (at), wwp0s29u1u7i8 (unknown), ttyUSB6 (qcdm), wwp0s29u1u7i10 (unknown)'

The /dev/cdc-wdm ports don't even appear (as they were not even probed), but the
newly ignored WWAN ports do appear in the list, but flagged as UNKNOWN type
(instead of NET).
2014-09-05 09:16:11 +02:00
Aleksander Morgado
f203b1bf00 plugin: improve probing decision logic for QMI and MBIM
So, we may have modems with multiple /dev/cdc-wdm ports, like Ericsson modems,
where only 1 of them is MBIM. With the previous logic, we would probe all
/dev/cdc-wdm ports for MBIM as soon as one of the ports was handled by the
cdc_mbim driver. That is totally not optimal, as we are already know that they
are not MBIM (not handled by cdc_mbim).

Instead, fix the logic to just probe for MBIM or QMI if the actual driver
managing the port is MBIM or QMI.
2014-07-27 13:55:10 +02:00
Aleksander Morgado
7c347aa3ec port: store parent sysfs path in each MMPort 2014-06-23 18:12:27 +02:00
Aleksander Morgado
2d9d15f892 plugin: allow creating 'virtual' modems with 'virtual' ports 2014-02-13 13:41:41 +01:00
Aleksander Morgado
070f4938f3 plugin: allow probing non-tty AT ports 2014-02-13 13:40:58 +01:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado
0d1602bf0f ports: rename 'MMQcdmSerialPort' to 'MMPortSerialQcdm' 2014-02-13 13:39:57 +01:00
Aleksander Morgado
5e7fee1d11 build: use 'g_cclosure_marshal_generic' by default
Avoid custom marshalers, and just use libffi-based 'g_cclosure_marshal_generic'.
2013-11-20 15:17:09 +01:00
Aleksander Morgado
b09044bcb3 plugin: for non-AT ports, don't expect vendor/product string probing
When running the pre-probing VID/PID filters, the ports were not filtered out if
the plugin had configured post-probing vendor/product string filters. But, these
post-probing filters are only applicable to AT ports.

From now on, this logic will not be applied to non-serial ports. In other words,
pre-probing VID/PID filters applied to non-serial ports will always result in
the port being filtered out or being allowed, regardless of any additional
vendor/product string post-probing filter configured by the plugin.

https://bugzilla.gnome.org/show_bug.cgi?id=710437
2013-10-28 18:13:14 +01:00
Aleksander Morgado
6b379e525d plugin: limit cdc-wdm port probing types depending on the available drivers
We'll use the given device drivers as a hint of what we can or should probe.
2013-04-17 15:19:38 +02:00
Aleksander Morgado
cb45de048f plugin: allow plugins to require MBIM probing of cdc-wdm ports 2013-04-17 15:19:37 +02:00
ori inbar
633708b364 serial: add support to optionally send line-feed at the end of AT commands. 2013-03-28 20:15:58 +01:00
Aleksander Morgado
d6ac6508d9 plugin: explicitly request QMI probing
Plugins which may support QMI ports need to explicitly request QMI probing
in cdc-wdm devices. This should also avoid probing cdc-wdm ports when we know
that the plugin doesn't support them (e.g. with Ericsson MBM devices).

https://bugzilla.gnome.org/show_bug.cgi?id=696701
2013-03-28 17:33:08 +01:00
Aleksander Morgado
a18140e8ed plugin: avoid using uninitialized variable
Reported by: Jose Maria Gonzalez <jmgonzalezc@indra.es>
2013-02-21 11:15:37 +01:00
Aleksander Morgado
5b072b9198 plugin: plug memleak
A new reference to probe was acquired through mm_device_get_probe(), just unref it
when no longer needed. Note that mm_port_probe_run() will take its own reference
for as long as required to complete the operation.
2013-02-20 17:00:14 +01:00
Aleksander Morgado
688bb2cb3a plugin: plug memleaks
This is really just to have a nice valgrind/memcheck output report, no big deal
if they were never freed.
2013-02-20 16:48:41 +01:00
Aleksander Morgado
2267fb0480 plugin: plug memleaks 2013-02-20 09:59:20 +01:00
Ben Chan
e75dba639f core: add 'hotplugged' flag to indicate if modem is newly plugged in
This patch adds a 'hotplugged' flag to MMBaseModem to indicate if a
modem is newly plugged in. A plugin can use this information to
determine if, for example, the modem needs to be soft reset using the
ATZ command.

Dan Williams <dcbw@redhat.com> contributed the idea of implementation.
2013-01-18 11:27:51 +01:00
Aleksander Morgado
731812fe34 plugin: avoid QMI-managed net ports when compiling without QMI support 2012-12-27 13:51:28 +01:00
Aleksander Morgado
c8fcf7a91d plugin: re-run subsystems filter before grabbing the ports
Every port probing will have the Generic plugin as fallback, and due to some
other issues in other plugins (see ee099fcd), we need to allow overwriting the
suggested plugin from the Generic to a more specific one.

One of the drawbacks of this is that we're actually allowing the Generic plugin
to probe and accept the port, which means that the generic plugin may accept a
specific port type (e.g. QMI) while the specific plugin wouldn't. So, we will
now also run the subsystems filter before grabbing the specific port, in order
to really filter out those cases. We still keep the subsystems filter in
pre-probing, so that we build a better initial plugin list to probe.
2012-12-27 08:53:45 +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
49c19bf83e plugin: avoid unneeded vendor/product AT probing if already passed USB ID filter
Don't require vendor/product string probing if the plugin already had
vendor/product ID filters and we actually passed those.
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
72db2a53ed plugin: defer task if supports check tells us to retry
Huawei modems will probe interface 0 always first; if we try to probe another
interface meanwhile the supports check will give us a MM_CORE_ERROR_RETRY error,
indicating that we need to defer the probing of the port.
2012-09-04 10:21:44 +02:00
Aleksander Morgado
1e5b00e33b plugin: let plugins decide if they want echo removal during AT probing
This is the port to git master of the following patch:

commit 21e66dfa1774ac2ee037ac8b6e8bb4d71a6f7931
Author: Dan Williams <dcbw@redhat.com>
Date:   Thu Aug 23 21:13:35 2012 -0500

    core: add function to open probe ports without removing echo

    Some devices (Sierra GSM ones) return stuff we need but don't
    bother to prefix it with <CR><LF>, so we need to optionally turn
    off the echo removal at probe time.
2012-08-31 09:20:43 +02:00
Aleksander Morgado
494a70a8ff core: handle the 'usb'->'usbmisc' subsystem rename in the kernel
We'll try to cope with getting devices being reported in either 'usb' or
'usbmisc', trying to avoid the need of checking kernel version during runtime.
2012-08-29 17:26:46 +02:00
Aleksander Morgado
db99f340c8 port-probe: launch QMI probing on cdc-wdm ports
Some devices may export cdc-wdm ports talking AT. We need to explicitly check
for QMI protocol support on the cdc-wdm ports before assuming they are QMI.
2012-08-29 17:14:47 +02:00
Aleksander Morgado
306b4eb509 core: allow grabbing QMI ports 2012-08-29 17:14:47 +02:00
Aleksander Morgado
0436b3e457 api,introspection: report list of drivers, not just one
Different ports of the same modem may get handled by different drivers. We
therefore need to provide a list of drivers (new `Modem.Drivers' property with
signature 'as') instead of just one (removed `Modem.Driver' property with
signature 's').

$ sudo mmcli -m 0 | grep drivers
           |        drivers: 'qcserial, qmi_wwan'
2012-08-24 13:34:51 +02:00
Aleksander Morgado
84d205c9be plugin: new filters for forbidden product IDs/strings
Plugins may specify that specific vendor & product IDs or strings are not
supported. This is useful when plugins need to specify that they support
all devices of a given vendor except for some specific ones.
2012-08-20 16:26:55 +02:00
Aleksander Morgado
4e84cd241b plugin: fix icera filters when using the allowed product string filter 2012-08-20 16:26:55 +02:00
Aleksander Morgado
9512eda21d plugin: don't apply product ID filters if no vendor ID was retrieved 2012-08-20 16:26:55 +02:00
Aleksander Morgado
509ad94204 plugin: check if the current probe is the one with AT support before assuming it's not 2012-08-06 20:07:27 +02:00
Aleksander Morgado
edc9825788 plugin: let plugins request Icera support checks and Icera based filters 2012-08-06 20:07:27 +02:00
Aleksander Morgado
da0226708a plugin: abort probing when the port has been released from the device 2012-08-06 20:07:22 +02:00
Aleksander Morgado
ff8a962d99 port-probe: let us peek the `MMDevice' owning the probe from the probe itself 2012-08-06 20:06:47 +02:00
Aleksander Morgado
b64f52cddc plugin: if no grab_port() method given, use the default one 2012-08-06 20:06:46 +02:00
Aleksander Morgado
bfc3cb27e1 device,plugin: let the MMPlugin' API know about MMDevice' 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
624a1e9087 plugin: remove obsolete comment 2012-08-06 20:06:46 +02:00
Aleksander Morgado
6e3d90e2a4 plugin: new `MM_PLUGIN_CUSTOM_INIT' property
We let plugins execute some custom initialization in the ports, specified by
a `MMAsyncMethod'.
2012-08-06 20:06:46 +02:00
Aleksander Morgado
f5fdf946c9 plugin: new `MM_PLUGIN_FORBIDDEN_DRIVERS' property
It allows plugins to specify whether they cannot support ports handled by
specific drivers.
2012-08-06 20:06:46 +02:00
Aleksander Morgado
9b0f6c83f2 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.
2012-08-06 20:06:46 +02:00
Aleksander Morgado
a8bc1909e4 plugin: setup a `priv' opaque pointer for the internal data
G_TYPE_INSTANCE_GET_PRIVATE() is really slow, so try to call it as less as
possible.
2012-08-06 20:06:46 +02:00
Aleksander Morgado
a315602166 plugin: no need to have our own `GUdevClient' 2012-08-06 20:06:46 +02:00
Aleksander Morgado
1e9c6772ce plugin: no need to take care of probing tasks ourselves 2012-08-06 20:06:45 +02:00
Aleksander Morgado
cf48d3daa7 plugin: don't provide an additional method to cancel the probing
We'll do it with a GCancellable.
2012-08-06 20:06:45 +02:00