Commit Graph

5661 Commits

Author SHA1 Message Date
Aleksander Morgado
db5619b3eb build,dell: reorder rules last
Dell plugin is a compilation of other plugins, move last.
2017-06-05 15:05:45 +02:00
Aleksander Morgado
d6d7b837b8 build,telit: fix distcheck 2017-06-05 14:46:48 +02:00
Aleksander Morgado
08782995e2 telit: rework QSS unsolicited handler enabling logic
When the async method starts we store already the primary and the
optional secondary port objects in the method context, keeping a full
reference for each.

When we parse the response for the enabling command, we just reuse the
stored port objects, instead of re-querying the modem to get them, and
this makes sure that the port objects where we want to set the
unsolicited message handlers are still valid. If the ports are gone
in the middle of the enabling operation, the handlers will be set
without errors, even if the ports may likely get completely disposed
when this async method context is disposed.

Additionally, we make sure that we return an error also for the case
where there is no secondary port and the enabling on the primary port
failed.

This patch also fixes the use of the at_command_full_finish() method to
complete the at_command_full() async operation, to keep consistency.
2017-06-05 14:04:42 +02:00
Aleksander Morgado
d6779b91b2 telit: make sure QSS status values read are always known
Given that the MMTelitQssStatus enums are mapped directly to the
values read from the #QSS response, we need to make sure that we never
return a value for which we don't have an enum defined.

Also, use set_error() instead of the propagate_error() + error_new()
combo.
2017-06-05 14:04:42 +02:00
Carlo Lobrano
4cd5044bfd telit: manage QSS transitions
Currently, Telit's SIM swap implementation is stateless and
based on #QSS unsolicited messages 0/1 (SIM_REMOVED/SIM_INSERTED).

However, the user might have configured the modem in order to provide a
more detailed information, with #QSS values 2/3 (SIM UNLOCKED/SIM READY).

In this case and with current implementation, even receiving "#QSS: 3" will
trigger the "SIM swap" logic. The same issue might occur in other use cases
too, i.e. with SIM locked or when the message is received from both USB
ports.

This patch makes SIM swap implementation stateful, and it considers as an
actual SIM swap, only transitions from #QSS: 0 to #QSS: 1/2/3 and vice
versa.
2017-06-05 14:04:42 +02:00
Aleksander Morgado
b5e94185bb huawei: let the E3372 run NDISDUP via TTY
This modem ends up exposing a cdc-wdm port and a WWAN network
interface, but the cdc-wdm port is totally unusable, it won't reply to
any AT command or anything.

Instead this modem can do NDISDUP via TTY, which is what the Windows
drivers are also doing.
2017-06-02 13:13:59 +02:00
Aleksander Morgado
e2e2c3e019 cinterion: retry GPS Engine activation up to 3 times
The default setup with 100ms between GPS commands doesn't seem to be
always enough for the Engine activation step:

   [1495016625.392972] (ttyACM1): --> 'AT^SGPSC="NMEA/Output","on"<CR>'
   [1495016625.503885] (ttyACM1): <-- '<CR><LF>^SGPSC: "Nmea/Output","on"<CR><LF><CR><LF><CR><LF>OK<CR><LF>'
   [1495016625.607650] (ttyACM1): --> 'AT^SGPSC="Power/Antenna","on"<CR>'
   [1495016625.697862] (ttyACM1): <-- '<CR><LF>^SGPSC: "Power/Antenna","on"<CR><LF><CR><LF>OK<CR><LF>'
   [1495016625.809393] (ttyACM1): --> 'AT^SGPSC="Engine","1"<CR>'
   [1495016625.895970] (ttyACM1): <-- '<CR><LF>+CME ERROR: 767<CR><LF>'

We now setup up to 3 retries for the Engine activation step before
returning an error, and we also update to 2000ms the wait time before
the Engine activation command is run.
2017-05-30 21:06:12 +02:00
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
024c7a1a8f broadband-modem: query +CMER format before enabling/disabling
Don't blindly try '+CMER=3,0,0,1' to enable and '+CMER=0' to disable
Mobile Equipment Event Reporting. We now query the device for the
supported formats and use that info to build commands that will work.
2017-05-29 14:58:25 +02:00
Aleksander Morgado
e753911a4e helpers: new 'AT+CMER=?' parser 2017-05-29 14:56:54 +02:00
Aleksander Morgado
7f3b552804 cinterion: support changing modes in LTE capable devices 2017-05-29 14:46:03 +02:00
Aleksander Morgado
e6f245c6df udev: remove default ID_MM_PLATFORM_DRIVER_PROBE whitelist
The whitelist made all platform TTYs managed by the 'atmel_usart'
kernel driver probed by ModemManager, which isn't something we want,
as most of these aren't broadband modems.

We leave the logic supporting the ID_MM_PLATFORM_DRIVER_PROBE udev tag
as there may be a case where the user does need ModemManager to probe
a given platform TTY.
2017-05-29 13:53:59 +02:00
Aleksander Morgado
57f193bd04 log: remove func loc info unless MM_LOG_FUNC_LOC is defined
The user can build the project passing custom CFLAGS to enable the
function location information, e.g.:

    $ ./configure --prefix=/usr CFLAGS="-DMM_LOG_FUNC_LOC"
2017-05-29 13:42:23 +02:00
Aleksander Morgado
3bb0f7e66d context: rework application options and help output
Group together all options that allow configuring the logging output,
and make them have the same --log-[XXX] prefix.

Also rework the --help output so that all option groups are printed by
default (i.e. there is no longer a --help-all option).
2017-05-29 12:37:36 +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
8387dc7a7c broadband-modem: don't create sim hot swap ports context multiple times 2017-05-23 18:41:36 +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
bf579da074 iface-modem: always complete async context with a value
Just for consistency, this is not a bug per se.
2017-05-20 20:35:35 +02:00
Aleksander Morgado
cab81f679f blacklist: ignore default Linux USB Serial Gadget
Blacklist the default VID:PID for the Linux USB Serial Gadget in ACM
mode:

{LINUX}/drivers/usb/gadget/legacy/serial.c
  #define GS_VENDOR_ID       0x0525  /* NetChip */
  #define GS_CDC_PRODUCT_ID  0xa4a7  /* ... as CDC-ACM */

This should never be reused for real products by hardware
manufacturers, but anyway...

Patch actually ported from downstream Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/modemmanager/+bug/1105352
2017-05-18 13:12:26 +02:00
Aleksander Morgado
5947cda9f4 man: include missing --no-auto-scan and --initial-kernel-events
And remove --test-no-auto-scan, as the 'no auto scan' feature isn't
only a test feature now.
2017-05-18 12:35:51 +02:00
Aleksander Morgado
e8acfe0296 iface-modem: fix setting up signal quality retrieval logic
If going directly e.g. from "Searching" to "Connecting", just setup
the signal quality retrieval logic right away, don't assume we always
go through "Registered" state before starting a connection.

Reported-by: <colin.helliwell@ln-systems.com>
2017-05-15 17:12:30 +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
Javier Viguera
fa2e532d2c port-serial: add B230400 and B921600 missing baudrates
So MM can use them when opening a specific serial port.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
2017-05-10 14:35:08 +02:00
Aleksander Morgado
650d230425 blacklist: add keyboard.io devices
See https://bugs.freedesktop.org/show_bug.cgi?id=85007#c5

Reported-by: Jesse Vincent <jesse@keyboard.io>
2017-05-10 14:26:30 +02:00
Aleksander Morgado
2373a4b658 port-qmi: fix QMI client allocation procedure
Commit 26ee94ec28 introduced a bug, where we would be completing
the client allocation task *before* tracking the new client allocation
info in the private tracking list.

This meant that if mm_port_qmi_peek_client() was called in the task
completion handler, the client object wouldn't be returned, as it
wasn't found in the private tracking list.

The fix is just to defer the task completion until after the private
tracking list is updated.

Reported-by: Salvador Penalva <salvador.penalva@digi.com>
2017-05-05 11:33:11 +02:00
Dan Williams
f3cc78ef02 broadband-modem-qmi: ensure PLMN name is UTF-8
Some Telit modems apparently sometimes report non-UTF8 characters.
2017-04-24 22:37:46 -05:00
Maksim Salau
d4e149c528 blacklist: add Analog Devices EVAL-ADXL362Z-DB
Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2017-04-24 20:45:17 -05: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
6312753a6b broadband-bearer: once connected, set flow control settings
During modem initialization we detected the flow control settings
supported by the modem, and selected the best one to use from them,
notifying it to the device via AT+IFC. The device was therefore
instructed to use that flow control setting for data transmission in
the TTY (i.e. not during AT control commands).

The missing thing was to also configure ourselves our end of the
serial port with the same flow control settings when getting into data
mode. By doing it ourselves, we avoid requiring any explicit setting
in pppd for flow control; pppd can assume the flow control settings
are already the expected ones.

Worth noting that all this setup is completely ignored for TTYs
exposed directly via USB.

https://bugs.freedesktop.org/show_bug.cgi?id=100394
2017-04-18 18:08:57 +02:00
Aleksander Morgado
595bd5dbe3 port-serial: remove all default flow control settings
We won't set XON/XOFF by default and we won't allow setting RTS/CTS
via a property. The serial port by default starts with no flow control
configured.
2017-04-18 18:08:57 +02:00
Aleksander Morgado
580c113c5a port-serial: new method to explicitly set flow control settings 2017-04-18 18:08:57 +02:00
Aleksander Morgado
3223b56ba9 port-serial: new internal method to run tcsetattr()
The method takes care of looping if EAGAIN errors happen, as well as
checking whether all attributes were set or not.
2017-04-18 18:08:57 +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
Aleksander Morgado
91391eb460 broadband-modem: query supported flow control modes before setting
Instead of assuming XON/XOFF is supported, we query the supported flow
control modes, and then we set the best one based on that, preferring
hardware flow control over software flow control.
2017-04-18 18:08:57 +02:00
Aleksander Morgado
973c7d0970 helpers: new parser for AT+IFC=?
Instead of having the parser return separate list of supported flow
controls for TE and TA, we simplify it by only returning those
settings that apply to both TE and TA.

This logic isn't perfect either, though, as some settings (e.g. '3' in
TE in some modems, specifying a different XON/XOFF behavior) may not
have a corresponding setting in the other end.

The most common cases we care about (i.e. standard XON/XOFF, RTS/CTS)
should be properly reported with this logic.
2017-04-18 18:08:57 +02:00