Commit Graph

5790 Commits

Author SHA1 Message Date
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
1d41685f48 device: disconnect signal handlers when modem object removed
Don't rely on the automatic disconnection of the signal as the last
reference of the modem object may outlive the device object.

Also, setup a common clear_modem() function to dispose the internal
reference of the modem object, which will take care of the signal
disconnection when required.

https://lists.freedesktop.org/archives/modemmanager-devel/2017-February/003907.html
2017-02-13 20:31:20 +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
Aleksander Morgado
91613543d5 libmm-glib: set clear func by default in the MMModemPortInfo array
So that we don't leak the port names allocated within each
MMModemPortInfo.

    ==261== 672 bytes in 84 blocks are definitely lost in loss record 7,314 of 7,383
    ==261== at 0x402C51E: malloc (vg_replace_malloc.c:299)
    ==261== by 0x4484878: g_malloc (gmem.c:94)
    ==261== by 0x449D51D: g_strdup (gstrfuncs.c:363)
    ==261== by 0x44B5B73: g_variant_dup_string (gvariant.c:1529)
    ==261== by 0x44B945E: g_variant_valist_get_nnp (gvariant.c:4775)
    ==261== by 0x44B945E: g_variant_valist_get_leaf (gvariant.c:4945)
    ==261== by 0x44B945E: g_variant_valist_get (gvariant.c:5126)
    ==261== by 0x44B922C: g_variant_valist_get (gvariant.c:5161)
    ==261== by 0x44B9FC9: g_variant_get_va (gvariant.c:5388)
    ==261== by 0x44BA3C5: g_variant_get_child (gvariant.c:5486)
    ==261== by 0x6613FA8: mm_common_ports_variant_to_garray (mm-common-helpers.c:238)
    ==261== by 0x6601AB9: ensure_internal_ports (mm-modem.c:766)
    ==261== by 0x6603E42: mm_modem_peek_ports (mm-modem.c:825)
    ==261== by 0x65CD94D: owns_port (nm-modem-broadband.c:196)

Reported-by: Piotr Figiel <p.figiel@camlintechnologies.com>
2017-02-10 10:29:52 +01:00
Aleksander Morgado
5a8620d984 cli: minor indentation fix 2017-02-08 18:38:03 +01:00
Piotr Figiel
255e4c769b libmm-glib: fix leaking bearer_path string
==261== 482 bytes in 12 blocks are definitely lost in loss record 7,290 of 7,383
    ==261== at 0x402C51E: malloc (vg_replace_malloc.c:299)
    ==261== by 0x4484878: g_malloc (gmem.c:94)
    ==261== by 0x449D51D: g_strdup (gstrfuncs.c:363)
    ==261== by 0x44B5B73: g_variant_dup_string (gvariant.c:1529)
    ==261== by 0x44B945E: g_variant_valist_get_nnp (gvariant.c:4775)
    ==261== by 0x44B945E: g_variant_valist_get_leaf (gvariant.c:4945)
    ==261== by 0x44B945E: g_variant_valist_get (gvariant.c:5126)
    ==261== by 0x44B922C: g_variant_valist_get (gvariant.c:5161)
    ==261== by 0x44B9FC9: g_variant_get_va (gvariant.c:5388)
    ==261== by 0x44BA1DB: g_variant_get (gvariant.c:5335)
    ==261== by 0x664E2EF: mm_gdbus_modem_simple_call_connect_finish (mm-gdbus-modem.c:22451)
    ==261== by 0x6608A08: simple_connect_ready (mm-modem-simple.c:154)
    ==261== by 0x429136F: g_task_return_now (gtask.c:1107)
    ==261== by 0x4291A69: g_task_return (gtask.c:1165)
2017-02-08 18:38:03 +01:00
Maksim Salau
0ea4b09fd6 blacklist: add promotion boards from Renesas
Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2017-02-05 20:56:23 +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
Aleksander Morgado
f20f2d0428 blacklist: add Analog PlutoSDR
Reported-by: Robin Getz <Robin.Getz@analog.com>
2017-01-31 00:44:21 +01:00
Dan Williams
ab48dc5b17 telit: add LTE access technology reporting 2017-01-28 21:54:13 -06:00
Aleksander Morgado
ef8cc29124 serial: minor indentation fix 2017-01-26 17:33:41 +01:00
Aleksander Morgado
3de34e94cc serial: fix handling errors in virtual serial ports
The g_socket_receive() method returns a signed size variable, so don't
use an unsigned variable to hold the result.
2017-01-26 17:33:41 +01: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
4e5d8d7e8c bearer-qmi: fix incorrect use of mm_base_bearer_get_status
This patch fixes a bug in packet_service_status_indication_cb(), which
incorrectly treats the MMBearerStatus enum value returned by
mm_base_bearer_get_status() as a MMBearerConnectionStatus enum value.
MMBearerStatus and MMBearerConnectionStatus can't be used
interchangeably as they have different enum values for the
'disconnected' and 'disconnecting' state.
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
Aleksander Morgado
2f12d96fe4 libmm-glib,modem: init/clear ports mutex 2017-01-04 13:45:38 +01:00
Thomas Haller
094fea5392 libmm-glib: fix memleak of MMModem's ports
Fixes: 3206e95663
2017-01-04 13:36:31 +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
Carlo Lobrano
9a92034cd3 device: fixed crash in SIM hot swap when removing the SIM
mm_device_create_modem needs a valid object_manager instance to create the new
modem, while the one provided before was cleared out by a call to
mm_device_remove_modem few lines before.

Since the newly created modem refers to the same HW device, we can use
the same object_manager also.

https://bugs.freedesktop.org/show_bug.cgi?id=99160
2016-12-20 16:15:37 +01:00
Carlo Lobrano
0bf4db6561 telit: blacklist LE866 flashing device
Moved blacklist code to 77-mm-usb-device-blacklist.rules as per code review
2016-12-12 10:55:04 +01:00
Aleksander Morgado
4197dd2e70 bearer-qmi: signal id may be 0 even if enable == FALSE
E.g. if the connection attempt fails, connect_context_complete_and_free() may
be called before the signals are connected to the QmiClients.

https://bugs.freedesktop.org/show_bug.cgi?id=99047
2016-12-11 12:45:09 +01:00
Aleksander Morgado
905c8a48e9 libqcdm,libwmc: use C99 sized types from stdint.h 2016-11-23 19:27:09 +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
c1e62794ae introspection: expand list of XMLs to install
And avoid including the wip-* XMLs in the dist tarball.
2016-11-21 20:20:12 +01:00
Aleksander Morgado
3b38ecb01e introspection: avoid white lines within <variablelist>
Looks like gdbus-codegen ends up making paragraphs and that breaks the
XML parsing:

      DOC   Building HTML
    ../../../../libmm-glib/generated/mm-gdbus-doc-org.freedesktop.ModemManager1.xml:60: parser error : Opening and ending tag mismatch: variablelist line 59 and para
    </para><para>          <varlistentry><term><literal>action</literal></term>
           ^
    ../../../../libmm-glib/generated/mm-gdbus-doc-org.freedesktop.ModemManager1.xml:110: parser error : Opening and ending tag mismatch: para line 110 and variablelist
    </para><para>        </variablelist>
                                        ^
    ../xml/ModemManager-dbus-reference.xml:93: element include: XInclude error : could not load ../../../../libmm-glib/generated/mm-gdbus-doc-org.freedesktop.ModemManager1.xml, and no fallback was found
2016-11-21 13:55:49 +01:00
Aleksander Morgado
30c2790aa4 kerneldevice,generic: load virtual devices without default rules
This is so that "make check" doesn't depend on having the rule files
installed in the default udev rules directory, which currently would
break the build:

    TEST: test-service-generic... (pid=2601)
      /MM/Service/Generic/enable-disable:                                  Activating service name='org.freedesktop.ModemManager1'
    Successfully activated service 'org.freedesktop.ModemManager1'

    ** (/home/aleksander/Development/foss/ModemManager/plugins/.libs/lt-test-service-generic:2601):
    ERROR **: Error setting test profile: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Failed to find primary AT port
    FAIL
    GTester: last random seed: R02S3897abaae9df36f8d2eeb679406ab675
    make[3]: *** [Makefile:3804: test-nonrecursive] Terminated
2016-11-21 13:44:08 +01:00
Aleksander Morgado
51e3d3d837 modem-helpers: improve +CCLK parsing
Added support for 4-digit format years (i.e. YYYY), and also made the
timezone information optional, as per +CSDF in 3GPP TS 27.007.

https://bugs.freedesktop.org/show_bug.cgi?id=95319
2016-11-18 10:25:07 +01:00
Aleksander Morgado
64b4afa960 kernel-device: return G_MAXUINT when get_property_as_int_hex() fails 2016-11-07 19:46:40 +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
4f748144b0 port-probe: don't probe ignored ports
If a port has been flagged as ignored with the ID_MM_PORT_IGNORE udev property,
we shouldn't open and probe the ports in any way, just flag them as ignored. We
still report them in the list of modem ports, but just with "unknown" type and
therefore not using them for anything.
2016-11-07 17:52:57 +01:00
Sam Spilsbury
a0b95db2b9 Makefile: Move to AM_DISTCHECK_CONFIGURE_FLAGS
Since automake 1.11.2 it is recommended that packages
use AM_DISTCHECK_CONFIGURE_FLAGS instead of
DISTCHECK_CONFIGURE_FLAGS as the latter is intended
to be a user variable.

https://bugs.freedesktop.org/show_bug.cgi?id=95826
2016-10-26 17:28:03 +02:00
Daniele Palmas
9583ec98fd broadband-modem-qmi: add QMI_PROTOCOL_ERROR_NOT_SUPPORTED case for pin status checking
Telit LE922A does not like the legacy way for checking pin status, but
instead of returning QMI_PROTOCOL_ERROR_INVALID_QMI_COMMAND, it returns
QMI_PROTOCOL_ERROR_NOT_SUPPORTED, making the modem not to be fully
initialized.

This patch adds QMI_PROTOCOL_ERROR_NOT_SUPPORTED as another error for
which the new pin checking status way is tried.
2016-10-25 15:52:27 +02: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
Lubomir Rintel
ccea14ac47 systemd: tighten the service security a bit
What's left enabled:

* Access to /dev -- obviously
* CAP_SYS_ADMIN -- this is needed by TIOCSSERIAL only. Too bad this also
  allows TIOCSTI, which allows for code injection unless something else
  (SELinux) disallows access to ttys with shells.
  Maybe kernel should use CAP_SYS_TTY_CONFIG for this.
* socket(AF_NETLINK) -- udev & kernel device changes
* socket(AF_UNIX) -- D-Bus
2016-10-24 13:15:15 +02:00