Commit Graph

1353 Commits

Author SHA1 Message Date
Ben Chan
031c753a00 novatel: obtain MMPortProbe from GTask source object
The MMPortProbe object is already referenced by the GTask object for
custom init. Instead of keeping another reference of MMPortProbe in the
CustomInitContext, this patch changes the code to simply obtain it from
the source object of GTask.

See https://lists.freedesktop.org/archives/modemmanager-devel/2017-April/004420.html
2017-04-07 10:31:10 -05:00
Dan Williams
8c04cc0367 telit: fix AT+SERVICE 3GPP2 access technology reporting
Looks like a C&P error from the AT#PSNT codepath; all the docs
I can find indicate that AT+SERVICE returns only an integer and
no commas:

<debug> (ttyUSB2): --> 'AT+SERVICE?<CR>'
<debug> (ttyUSB2): <-- '<CR><LF>+SERVICE: 3<CR><LF><CR><LF>OK<CR><LF>'
<debug> Couldn't refresh access technologies: 'Failed to parse +SERVICE response: '+SERVICE: 3''
2017-04-06 17:09:39 -05:00
Ben Chan
6542430588 novatel: port IMSI loading to use GTask 2017-04-06 20:31:39 +02:00
Ben Chan
1e05fd4df6 novatel: port custom init to use GTask 2017-04-06 20:30:08 +02:00
Ben Chan
2c4b061dda novatel-lte: revert to original plugin library name
Commit f9c63bfa0 "build,plugins: update build rules" accidentally
changed the Novatel LTE plugin from 'libmm-plugins-novatel-lte.so' to
'libmm-plugins-novatel_lte.so'. The name becomes inconsistent with other
plugin names.
2017-04-06 20:12:04 +02:00
Aleksander Morgado
fba49d8d00 broadband-modem: normalize also operator code
The operator code (MCCMNC) may also be given encoded in the current
charset (e.g. UCS2).

Based on a patch from Colin Helliwell <colin.helliwell@ln-systems.com>
2017-04-02 10:06:13 +02:00
Aleksander Morgado
f824602bdd modem-helpers: if operator not in UCS2, see if already valid UTF-8
The method doing the operator name normalization takes as input the
current configured modem charset. If this is UCS2, we will now just
assume this is a hint: the string may or may not come in hex/UCS2.

This logic makes the custom operator name loading in Huawei unneeded,
if the modem is configured in UCS2, we still properly process operator
names coming in plain ASCII.
2017-04-02 10:06:07 +02:00
Ben Chan
254f2e3412 plugins: remove explicit GDestroyNotify cast on g_free / g_object_unref
g_free and g_object_unref are in form of  `void (*)(gpointer)`, which
matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
g_free and g_object_unref is thus not needed.
2017-03-29 10:22:18 +02:00
Daniele Palmas
6de2d84af1 telit: support QMI and MBIM modems
Vendor specific plugins that support QMI or MBIM based devices need to
handle the creation of these modems themselves.

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

Original patch by Aleksander Morgado.
2017-03-28 11:06:55 +02:00
Aleksander Morgado
4c164287eb telit: don't require udev tags to bind devices
The vendor id/string based rules should already be enough to get the
telit plugin bind telit devices.

This simplifies support for future Telit devices, as we wouldn't need
any additional change in the plugin. It also helps when working with
RS232 devices as the user wouldn't need to add the explicit tag to get
the devices bound to this plugin.

https://bugs.freedesktop.org/show_bug.cgi?id=100373
2017-03-24 21:57:12 +01:00
Riccardo Vangelisti
dc01a30c2f huawei: ignore unsolicited message ^EONS 2017-03-24 17:52:47 +01:00
Aleksander Morgado
00fb9e98f6 kernel-device: device-specific properties in either port or physdev
There are 2 main types of udev properties: device-specific and
port-specific.

The port-specific properties are set independently per port (e.g. port
type hints set per interface number for a given vid:pid).

The device-specific properties apply to all ports in the device. Some
of these properties are currently expected in the physical device
(e.g. ID_MM_PLATFORM_DRIVER_PROBE) while some others are expected in
each port (e.g. the plugin udev tag filters).

This patch tries to simplify the logic and just assume that the device
specific tags may be given in either the physical device or the port
device, by providing separate APIs to retrieve port-specific or
device-specific (global) properties. If the same tag is given in both
the device and the port, the one in the device takes preference.

For the generic backend, these new APIs are really useless, as all
device-specific and port-specific properties are always stored in the
port object themselves (there is no 'tree' of devices in the generic
backend, no 'physdev' device).

For the udev backend, though, there really is a difference, as the
tags may be set in port or device.

https://bugs.freedesktop.org/show_bug.cgi?id=100156
2017-03-22 09:40:10 +01:00
Aleksander Morgado
9384817a14 telit: lock/unlock CSIM operations by default
Wrap the AT+CSIM=XX commands between lock (CSIM=1) and
unlock (CSIM=0) operations.

This seems to avoid the TTY lockup seen in several different Telit
modules.

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

Reported-by: Penalva, Salvador <Salvador.Penalva@digi.com>
2017-03-16 22:30:27 +01:00
Aleksander Morgado
8664b2a38a telit: support RS232 modems
Adding the vendor string match allows us to support RS232 devices in
the Telit plugin: the USB vendor id check may now be ignored and
instead we probe for the vendor string via AT commands, which works
even if the device is behind a USB<->RS232 adapter.

https://bugs.freedesktop.org/show_bug.cgi?id=100171
2017-03-16 22:29:05 +01:00
Aleksander Morgado
60be293fa5 telit: don't ignore AT ports without an explicit port type hint tag
The telit plugin is based on two main ways of checking the purpose of
each port: udev tags flagging specific interfaces (with info taken
from Windows .inf drivers), or otherwise using AT#PORTCFG? to query
the modem about that information. If none of those applies, the port
is ignored by default.

In order to support devices that are not explicitly tagged, the plugin
shouldn't flag as ignored the AT-capable TTYs, instead they are now
grabbed as 'secondary': ports grabbed as secondary will never be used
for either primary/data IF there is another port flagged explicitly
for primary/data.

This fixes the support for modems with a single TTY and no explicit
port type hint tag, e.g. RS232 modems with just one single TTY where
there's no point in specifying port type hints: the port will be
grabbed as secondary, and then automatically promoted to primary/data
as there is no other port grabbed.

https://bugs.freedesktop.org/show_bug.cgi?id=100159
2017-03-16 22:24:03 +01:00
Aleksander Morgado
c1d04f4cc0 cinterion: improve ^SCFG=? response parser to handle EHS5 format
Two main changes in the regex:
  * Ignore double quotes around interval numbers.
  * Ignore second set of values (i.e. the one after the comma), as it
  may not even be given).

We now support at least these two formats:
   ^SCFG: "Radio/Band",("1-511","0-1")
   ^SCFG: "Radio/Band\",("1"-"147")

Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-03-07 18:40:51 +01:00
Aleksander Morgado
40e6fa48c4 build: make sure subdir exists before running glib-mkenums
Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-02-28 10:59:46 +01:00
Aleksander Morgado
37df2643d2 cinterion: improve ^SMONG response parser:
* Allow whitespaces prefixing the values row.
  * Allow more than one \r\n between the title and the table header.

Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-02-16 12:27:57 +01:00
Aleksander Morgado
97eb23a964 cinterion: fix 'ds' setting in CNMI command builder
Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-02-14 09:46:05 +01:00
Aleksander Morgado
421713208b cinterion: support number ranges in CNMI=? parser
https://lists.freedesktop.org/archives/modemmanager-devel/2017-February/003911.html
2017-02-13 10:47:20 +01:00
Ben Chan
31655bb5a5 glib: remove invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute
'deprecated') since glib 2.36 as the type system is automatically
initialized. Since the minimum version of glib required by ModemManager
is 2.36, calling g_type_init() isn't necessarily in the ModemManager
code.
2017-02-03 10:05:14 +01:00
Dan Williams
ab48dc5b17 telit: add LTE access technology reporting 2017-01-28 21:54:13 -06:00
Ben Chan
c8ec731043 ublox: fix uninitialized variable issue
This patch fixes an uninitialized variable issue in
mm_ublox_parse_ugcntrd_response_for_cid(), which uses an uninitialized
`match_info' when `in_cid' is invalid.
2017-01-24 11:07:51 +01:00
Ben Chan
4a80c24169 telit: use g_assert instead of g_assert_true / g_assert_false
`g_assert_true' and `g_assert_false' are defined in glib 2.38 or later.
The minimum glib version currently required by ModemMamanger is 2.36.
While `g_assert_true' and `g_assert_false' may be preferred over the
more generic `g_assert', it seems like overkill to bump the minimum glib
version requirement just for that. When more code in ModemManager later
requires newer versions of glib, we can migrate all existing code to use
`g_assert_true' and `g_assert_false' when appropriate.
2017-01-12 11:37:08 +01:00
Aleksander Morgado
11297bcc79 cinterion: implement connection status monitoring via ^SWWAN?
And consolidate the connection status checks done during connection and
disconnection so that we re-use the same logic.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
9f725bc96a cinterion: default to PAP if no auth explicitly given
This is the same logic used in other implementations (e.g. QMI).
2017-01-04 14:11:17 +01:00
Aleksander Morgado
af2d6c1c4b cinterion: don't use predefined CIDs
The suggestion to use specific PDP context CIDs was given by Cinterion
for the special case of the Verizon operator, which 'reserves' specific
CIDs for specific purposes.

We don't want to impose that at the Cinterion plugin level, so remove
the PDP context mapping we had.

Therefore, simplify the connection procedure by just overriding the
'dialing' step of the default 3GPP connection sequence, instead of
overriding the whole connection sequence.

Also, we don't need to override the step to gather IP config because
this is already handled by the generic plugin (for DHCP over a network
interface).

We port to GTask for both 3GPP dial and 3GPP disconnect at the same time.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
7d576a084c cinterion: fix typo in comment 2017-01-04 14:11:17 +01:00
Aleksander Morgado
1919138c68 cinterion: don't check for ^SWWAN support during enabling
Better check for ^SWWAN support during the first time a bearer is going
to be created.

The enabling phase isn't the correct one because this logic is only run
whenever a modem is detected but not hotplugged (i.e. this step is to
'reset' the modem to generic runtime settings).
2017-01-04 14:11:17 +01:00
Aleksander Morgado
9ca3fde06b cinterion: minor coding style fixes 2017-01-04 14:11:17 +01:00
Aleksander Morgado
37521ed2b6 cinterion: simplify ^SWWAN response parsing
We get as input the ^SWWAN index we're interested in, and we loop
through the list of ^SWWAN lines looking for the one we need.

This updated helper method allows working with multi-line ^SWWAN
responses, e.g. given when more than one PDP context is active.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
dc96829bb5 cinterion: no need for private struct
The only member in the private network isn't even used.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
f7ca0124b0 cinterion: rework 3GPP connection sequence
Group together all connection related logic (e.g. context) and define
the context steps directly within the connection sequence processing.

Also, don't initially run a disconnection before the connection; if that
logic is ever needed we should likely have it in the generic modem, not
done per plugin.

And error out early if not asking for IPv4.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
955b46daf9 cinterion: rework 3GPP disconnection sequence
Group together all disconnection related logic (e.g. context) and define
the context steps directly within the disconnection sequence processing.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
6721c83d07 cinterion: use BearerCinterionAuthType when possible 2017-01-04 14:11:17 +01:00
Aleksander Morgado
d50059ead4 cinterion: setup per-interface configuration settings
Define the relationship between PDP context, SWWAN index and USB
interface number in one single place.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
938a53e7c6 cinterion: fix coding style for enum values
The enum values are given in UPPER_CASE format, not in CamelCase.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
ef50c085f9 base-modem,cinterion: no need for a peek_current_data_port() method
We already get the data port given as input parameter in
disconnect_3gpp(), so there is no point in trying to find out which the
data port is.
2017-01-04 14:11:17 +01:00
Matthew Stanger
1ffcb16349 cinterion: implement support for the new SWWAN interface 2017-01-04 14:11:17 +01:00
Carlo Lobrano
61dc32a72c telit: wrong port peek in telit_qss_toggle_ready
qss unsolicited handler should be assigned to primary port first,
while secondary port was peeked.
2017-01-04 13:35:36 +01:00
Aleksander Morgado
944e34ecdb tests,dbus: append pid to abstract socket name
So that different concurrent runs of this same test don't clash with
each other:

    TEST: test-service-generic... (pid=11124)
      /MM/Service/Generic/enable-disable:                                  Activating service name='org.freedesktop.ModemManager1'
    Successfully activated service 'org.freedesktop.ModemManager1'
    ** (plugins/.libs/lt-test-service-generic>:11124): ERROR **: Cannot bind socket: Error binding to address: Address already in use
    cleaning up pid 11144
    FAIL
2016-11-23 11:02:18 +01:00
Aleksander Morgado
20074c5574 tests,dbus: check if we're asked to use an abstract socket 2016-11-23 11:02:18 +01:00
Aleksander Morgado
820ab01ddf kernel-device: ID_USB_INTERFACE_NUM should be read as an hex string
The original g_udev_device_get_property_as_int() uses strtol() without
an explicit base (i.e. 0) so that the base is autodetected from the
string whenever possible (e.g. if prefixes with '0x' it is treated as a
hexadecimal string).

But, for ID_USB_INTERFACE_NUM, we explicitly require reading the number
as an hex string, even if we don't have any '0x' prefix.

Reported-by: Matthew Stanger <stangerm2@gmail.com>
2016-11-07 19:41:05 +01:00
Aleksander Morgado
2c5af4f0bc core: use a default timeout of 300s for the scan networks operation
This is the value which we actually suggest in the manpage for the mmcli
operation, so just use the same one.

   Scanning for 3GPP networks may really take a long time, so a specific timeout must be given:
       $ mmcli -m 0 --3gpp-scan --timeout=300

       Found 4 networks:
       21404 - Yoigo (umts, available)
       21407 - Movistar (umts, current)
       21401 - vodafone ES (umts, forbidden)
       21403 - Orange (umts, forbidden)

https://bugs.freedesktop.org/show_bug.cgi?id=98235
2016-10-24 13:34:27 +02:00
Carlo Lobrano
7078587f58 telit: optimized supported and current band code
In place of two slightly different regexes for 2g/3g and 2g/3g/4g modems
we now use only one regex with conditional patterns for both supported
and current Bands detection.

Adding also minor fix in test code
2016-10-20 12:40:04 +02:00
Aleksander Morgado
33e563fe48 ublox: fix VPATH builds and distcheck
https://bugs.freedesktop.org/show_bug.cgi?id=98216
2016-10-13 11:49:44 +02:00
Aleksander Morgado
e3e803998c ublox: add README explaining all details of the plugin 2016-10-12 13:24:10 +02:00
Aleksander Morgado
38bf567536 ublox: longer timeout needed for AT probing
When the device is reset, it needs some time before the newly exposed TTYs are
able to reply to our AT commands. We increase the default timeout of the AT
probing commands in order to cope with that, or we'll end up with TTYs of
'unknown' type that aren't used for anything.
2016-10-12 13:24:09 +02:00
Aleksander Morgado
e64b964e8e ublox: implement connection statistics loading
The implementation uses +UGCNTRD=? to query whether the per-PDP context
statistics are supported by the device, and if they are, +UGCNTRD is used to
query them.

We only process the statistics for the specific CID we're using.
2016-10-12 13:24:09 +02:00
Aleksander Morgado
e6e53467ee ublox: new +UGCNTRD? response parser
The parser returns only the results for the CID being specified as input. This
is so that we can just query the statistics of the CID currently in use by the
bearer.
2016-10-12 13:24:09 +02:00