Commit Graph

1351 Commits

Author SHA1 Message Date
Aleksander Morgado
c165f24514 ublox: implement current bands loading 2016-10-12 13:24:09 +02:00
Aleksander Morgado
09c9ca5749 ublox: new +UBANDSEL? response parser 2016-10-12 13:24:09 +02:00
Aleksander Morgado
4632836d40 ublox: implement supported bands loading 2016-10-12 13:24:09 +02:00
Aleksander Morgado
ca1b9cb686 ublox: use +UAUTHREQ to setup PDP context authentication 2016-10-12 13:24:08 +02:00
Aleksander Morgado
4c02fba819 ublox: implement PIN retry count loading 2016-10-12 13:24:08 +02:00
Aleksander Morgado
29517c99ba ublox: new +UPINCNT response parser 2016-10-12 13:24:08 +02:00
Aleksander Morgado
a561f6edf0 ublox: use +CEREG if LTE supported 2016-10-12 11:29:52 +02:00
Aleksander Morgado
7cb11f72cd ublox: implement current modes setting and modem power up/down/off/reset
Changing current allowed/preferred modes requires the device to be in low-power
mode, so we will make sure we return an error if any power operation is already
ongoing when a new one is requested.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
9d78f05cbd ublox: new +URAT=X command builder 2016-10-12 11:29:52 +02:00
Aleksander Morgado
5d2e89e712 ublox: implement power state loading 2016-10-12 11:29:52 +02:00
Aleksander Morgado
151d608eec ublox: new u-blox specific +CFUN? response parser 2016-10-12 11:29:52 +02:00
Aleksander Morgado
d7fdda2247 linktop: new Linktop specific +CFUN? response parser
We handle all known CFUN? response values in the new parser, and report an error
if an unknown value is found.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
74fd7da774 mbm: new MBM specific +CFUN? response parsers 2016-10-12 11:29:52 +02:00
Aleksander Morgado
b34f147ba2 ublox: implement current modes loading 2016-10-12 11:29:52 +02:00
Aleksander Morgado
bde9c4795a ublox: new +URAT? response parser 2016-10-12 11:29:52 +02:00
Aleksander Morgado
29ace8b120 ublox: implement supported modes loading
AT+URAT=? provides the format expected, but looks like it isn't implemented
differently for the different u-blox devices seen, so we need an additional
level of filtering which currently is applied per device model string.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
a4466e83b7 ublox: new +URAT=? response parser 2016-10-12 11:29:52 +02:00
Aleksander Morgado
37bd614212 broadband-modem: implement default connection monitoring logic
A default implementation to monitor the ongoing connection is provided in the
generic MMBroadbandModem, based on AT+CGACT? to check whether the PDP context
of the connection (identified by the cached cid) is active or not.

This commit also disables the connection monitoring logic in those plugins that
have custom connection methods.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
f2c2a6a05f novatel: subclass the connection monitoring logic
Instead of setting up a custom timeout source to poll the connection status, use
the generic logic in the base bearer object, and just re-implement the command
used to check the status.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
467b3c57f0 modem-helpers: new COPS? response parser
Split into two different actions the actual COPS? response parsing and the
operator name normalization process.

Also, allow parsing not only the operator string, but also the format, mode
and the optional access technology value.
2016-10-12 11:29:52 +02:00
Aleksander Morgado
30772ffc26 ublox: implement connection using the 2G/3G logic in router or bridge mode 2016-10-12 11:29:52 +02:00
Aleksander Morgado
81715ee591 ublox: new +UIPADDR=N response parser 2016-10-12 11:29:52 +02:00
Aleksander Morgado
bc07ec0835 ublox: new broadband bearer object 2016-10-12 11:29:52 +02:00
Aleksander Morgado
eade066d8a ublox: generate enum types for usb profile and networking mode 2016-10-12 11:29:51 +02:00
Aleksander Morgado
3b0ceabc5d ublox: preload networking mode and usb profile when creating a new bearer 2016-10-12 11:29:51 +02:00
Aleksander Morgado
9d2c2a75cc ublox: new 'AT+UBMCONF?' response parser 2016-10-12 11:29:51 +02:00
Aleksander Morgado
241b63304b ublox: new 'AT+UUSBCONF?' response parser 2016-10-12 11:29:51 +02:00
Aleksander Morgado
40f3725ef9 ublox: new broadband modem object 2016-10-12 11:29:51 +02:00
Aleksander Morgado
f22c088cee ublox: new plugin skeleton 2016-10-12 11:29:51 +02:00
Aleksander Morgado
d917525293 build: include telit helpers in TELIT_COMMON_LIBADD_FLAGS
The dell plugin needs them.

  ModemManager[727]: <warn>  [1476194360.614829] [mm-plugin-manager.c:1494] load_plugin():
    [plugin manager] could not load plugin '/usr/lib64/ModemManager/libmm-plugin-dell.so':
    /usr/lib64/ModemManager/libmm-plugin-dell.so: undefined symbol: mm_telit_get_band_flag

https://bugs.freedesktop.org/show_bug.cgi?id=98207

Reported-by: Lubomir Rintel <lkundrak@v3.sk>
2016-10-12 11:18:13 +02:00
Lubomir Rintel
5a43f90a48 plugins: only export useful symbols
This should avoid poluting the name space and also make module loading
faster.
2016-10-12 10:59:18 +02:00
Daniele Palmas
6f11ff10cd telit: fix supported and current bands query with GE910
GE910 is a 2g only modem and when queried for bands it returns
only a 2g set of bands:

--> 'AT#BND=?<CR>'
<-- '<CR><LF>#BND: (0-3)<CR><LF><CR><LF>OK<CR><LF>'

Current regex fails, since it considers the 3g bands block mandatory.

A similar problem happens for current bands.

This patch modifies the regular expressions for properly
supporting GE910 and updates tests.
2016-10-11 10:16:24 +02:00
Daniele Palmas
d5cfad49d8 telit: add GE910 #PORTCFG layouts
GE910 family supports #PORTCFG layouts different than HE910
family ones.

This patch properly tags GE910 ports according to Telit document
"GE910 Family Ports Arrangements, 1vv0301049"
2016-10-06 11:37:09 +02:00
Daniele Palmas
30bcf5605c telit: add udev rules for supporting GE910
This patch adds the udev rules for supporting GE910 (PID 0x22)
2016-10-06 11:37:02 +02:00
Dan Williams
14ccde2b5f huawei: handle some weird SYSCFG acquisition orders
<debug> (ttyUSB2): --> 'AT^SYSCFG?<CR>'
<debug> (ttyUSB2): <-- '<CR><LF>^SYSCFG:14,2,400380,1,2<CR><LF><CR><LF>OK<CR><LF>'
<warn>  couldn't load current allowed/preferred modes: 'No SYSCFG combination found matching the current one (14,2)'

14,2 means "WCDMA-only; acquire WCDMA then GSM" which is somewhat
non-sensical. The supported modes parsing doesn't generate this
combination because it doesn't really make sense, so current mode
matching failed. Just fix up the non-sensical acquisition order
to 0 (automatic).
2016-10-05 09:14:44 -05:00
Aleksander Morgado
58c955f5f2 core: allow building and running without udev
Instead of relying on the udev daemon and GUDev to manage the devices reported
by the kernel, we can now run ModemManager relying solely on the kernel events
reported via the new ReportKernelEvent() API. Therefore, the '--no-auto-scan'
option is implicit for the ModemManager daemon when udev is disabled in the
build.

Additionally, a new custom implementation of the kernel device object is
provided, which uses sysfs to load the properties and attributes required in
each kernel device, instead of using a GUdevDevice.

The udev rule files are kept in place, and a simple custom parser is provided
which preloads all rules in memory once and then applies them to the different
kernel objects reported via ReportKernelEvent(), e.g. to set port type hints.
A simple unit test setup is prepared to validate the udev rules during the
`check' Makefile target.
2016-09-29 15:43:05 +02:00
Aleksander Morgado
ae9ede926a core: use the kernel device object in the port object and the plugin interface
The mm_base_modem_grab_port() now receives a MMKernelDevice directly from the
plugin, which is then stored in the MMPort corresponding to the port.

This means that we have direct access to e.g. all properties set by udev rules
everywhere, and we don't need additional GUdevClient objects (e.g. like the one
used in the Huawei plugin to detect NDISDUP support during runtime).

For virtual ports (e.g. generated during unit tests), we have a new 'generic'
kernel device object which just provides the values from the kernel device
properties given during its creation.
2016-09-29 15:43:05 +02:00
Aleksander Morgado
aa4577dfb9 core: new kernel device object instead of an explicit GUdevDevice
Instead of relying constantly on GUdevDevice objects reported by GUdev, we now
use a new generic object (MMKernelDevice) for which we provide an initial GUdev
based backend.
2016-09-29 15:43:05 +02:00
Aleksander Morgado
1f813c4e96 core: allow identifying devices by a user-provided 'uid'
All ports of the same modem reported by the kernel will all be associated with
a common 'uid' (unique id), which uniquely identifies the physical device. This
logic was already in place, what we do now is avoid calling it  the 'sysfs
path' of the physical device, because we may not want to use that to identify
a device.

This logic now also enables the possibility of "naming" the modems in a unique
way by setting the "ID_MM_PHYSDEV_UID" property in the "usb_device" that owns
all the ports.

E.g. a custom device has 4 modems in 4 different USB ports. The device path of
each USB device will always be the same, so the naming rules could go like this:

    $ vim /usr/lib/udev/rules.d/78-mm-naming.rules

    ACTION!="add|change|move", GOTO="mm_naming_rules_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
    LABEL="mm_naming_rules_end"

Each of the modems found will have a unique UID retrieved from the previous list
of rules. Then, "mmcli" has also been updated to allow using the UID instead of
the modem DBus path or index, e.g.:

    $ sudo mmcli -m USB-MODEM-1
    /org/freedesktop/ModemManager1/Modem/0 (device id '988d83252c0598f670c2d69d5f41e077204a92fd')
      -------------------------
      Hardware |   manufacturer: 'ZTE CORPORATION'
               |          model: 'MF637'
               |       revision: 'BD_W7P673A3F3V1.0.0B04'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: '356516027657837'
      -------------------------
      System   |         device: 'USB-MODEM-1'
               |        drivers: 'option'
               |         plugin: 'ZTE'
               |   primary port: 'ttyUSB5'
               |          ports: 'ttyUSB5 (at)'
    ...

    $ sudo mmcli -m USB-MODEM-1 --enable
    ...
2016-09-29 15:41:21 +02:00
Aleksander Morgado
fe6f374af6 huawei: fix interface class/subclass/protocol matching
Commit a66871a287 introduced an additional
ATTRS{idVendor} match condition in the same rules matching by interface class,
subclass and protocol. We shouldn't be doing that because we cannot mix parent
attribute matchings from different parents.
2016-09-18 16:37:14 +02:00
Aleksander Morgado
07858461b8 dell,telit: set one tag per rule match 2016-09-18 15:51:32 +02:00
Aleksander Morgado
c7d8ac622a udev: fix tagging per interface number
Commit 7ff57f9808 introduced a change to try to
use ATTRS{bInterfaceNumber} as a common way to match by interface number, but
this logic is broken because all the rules that we use to match by interface
number (attribute in the interface device) also require matching by idVendor
and idProduct (attributes in the physdev device), and udev rules forbid matches
from more than one parent device at a time.

We could use ATTR{bInterfaceNumber} (instead of ATTRS) to tag the actual USB
interface device, but that would require a change in all the plugins to look for
the tag not in the TTY device, but in its parent.

So, recover the original behavior, where a hidden property is created containing
the first bInterfaceNumber found in the list of parent devices, and then run
the matches against idVendor and idProduct only if the hidden property is found
with the expected value.
2016-09-18 15:43:30 +02:00
Aleksander Morgado
aa0e108107 udev: fix SUBSYSTEMS and ATTRS{idVendor} checks
Rules with a single condition where a parent property is checked with != don't
work properly. E.g.:
  SUBSYSTEMS!="usb", GOTO="end"
or:
  ATTRS{idVendor}!="abcd", GOTO="end"

Instead, we can mix both those previous parent rules and match them:
  SUBSYSTEMS=="usb",ATTRS{idVendor}=="abcd", GOTO="next"
  GOTO="end"
  LABEL="next"
  # Apply rules here
  LABEL="end"

In this case both SUBSYSTEMS and ATTRS conditions apply to the parent usb_device
(idVendor attribute is only available in the usb_device), so they apply to all
ports of the same device.
2016-09-18 14:08:20 +02:00
Dan Williams
546d33db6c broadband-modem-huawei: fix missing return in unsolicited voice message enable 2016-09-08 11:29:00 -05:00
Dan Williams
03a6d969ab broadband-modem-huawei: implement Modem.Signal extended signal info interface
Implement the detailed signal info interface for some Huawei 3GPP modems
including those based on HiSilicon chipsets like the E3276.  Known not to
work on many Qualcomm-based Huawei modems like E392, E397, and E367 as
they don't support the ^HCSQ command, but they do support QMI and so
have access to the extended signal interface via QMI.
2016-08-31 09:43:32 -05:00
Aleksander Morgado
7fb366c41a core: use MM-specific logging methods always instead of the generic GLib ones 2016-08-15 13:14:47 +02:00
Carlo Lobrano
f670861939 telit: add support to SIM hot swap
MMBroadbandModemTelit:
 * added logic to set MMBroadbandModem's SIM_HOT_SWAP property to TRUE
 * added function to enable QSS unsolicited
 * added QSS unsolicited handler
2016-08-10 09:39:47 +02:00
Aleksander Morgado
764bfbce9d mtk,udev: single 'usb' subsystems check 2016-08-06 12:57:44 +02:00
Aleksander Morgado
1ca47e4b52 zte,udev: avoid making the rules tty-only, and simplify single vendor check
The rules were matched only against devices with an exact 'tty' subsystem, and
that means that we were not properly adding additional tags on e.g. wwan or
cdc-wdm devices.
2016-08-06 10:41:52 +02:00
Aleksander Morgado
e47e654d33 simtech,udev: simplify single vendor check 2016-08-06 10:41:52 +02:00