Commit Graph

17 Commits

Author SHA1 Message Date
Aleksander Morgado
1c67d050cb api,introspection: merge 'AllowedModes' and 'SupportedMode' into 'CurrentModes'
We now have a single 'CurrentModes' property which contains both values in a
tuple with signature "(uu)".

Also, rename 'SetAllowedModes()' to 'SetCurrentModes()', and update the list of
arguments expected to have a single "(uu)" tuple.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
45ceba7692 api,introspection: 'SupportedModes' is now a list of possible combinations
Instead of just a mask of MMModemMode values, we now provide a list of the
allowed and preferred mode combinations supported by the modem. E.g.:

$> sudo mmcli -m 0
  -------------------------
  Modes    |      supported: 'allowed: 2g; preferred: none
           |                  allowed: 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: 2g
           |                  allowed: 2g, 3g; preferred: 3g
           |                  allowed: 4g; preferred: none
           |                  allowed: 2g, 3g, 4g; preferred: none'
2013-06-05 19:15:14 +02:00
Aleksander Morgado
c79d266e62 udev: update all udev rules to always match both VID/PID together
If the rules to tag specific USB interface numbers only apply on the PID, we'll
end up seeing that if the port has a parent with another PID, and that other
PID also has a rule, port will get tagged multiple times. Easier to see with an
example:

The ZTE MF637 (VID 0x19D2, PID 0x0121) had the following rules:

ATTRS{idProduct}=="0121", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1"
ATTRS{idProduct}=="0121", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1"

In our ZTE rules we also have some for the device with PID 0x0002, like:

ATTRS{idProduct}=="0002", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1"
ATTRS{idProduct}=="0002", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1"

And it seems that we can grab multiple PIDs from a single port, i.e. from the
parent objects in the hierarchy:

udevadm info -a -n /dev/ttyUSB4 | grep idProduct
    ATTRS{idProduct}=="0121"
    ATTRS{idProduct}=="0020"
    ATTRS{idProduct}=="0002"

Where that 0x0002 idProduct is not from the modem, but from the EHCI Host
Controller (with idVendor 0x1d6b in my case).

So... we end up seeing that both set of rules will apply to the ports, and we
misleadingly get:

    (ttyUSB3) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB2' flagged as primary
    (ttyUSB2) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB1' flagged as secondary
    (ttyUSB1) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB4' flagged as primary
    b_port(): (ttyUSB4) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB2 at (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB1 at (secondary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB2 data (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB0 qcdm

Which is wrong, as ttyUSB4 should have been our primary port, not ttyUSB2.

With this patch on, the rules apply only to the VID/PID pair, and we end up
getting what we really wanted:

    (ttyUSB3) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    (ttyUSB2) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB1' flagged as secondary
    (ttyUSB1) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    ZTE: AT port 'tty/ttyUSB4' flagged as primary
    b_port(): (ttyUSB4) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB4 at (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB1 at (secondary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB4 data (primary)
    (/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2) tty/ttyUSB0 qcdm

https://bugzilla.gnome.org/show_bug.cgi?id=694759
2013-02-26 23:22:00 +01:00
Aleksander Morgado
3f3950bd12 plugins: log about all port type hints received from udev 2013-02-26 21:02:12 +01:00
Aleksander Morgado
c250fa3797 libmm-glib: remove the `libmm-common.h' header
Both the ModemManager daemon and the mmcli will now include `libmm-glib.h' only.

We also handle two new special `_LIBMM_INSIDE_MM' and `LIBMM_INSIDE_MMCLI'
symbols, which if included before the `libmm-glib.h' library allow us to:

 * Don't include the libmm-glib high level API in the ModemManager daemon, as
   the object names would clash with those in the core.

 * Define some of the methods of helper objects to be included only if compiling
   ModemManager daemon or the mmcli.
2012-10-04 10:17:12 +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
a9075b0c09 port-probe: rename _get_port() to _peek_port() as there is no ownership transfer 2012-08-06 20:06:45 +02:00
Aleksander Morgado
e5e46f489e core: merge MMPluginBase' and MMPlugin'
There's no real point in maintaining a separate `MMPlugin' interface, as all the
plugins will inherit from `MMPluginBase', so just merge them and simplify
everything.
2012-08-06 20:06:45 +02:00
Aleksander Morgado
815693661c core: compile all ports before creating the modem object
Before this, we only exported the modem to DBus when all ports were organized,
in order to make sure that we select as primary port the one we really want and
not the first AT port grabbed. Given that to get all the ports organized we also
needed to wait to get all the ports grabbed, we can now also defer the creation
of the modem object until all the ports get grabbed. This allows us to create
different types of objects based on the ports available (e.g. we can now create
QMI-supported modem objects if we see a QMI port around).
2012-08-06 20:06:44 +02:00
Aleksander Morgado
e8bc2f41e7 simtech: implement custom allowed/preferred mode setting 2012-04-14 16:04:18 +02:00
Aleksander Morgado
9e89e88ce9 simtech: implement custom allowed/preferred mode loading 2012-04-14 16:04:18 +02:00
Aleksander Morgado
c9214bd54f simtech: implement custom access technology loading 2012-04-14 16:04:17 +02:00
Aleksander Morgado
281cada39d simtech: implement custom unsolicited events enabling/disabling 2012-04-14 16:04:17 +02:00
Aleksander Morgado
1cea1e5bbe simtech: implement custom unsolicited events setup/cleanup 2012-04-14 16:04:17 +02:00
Aleksander Morgado
8cd4b29fde simtech: new `MMBroadbandModemSimtech' object 2012-04-14 16:04:17 +02:00
Aleksander Morgado
43be521ef6 build: split includes for plugin specific udev rules
Let each plugin block include its own udev rules, instead of having them all
together at the end of the Makefile.
2012-04-14 16:04:17 +02:00
Aleksander Morgado
7183216d9d simtech: start porting the SimTech plugin 2012-04-14 16:04:17 +02:00