Commit Graph

2375 Commits

Author SHA1 Message Date
Jakub Sitnicki
fcfd52df10 core: perform clean-up when terminating due to a Unix signal
Since commit 2d700043ab ("core: use g_unix_signal_add() for more
reliable Unix signal handling") we no longer have to stick to
signal-safe functions in the SIGTERM/SIGINT handler.

Use exit() to terminate so that the clean-up functions are ran and code
coverage data gets written into files.
2015-01-11 19:32:49 +01:00
Jakub Sitnicki
7552030ef9 build: add code coverage support
Build all targets, except for CLI tools (mmcli, uml290), with special
flags needed for collecting code coverage information when the build has
been configured with --enable-code-coverage.

Three new targets are available in the top build directory:

 - `check-code-coverage' runs the test suite and generates a code
   coverage report,

 - `code-coverage-capture' generates a code coverage report from already
   collected data, which can come in handy when one wants to see code
   paths touched by a particular test,

 - `code-coverage-clean' removes the collected coverage data and the
   generated reports.
2015-01-11 19:32:43 +01:00
Aleksander Morgado
2edb00cbcb broadband-modem-qmi: fix memleak when listing SMS
If we get multiple message lists, we need to make sure the previous one is
cleared out before going to the next one.
2015-01-09 12:48:22 +01:00
Aleksander Morgado
46b707f847 mbim: use the new response checker helper method
mbim_message_response_get_result() is available in libmbim-glib 1.11.1.
2014-12-30 12:46:07 +01:00
Aleksander Morgado
35575ccc15 port-qmi: always use QMI proxy
We already require libqmi > 1.7.0 in the build.
2014-12-30 12:43:14 +01:00
Aleksander Morgado
0dd707a279 iface-modem-location: don't print location info to syslog with info level
Use debug level, which has to be explicitly requested by the user.

https://bugs.freedesktop.org/show_bug.cgi?id=87498
2014-12-26 16:36:32 +01:00
Aleksander Morgado
3b2ed15abd port-probe: retry icera probing up to 3 times, with some time in between cmds
Icera-based modems need to return a correct response to the AT%IPSYS? command,
so that they are properly detected as being Icera-based.

Now, some modems, like the Nokia 21M-02, don't seem to return a correct response
to AT%IPSYS just after being plugged in. So, setup a retry mechanism (3 retries,
with 2 seconds between retries) to try to cope with this issue.

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

Logs from the error situation:

[mm-port-serial-at.c:440] debug_log(): (ttyACM0): --> 'ATE1 E0<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM2): --> 'ATE1 E0<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM1): --> 'ATE1 E0<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM0): <-- 'E0'
[mm-port-serial-at.c:440] debug_log(): (ttyACM0): <-- '<CR><CR><LF>ERROR<CR><LF>'
[mm-serial-parsers.c:364] mm_serial_parser_v1_parse(): Got failure code 100: Unknown error
[mm-port-probe-at.c:43] mm_port_probe_response_processor_is_at(): Parsing AT got: 'Unknown error'
[mm-port-probe.c:155] mm_port_probe_set_result_at(): (tty/ttyACM0) port is AT-capable
[mm-port-serial-at.c:440] debug_log(): (ttyACM2): <-- 'ATE1 E0'
[mm-port-serial-at.c:440] debug_log(): (ttyACM1): <-- ' E0'
[mm-port-serial-at.c:440] debug_log(): (ttyACM2): <-- '<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM1): <-- '<CR><CR><LF>ERROR<CR><LF>'
[mm-serial-parsers.c:364] mm_serial_parser_v1_parse(): Got failure code 100: Unknown error
[mm-port-probe-at.c:43] mm_port_probe_response_processor_is_at(): Parsing AT got: 'Unknown error'
[mm-port-probe.c:155] mm_port_probe_set_result_at(): (tty/ttyACM1) port is AT-capable
[mm-port-serial-at.c:440] debug_log(): (ttyACM2): <-- '<CR><LF>OK<CR><LF>'
[mm-port-probe.c:155] mm_port_probe_set_result_at(): (tty/ttyACM2) port is AT-capable
[mm-port-serial-at.c:440] debug_log(): (ttyACM0): --> 'AT%IPSYS?<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM1): --> 'AT%IPSYS?<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM2): --> 'AT%IPSYS?<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM0): <-- 'AT%IPSYS?'
[mm-port-serial-at.c:440] debug_log(): (ttyACM0): <-- '<CR>'
[mm-port-serial-at.c:440] debug_log(): (ttyACM1): <-- 'AT%IPSYS?'
[mm-port-serial-at.c:440] debug_log(): (ttyACM1): <-- '<CR><CR><LF>ERROR<CR><LF>'
2014-12-03 23:01:13 +01:00
Tyler
b51f701524 bearer: PDP context APN scan should be case insensitive 2014-11-14 12:13:10 +01:00
Torsten Hilbrich
bc410ce03f qmi: retrieve MM_MODEM_3GPP_FACILITY_SIM
This facility cannot be retrieved via 'DMS UIM Get CK Status' and seems
currently unimplemented for mm-broadband-modem-qmi. The SIM enabled
status is however available via 'DMS UIM Get PIN Status'.

Using this message to add the retrieval of PIN status just after the
other facilities were queried.

Succesfully tested with Gobi2000 (05c6:9205), both retrieval of 3gpp
SIM lock status and enabling/disabling the PIN.
2014-11-12 13:13:11 +01:00
Lubomir Rintel
d44690489b udev: Don't mark disconnected RFCOMM ttys as candidates
Bluetooth serial devices are weird. They begin life being bound with
RFCOMMCREATEDEV ioctl() and then move around the sysfs tree when they are
connected and disconnected. The connection is estabilished upon the first
open() and torn down upon last close(), their first user virtually being
"owner" of the connection. We don't want to be that process, we're only
interested in actually connected modems. However, currently we have no
knowledge of that and therefore we connect and disconnect multiple times while
probing.

This patch marks unconnected RFCOMM devices as uninteresting to us.
The actual connection and disconnection will be handled by NetworkManager.
2014-11-01 20:07:40 +01:00
Lubomir Rintel
f79ec9bf4d manager: Remove devices which are deemed unfit during addition attempt
device_added() might be called in response to a "change" or "move" attempt that
might have changed a candidate device to a non-candidate one.
2014-11-01 20:07:35 +01:00
Lubomir Rintel
b8cd5ae838 device: Keep track of devices as they are move across sysfs
For certain devices the name changes with their status. Notably, RFCOMM
devices move from /devices/virtual/ to underneath the HCI that is used
for the connection as the session is estabilished, and return back when
it's torn down.
2014-11-01 20:07:30 +01:00
Aleksander Morgado
98f21ec195 modem-helpers: fix IP4 -> IPV4
Stupid me, introduced a bug when manually writing the previous patch.

:/
2014-10-30 00:08:51 +01:00
Oskar Enoksson
01bd5006f5 modem-helpers: handle "IPV4" pdp type response
My modem (Samsung GI B3740) responded "IPV4" to "CGDCONT=?". This was
not handled in mm-modem-helpers.c. The obvious fix was to return
MM_BEARER_IP_FAMILY_IPV4.
2014-10-29 23:13:22 +01:00
Aleksander Morgado
555ec15a16 mm-broadband-modem-qmi: avoid using NULL pointer coming from an empty GArray 2014-10-29 22:35:52 +01:00
Greg Suarez
3a76c0df57 bearer-mbim: Implement report_connection_status() to set the port as disconnected
When the MBIM modem unexpectedly loses connection the port state never
gets set as disconnected thus when trying to reestablish a new
connection the bearer cannot find a port in the disconnected state.

Signed-off-by: Greg Suarez <gpsuarez2512@gmail.com>
2014-10-29 22:21:18 +01:00
Dan Williams
046d9141c4 blacklist: ignore GW Instek AFG-2225 arbitrary waveform generator 2014-10-28 11:46:51 -05:00
Aleksander Morgado
f2fa7a7fbf qcdm: don't retry probing if QCDM unescaping fails
But keep the retries when the frame marker isn't found.

https://bugzilla.gnome.org/show_bug.cgi?id=708861
2014-10-15 18:29:18 +02:00
Dan Williams
41b7e7b048 port-serial: fix forced closing after b28230411
b28230411 moved up the self->priv->forced_close = TRUE, which
caused mm_port_serial_close() to just return without actually
closing the port and cleaning up.

Also, cancel the reopen separately from closing the port since
the two operations are actually independent of each other.
2014-10-07 16:01:54 -05:00
David McCullough
340ff7dce3 broadband-modem-qmi: fix registration state when built with --with-newest-qmi-commands
This patch fixes the registration reporting/checking when ModemManager is
built with --with-newest-qmi-commands.  apply_cs and apply_ps were not
properly initialised and may never be true. Also fixes a CnP error for
mm_ps_registration_state.

Signed-off-by: David McCullough <david.mccullough@accelecon.com>
2014-09-11 11:01:40 +02:00
David McCullough
84db939565 broadband-modem-qmi: fix signal strength when built with --with-newest-qmi-commands
This patch fixes the signal strength values when using ModemManager built
with --with-newest-qmi-commands.

It was never getting a valid signal strength because the default (0) is
always greater than a valid signal strength, and the rssi_max handling
was completely wrong.

Signed-off-by: David McCullough <david.mccullough@accelecon.com>
2014-09-11 11:01:20 +02:00
Aleksander Morgado
fd7d0a08f7 broadband-modem-qmi: implement A-GPS enabling/disabling 2014-09-05 12:11:18 +02:00
Aleksander Morgado
75f35cdb9e broadband-modem-qmi: implement SUPL server setting 2014-09-05 12:11:18 +02:00
Aleksander Morgado
8d2b4fa5f9 broadband-modem-qmi: implement SUPL server loading 2014-09-05 12:11:18 +02:00
Aleksander Morgado
836892902e broadband-modem-qmi: A-GPS available by default
Also bump libqmi requirement to 1.11.1, which is the one exposing the new A-GPS
related commands.
2014-09-05 12:10:55 +02:00
Aleksander Morgado
63f2e72c6c iface-modem-location: load SUPL server setup when initializing interface 2014-09-05 11:30:24 +02:00
Aleksander Morgado
d20f3e5d60 iface-modem-location: handle setting SUPL server 2014-09-05 11:30:24 +02:00
Aleksander Morgado
fbeee20d5b introspection,api: add SUPL server configuration in the Location interface 2014-09-05 11:28:10 +02:00
Aleksander Morgado
c4e7fdf025 core: add --version option to the ModemManager daemon
It was actually included in the man page of the daemon, but we didn't have it.
2014-09-05 11:18:06 +02:00
Aleksander Morgado
31f81725e6 plugin: allow to explicitly ignore any kind of port via udev
The new 'ID_MM_PORT_IGNORE' tag will tell ModemManager to fully avoid using a
given port.

Note that it is key to not only flag the port probe as ignored, but also to
fully ignore the ports in e.g. mm_port_probe_list_has_qmi_port() as those
methods will be used to decide which kind of modem object to create. We don't
want to create a QMI-based modem which may have all QMI ports blacklisted.
2014-09-05 09:54:55 +02:00
Aleksander Morgado
8450e563bb plugin: if no QMI or no MBIM still grab the WWAN ports, flagged as ignored
E.g. this would be the result when having ModemManager compiled without QMI
support, and a modem with 2 QMI/WWAN pairs:

    $ mmcli -m 2

    /org/freedesktop/ModemManager1/Modem/2 (device id '417e4dcff7f232b62cfe6c972e2099701848fd7f')
      -------------------------
      Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
               |          model: 'MC7304'
               |       revision: 'SWI9X15C_05.05.02.00 r19147 carmd-fwbuild1 2013/11/15 13:54:28'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: 'unknown'
      -------------------------
      System   |         device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7'
               |        drivers: 'qcserial, qmi_wwan'
               |         plugin: 'Gobi'
               |   primary port: 'ttyUSB8'
               |          ports: 'ttyUSB8 (at), wwp0s29u1u7i8 (unknown), ttyUSB6 (qcdm), wwp0s29u1u7i10 (unknown)'

The /dev/cdc-wdm ports don't even appear (as they were not even probed), but the
newly ignored WWAN ports do appear in the list, but flagged as UNKNOWN type
(instead of NET).
2014-09-05 09:16:11 +02:00
Aleksander Morgado
d2544ac044 base-modem: always grab ports marked as ignored
Modems may expose ports that are either just not used (e.g. modems exposing more
than 2 functional AT ports) or explicitly avoided (e.g. WWAN ports when we don't
know how to use them).

Those kind of ports are part of the modem, but not used by ModemManager. Still,
ModemManager should list them in the list of ports available for the modem, with
IGNORED type.
2014-09-05 08:48:00 +02:00
Aleksander Morgado
a22681ba99 port-mbim: use the mbim-proxy by default 2014-08-22 18:43:20 +02:00
Dan Williams
0c6f1ae6c4 qmi: always use DHCP for IPv4 configuration instead of STATIC
Some newer modems (Huawei E1750, Sierra 73xx) provide what looks like
legitimate static IPv4 configuration through the WDSGetCurrentSettings
call, but when configured the interface does not pass traffic.  Running
DHCP on the same interface provides a slightly different IPv4
configuration but does allow traffic to pass.

Since QMI was switched to static originally for consistency with IPv6
and for speed of IP configuration (since DHCP takes a bit of time), but
not for any known problems with modems, let's switch back to DHCP until
we have time to figure out what's actually going on.
2014-08-18 09:47:59 -05:00
Aleksander Morgado
b03e1cfd58 bearer-qmi: allow forcing DHCP instead of static IP config 2014-08-18 09:47:14 -05:00
Ben Chan
4669611412 broadband-modem,plugins: fix GMatchInfo leaks 2014-08-12 09:45:50 +02:00
Dan Williams
8c4318d87a iface-mode: downgrade "access technology changed" message to debug
We have a report of a modem that switches access technologies frequently,
in this case almost every 10 seconds.  While that's unusual, it's not
unexpected depending on the RF environment.  We shouldn't spam syslog
with that info; if we need it we can get it with mmcli.
2014-08-11 10:45:41 -05:00
Aleksander Morgado
f203b1bf00 plugin: improve probing decision logic for QMI and MBIM
So, we may have modems with multiple /dev/cdc-wdm ports, like Ericsson modems,
where only 1 of them is MBIM. With the previous logic, we would probe all
/dev/cdc-wdm ports for MBIM as soon as one of the ports was handled by the
cdc_mbim driver. That is totally not optimal, as we are already know that they
are not MBIM (not handled by cdc_mbim).

Instead, fix the logic to just probe for MBIM or QMI if the actual driver
managing the port is MBIM or QMI.
2014-07-27 13:55:10 +02:00
Ben Chan
0284daf87e broadband-modem-mbim: increase timeout for powering modem up and down
It's been observed that some modems occasionally take a long time to
power down (which may be due to some shutdown sequence that involves
communicating with network). This patch increases the timeout for
powering modem up and down from 10s to 20s.
2014-07-17 16:09:31 -05:00
Ben Chan
8a56cd4c2a bearer-mbim: increase disconnect timeout
It's been observed that modems may take a long time to disconnect from
the network under certain network conditions. This patch increases the
timeout for the MBIM_CID_CONNECT set command in the disconnect sequence
from 10s to 30s.
2014-07-17 16:09:29 -05:00
Aleksander Morgado
e5920efe09 broadband-modem-mbim: VZ20M returns ERROR_PIN_REQUIRED in PIN query response
VID/PID: 258d:e000

Instead of returning success and the PIN type + PIN status + Remaining attempts,
this modem returns a plain ERROR_PIN_REQUIRED error, so try to handle that...
2014-07-11 11:54:25 +02:00
Aleksander Morgado
6062462dcb broadband-modem-mbim: reset strings to NULL, not 0 2014-07-09 11:58:46 +02:00
kuonirat
0be8808cbd broadband-modem-mbim: update_registration_info immune to null pointers passed 2014-07-09 11:57:45 +02:00
Aleksander Morgado
5358d6fea0 sim: rename 'MMSim' to 'MMBaseSim'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado
a29382be70 sms: rename 'MMSms' to 'MMBaseSms'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado
3ca267b01f bearer: rename 'MMBearer' to 'MMBaseBearer'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado
ff478e301e manager: rename 'MMManager' to 'MMBaseManager'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 13:23:37 +02:00
Aleksander Morgado
ad67d68179 location: new 'unmanaged' GPS setup
Standard GPS setup (raw/nmea) will both enable the GPS module and take full
control of the GPS port. This prevents other processes from reading the NMEA
traces from e.g. a tty. In order to handle this, a new 'unmanaged' GPS location
source is introduced, which will just enable/disable the GPS module, without
reading anything from the GPS port. Of course, both raw/nmea and unmanaged
setups cannot be enabled at the same time.
2014-07-02 12:28:56 +02:00
Dan Williams
915a5beac0 bearer-mbim: ignore empty DNS server addresses 2014-07-01 16:38:34 -05:00
Aleksander Morgado
ce5c3f5af6 ifaces: always include <libmm-glib.h>
As they all use the 'MMSimpleStatus' type.
2014-07-01 15:42:21 +02:00