Commit Graph

1379 Commits

Author SHA1 Message Date
Aleksander Morgado
aa8ac416f8 cinterion: support AT^SGPSC capable modems
The AT^SGPSS command provides an easy way to just start/stop GPS, but
unfortunately it isn't supported by all Cinterion modems.

The AT^SGPSC command instead is more widely available but it requires
several steps to start and stop the different elements of the GPS
receiver.

Implement support for both, preferring AT^SGPSSS if available and
falling back to AT^SGPSC otherwise.
2017-05-30 21:06:04 +02:00
Aleksander Morgado
d772301cd4 cinterion: setup GPS port only if GPS support detected
i.e. if AT^SGPSS not supported, we don't even add traces handler to
the GPS data port.
2017-05-30 21:05:56 +02:00
Aleksander Morgado
1857e9b36e cinterion: flag PLS8 GPS data port 2017-05-30 21:05:50 +02:00
Aleksander Morgado
bf549d1bca cinterion,location: refactor enable/disable and capabilities checks
When checking for location capabilities, we will make sure AT^SGPSS is
supported and if it isn't we won't report GPS capabilities.

The location enable and disable paths are refactored to make it easier
to add possible new GPS commands to use instead of AT^SGPSS, if this
isn't supported (e.g. in the PLS8 devices).
2017-05-30 21:05:44 +02:00
Aleksander Morgado
2eb55d3224 plugins: use G_N_ELEMENTS when iterating ports array 2017-05-30 17:28:23 +02:00
Aleksander Morgado
b874fba0e6 ublox: use send-delay=0 by default
Looks like the u-blox SARA-U260 requires this, see:
https://lists.freedesktop.org/archives/modemmanager-devel/2017-May/004670.html
2017-05-30 17:18:38 +02:00
Aleksander Morgado
fcd4a8c5dc altair,hso,samsung: setup send-delay=0 for probing
The Altair, Option HSO and Samsung plugins all use the send-delay=0
setting once the modem object has been created. For consistency, use
the same setting during port probing.
2017-05-30 17:18:32 +02:00
Aleksander Morgado
2b8a7e4c16 telit: remove custom +CMER enabling
This is now managed directly in the generic plugin.
2017-05-29 14:59:16 +02:00
Aleksander Morgado
ec98b9e956 cinterion: remove custom +CMER enabling
This is now managed directly in the generic plugin.
2017-05-29 14:59:01 +02:00
Aleksander Morgado
7f3b552804 cinterion: support changing modes in LTE capable devices 2017-05-29 14:46:03 +02:00
Carlo Lobrano
51bb354624 dell: speed probing time up and reduce udev dependency
Currently Dell plugin implements a retry logic of three commands
(AT+GMI, AT+CGMI, ATI1I2I3) to detect modem's vendor string.
Moreover, since Telit modems always reply to the first command, to speed
the probing time up, those modem are tagged with an Udev rule so that we
can avoid sending the other two commands at all.

However, the retry logic is in case a port needs some time to reply, so
it makes sense to apply it only to the first command. Then if the port still
does not respond with any kind of reply, that probably means that it is not
AT capable and we can skip the other AT commands as well.

Then, this patch:
- sets a maximum number of timeouts for AT+GMI to 3. After this
  timeouts, the port is considered not AT-capable.
- sets AT+CGMI and ATI1I2I3 to be sent only once.
- removes Dell udev rule for tagging Telit Modems.
2017-05-29 12:25:35 +02:00
Carlo Lobrano
d986277f13 telit: removed ID_MM_TELIT_PORTS_TAGGED dependency
Currently, Telit plugin depends on ID_MM_TELIT_PORTS_TAGGED
environment variable, set by udev, for tagging modems that
support dynamic port config (#PORTCFG)

To remove this dependency from udev, Telit plugin now relies
only on the error management of the command AT#PORTCFG? itself
in order to see whether the modem supports it or not.
2017-05-29 12:25:35 +02:00
Aleksander Morgado
0f99328af6 cinterion: don't enable simstatus URCs
When polling for the SIM status, we want to read the value (mode 2)
without enabling indications (mode 1).
2017-05-21 21:39:52 +02:00
Aleksander Morgado
a690937902 mbm: fix async method completion enabling unsolicited events 2017-05-21 14:42:25 +02:00
Aleksander Morgado
d41d717112 ublox: align property values in g_object_new() 2017-05-10 14:36:28 +02:00
Javier Viguera
1ab98b9e8c ublox: support modems connected to serial port
Add the vendor string, so it can be probed via AT commands. This allows
to support modems that are connected to a serial port.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
2017-05-10 14:35:28 +02:00
Carlo Lobrano
7a68d45774 telit: give load lock retries steps a descriptive name
In order to make debug logging more clear, I replaced the step ID with a
descriptive step name.
2017-04-19 17:08:35 +02:00
Aleksander Morgado
d09bc8baaa telit: use mm_get_uint_from_hex_str() to parse CSIM hex response
The regex is already limiting the string to 4 hex chars, so we can
definitely fit the number in a guint, no need a guint64.
2017-04-19 10:42:24 +02:00
Carlo Lobrano
44daf791bb telit: add error_code recognition to +CSIM parser
- Refactored mm_telit_parse_csim_response in order to correctly
  recognize the following +CSIM error codes:
    * 6300 - Verification failed
    * 6983 - Authentication method blocked
    * 6984 - Reference data invalidated
    * 6A86 - Incorrect parameters
    * 6A88 - Reference data not found

- Updated correspondent tests.
- Finally, some minor changes in other files for better error logging

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100374
2017-04-19 10:37:05 +02:00
Aleksander Morgado
4fe464f5f7 core: prefer g_task_return_error_if_cancelled() than custom errors
When the GCancellable is added to the GTask, we can use a single
method call to check for the task being cancelled, and complete it
right away if so.

This patch also clears up the logic in the Novatel plugin, where the
code was trying to return "TRUE" when the task was cancelled, but
wouldn't work as the check-cancellable flag in the GTask is TRUE by
default (i.e. when completing the GTask, if it was cancelled, a
G_IO_ERROR_CANCELLED would be returned by default, regardless of any
other return value set).

This patch also introduces a small variation of the logic in the
Cinterion plugin: instead of running SWWAN=0 before completing the
async action, the command is now sent just after completion of the
async action. This shouldn't be an issue, as the SWWAN result itself
is ignored.
2017-04-18 19:31:02 +02:00
Aleksander Morgado
ff6726df11 telit: ignore custom flow control handling
The generic modem object already supports querying for the supported
methods and setting the best one found.
2017-04-18 18:08:57 +02:00
Aleksander Morgado
1d2a67ab20 wavecom: ignore custom flow control handling
The generic modem object already supports querying for the supported
methods and setting the best one found.
2017-04-18 18:08:57 +02:00
Dan Williams
977d5ac6ce broadband-modem-novatel: $NWRSSI can report lower values than -115
My E725 reported 125 once; that's a valid dBm and MM shouldn't report
an error when parsing it.
2017-04-17 11:59:12 -05:00
Dan Williams
dedc1f15c7 broadband-modem-novatel: clean up detailed registration state handling
Allocate the results instead of passing them back on the stack, which removes
the "can't complete in idle" restriction.  Also always open the QCDM port
since we can't assume it will be open already at this point.
2017-04-17 11:59:12 -05:00
Dan Williams
77fbcf534b broadband-modem-novatel: clean up access technology reporting
Instead of mixing the QCDM Novatel Snapshot code directly into the
access technology checking code, split it out with its own async
result.  At the same time, make sure to open the QCDM port when
it's needed, instead of assuming its already open.  Since it won't
always be.
2017-04-17 11:59:12 -05:00
Carlo Lobrano
a902199772 telit: unsupported CSIM lock should not skip loading unlock retries
Some modems do not support CSIM lock/unlock, but they do support
querying SIM unlock retries through +CSIM command.

If CSIM lock returns with "unsupported command" do not propagate
the error and continue with the other CSIM queries instead, moreover the
CSIM lock feature is signed as FEATURE_UNSUPPORTED in Telit modem
private structure to prevent being sent again (e.g. calling CSIM
unlock AT command).
2017-04-15 22:52:12 +02:00
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