Commit Graph

7030 Commits

Author SHA1 Message Date
Aleksander Morgado
15a941fae5 broadband-modem-qmi: only use "Data Service Capabilities" array if content given
See https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/32#note_505065
2020-05-25 06:58:14 +00:00
Aleksander Morgado
29a68c94b9 huawei: ignore ^CCALLSTATE URCs for now
We will want to support these to avoid needing to have CLCC call
polling, but for now, just ignore them so that they don't interfere
with the call management.

For context, see:
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/216
2020-05-22 10:58:29 +02:00
Aleksander Morgado
1eeec40ee8 iface-modem-voice: fix assert() when setting up call polling
If an incoming call is detected during the CLCC polling, the polling
timeout will already be set, so don't assert when checking the polling
id afterwards, just make sure we don't reset the timeout.

https://lists.freedesktop.org/archives/modemmanager-devel/2020-May/007866.html
2020-05-21 15:03:17 +02:00
Aleksander Morgado
98fa83a693 cinterion,tests: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  cinterion/tests/test-modem-helpers-cinterion.c: In function 'common_test_scfg':
  cinterion/tests/test-modem-helpers-cinterion.c:56:56: error: cast increases required alignment of target type [-Werror=cast-align]
       expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)expected_bands->data,
                                                          ^
  cinterion/tests/test-modem-helpers-cinterion.c:58:47: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_str = mm_common_build_bands_string ((const MMModemBand *)bands->data,
                                                 ^
  cinterion/tests/test-modem-helpers-cinterion.c: In function 'common_test_scfg_response':
  cinterion/tests/test-modem-helpers-cinterion.c:209:56: error: cast increases required alignment of target type [-Werror=cast-align]
       expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)expected_bands->data,
                                                          ^
  cinterion/tests/test-modem-helpers-cinterion.c:211:47: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_str = mm_common_build_bands_string ((const MMModemBand *)bands->data,
                                                 ^
2020-05-19 13:49:53 +02:00
Aleksander Morgado
b71ae9ce72 wavecom: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  wavecom/mm-broadband-modem-wavecom.c: In function 'set_bands_3g':
  wavecom/mm-broadband-modem-wavecom.c:800:50: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array_final->data,
                                                    ^
  wavecom/mm-broadband-modem-wavecom.c: In function 'set_bands_2g':
  wavecom/mm-broadband-modem-wavecom.c:872:50: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array_final->data,
                                                    ^
2020-05-19 13:45:34 +02:00
Aleksander Morgado
8bf1329481 libmm-glib,helpers: use locale-independent strtod()
Otherwise parsing may fail, e.g. as in this unit test:

  # Start of smoni tests
  # DEBUG: testing SMONI response: ^SMONI: 2G,71,-61,262,02,0143,83BA,33,33,3,6,G,NOCONN
  # DEBUG: testing SMONI response: ^SMONI: 2G,SEARCH,SEARCH
  # DEBUG: testing SMONI response: ^SMONI: 2G,673,-89,262,07,4EED,A500,16,16,7,4,G,5,-107,LIMSRV
  # DEBUG: testing SMONI response: ^SMONI: 2G,673,-80,262,07,4EED,A500,35,35,7,4,G,643,4,0,-80,0,S_FR
  # DEBUG: testing SMONI response: ^SMONI: 3G,10564,296,-7.5,-79,262,02,0143,00228FF,-92,-78,NOCONN
  **
  ERROR:cinterion/tests/test-modem-helpers-cinterion.c:1036:test_smoni_response: assertion failed (fabs (ecn0 - smoni_response_tests[i].ecn0) < 0.1): (0,5 < 0,1)
  Bail out! ERROR:cinterion/tests/test-modem-helpers-cinterion.c:1036:test_smoni_response: assertion failed (fabs (ecn0 - smoni_response_tests[i].ecn0) < 0.1): (0,5 < 0,1)
  Aborted (core dumped)
2020-05-19 13:44:23 +02:00
Aleksander Morgado
58ae8f4c24 cinterion,helpers: minor coding style fix 2020-05-19 13:44:23 +02:00
Aleksander Morgado
9bfc8a7829 novatel-lte: use GPtrArray to build a GStrv
novatel/mm-broadband-modem-novatel-lte.c: In function 'response_processor_nwmdn_ignore_at_errors':
  novatel/mm-broadband-modem-novatel-lte.c:241:19: error: cast increases required alignment of target type [-Werror=cast-align]
       own_numbers = (GStrv) g_array_free (array, FALSE);
                     ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
a2b0cee935 huawei,helpers: fix warnings with -Wcast-align
huawei/mm-modem-helpers-huawei.c: In function 'match_info_to_ip4_addr':
  huawei/mm-modem-helpers-huawei.c:193:39: error: cast increases required alignment of target type [-Werror=cast-align]
       *out_addr = GUINT32_SWAP_LE_BE (*((guint32 *) bin));
                                         ^
  /usr/include/glib-2.0/glib/gtypes.h:184:77: note: in definition of macro 'GUINT32_SWAP_LE_BE'
   #    define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((gint32) (val)))
                                                                               ^~~
2020-05-19 13:44:23 +02:00
Aleksander Morgado
bd2e6f5df4 huawei: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  huawei/mm-broadband-modem-huawei.c: In function 'set_current_bands':
  huawei/mm-broadband-modem-huawei.c:916:50: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array->data,
                                                    ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
175bedf920 xmm: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  xmm/mm-shared-xmm.c: In function 'validate_and_build_command_set_current_bands':
  xmm/mm-shared-xmm.c:512:45: error: cast increases required alignment of target type [-Werror=cast-align]
           str = mm_common_build_bands_string ((const MMModemBand *)unapplied_bands->data, unapplied_bands->len);
                                               ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
ccf16e00a7 ublox,helpers: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  ublox/mm-modem-helpers-ublox.c: In function 'parse_bands_from_string':
  ublox/mm-modem-helpers-ublox.c:1612:48: error: cast increases required alignment of target type [-Werror=cast-align]
           tmpstr = mm_common_build_bands_string ((MMModemBand *)(bands->data), bands->len);
                                                  ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
76d06ce697 cinterion,helpers: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  cinterion/mm-modem-helpers-cinterion.c: In function 'mm_cinterion_build_band':
  cinterion/mm-modem-helpers-cinterion.c:409:54: error: cast increases required alignment of target type [-Werror=cast-align]
           bands_string = mm_common_build_bands_string ((MMModemBand *)bands->data, bands->len);
                                                        ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
b0be4e895c telit,helpers: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  telit/mm-modem-helpers-telit.c: In function 'mm_telit_build_bnd_request':
  telit/mm-modem-helpers-telit.c:256:55: error: cast increases required alignment of target type [-Werror=cast-align]
               bands_str = mm_common_build_bands_string ((const MMModemBand *)(bands_array->data), bands_array->len);
                                                         ^
  telit/mm-modem-helpers-telit.c:275:55: error: cast increases required alignment of target type [-Werror=cast-align]
               bands_str = mm_common_build_bands_string ((const MMModemBand *)(bands_array->data), bands_array->len);
                                                         ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
301b6f0a64 plugins,tests: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  tests/test-helpers.c: In function 'mm_test_helpers_compare_bands':
  tests/test-helpers.c:41:47: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_str = mm_common_build_bands_string ((MMModemBand *)(bands->data), bands->len);
                                                 ^
  tests/test-helpers.c:46:56: error: cast increases required alignment of target type [-Werror=cast-align]
       expected_bands_str = mm_common_build_bands_string ((MMModemBand *)(expected_bands_array->data), expected_bands_array->len);
                                                          ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
c7dee320c0 test-qcdm-serial-port: fix warnings with -Wsign-compare
test-qcdm-serial-port.c: In function 'wait_for_child':
  test-qcdm-serial-port.c:57:52: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
           if (d->child && (now.tv_sec - start.tv_sec > timeout)) {
                                                      ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
71d8bb2ec8 iface-modem-messaging: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  mm-iface-modem-messaging.c: In function 'load_supported_storages_ready':
  mm-iface-modem-messaging.c:1154:53: error: cast increases required alignment of target type [-Werror=cast-align]
           mem1 = mm_common_build_sms_storages_string ((MMSmsStorage *)storage_ctx->supported_mem1->data,
                                                       ^
  mm-iface-modem-messaging.c:1156:53: error: cast increases required alignment of target type [-Werror=cast-align]
           mem2 = mm_common_build_sms_storages_string ((MMSmsStorage *)storage_ctx->supported_mem2->data,
                                                       ^
  mm-iface-modem-messaging.c:1158:53: error: cast increases required alignment of target type [-Werror=cast-align]
           mem3 = mm_common_build_sms_storages_string ((MMSmsStorage *)storage_ctx->supported_mem3->data,
                                                       ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
ffbbec4a0d iface-modem-location: avoid warnings with -Wsign-compare
mm-iface-modem-location.c: In function 'location_gps_update_nmea':
  mm-iface-modem-location.c:272:61: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                time (NULL) - ctx->location_gps_nmea_last_time >= mm_gdbus_modem_location_get_gps_refresh_rate (skeleton))) {
                                                               ^~
  mm-iface-modem-location.c:282:60: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                time (NULL) - ctx->location_gps_raw_last_time >= mm_gdbus_modem_location_get_gps_refresh_rate (skeleton))) {
                                                              ^~
2020-05-19 13:44:23 +02:00
Aleksander Morgado
7ccec0bd71 iface-modem: avoid cast-align errors
We can safely cast the data in a GArray to gpointer first, and then
to the pointer type we require.

  mm-iface-modem.c: In function 'after_set_load_current_bands_ready':
  mm-iface-modem.c:2358:55: error: cast increases required alignment of target type [-Werror=cast-align]
           requested_str = mm_common_build_bands_string ((MMModemBand *)requested_bands->data, requested_bands->len);
                                                         ^
  mm-iface-modem.c:2359:55: error: cast increases required alignment of target type [-Werror=cast-align]
           current_str   = mm_common_build_bands_string ((MMModemBand *)current_bands->data, current_bands->len);
                                                         ^
  mm-iface-modem.c: In function 'validate_bands':
  mm-iface-modem.c:2474:48: error: cast increases required alignment of target type [-Werror=cast-align]
                                                  (const MMModemBand *)supported_bands_array->data,
                                                  ^
  mm-iface-modem.c: In function 'mm_iface_modem_set_current_bands':
  mm-iface-modem.c:2535:50: error: cast increases required alignment of target type [-Werror=cast-align]
       bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array->data,
                                                    ^
2020-05-19 13:44:23 +02:00
Aleksander Morgado
3476e140ad modem-helpers: use GPtrArray to build a GStrv
So that we avoid errors when building on ARM due to increasing target
type alignment.

  mm-modem-helpers.c: In function 'mm_3gpp_parse_cnum_exec_response':
  mm-modem-helpers.c:3206:21: error: cast increases required alignment of target type [-Werror=cast-align]
       return (array ? (GStrv) g_array_free (array, FALSE) : NULL);
                       ^
2020-05-19 13:44:23 +02:00
Giacinto Cifelli
8e033ba331 AT modem: charset definition in init
Charset definition moved from enable state machine to init state machine,
so that the right current charset is available also during further
initialization steps
2020-05-18 16:50:33 +02:00
Aleksander Morgado
503581a3ac port-qmi: plug memleak when explicitly releasing client
==43111== 24 bytes in 1 blocks are definitely lost in loss record 1,999 of 5,339
  ==43111==    at 0x483BB65: calloc (vg_replace_malloc.c:762)
  ==43111==    by 0x50259D1: g_malloc0 (in /usr/lib/libglib-2.0.so.0.6400.2)
  ==43111==    by 0x22AAB8: mm_port_qmi_allocate_client (mm-port-qmi.c:201)
  ==43111==    by 0x2007F0: parent_enabling_started_ready (mm-broadband-modem-qmi.c:9114)
  ==43111==    by 0x4E68653: ??? (in /usr/lib/libgio-2.0.so.0.6400.2)
  ==43111==    by 0x4E6DA26: ??? (in /usr/lib/libgio-2.0.so.0.6400.2)
  ==43111==    by 0x1C535E: enabling_flash_done (mm-broadband-modem.c:10318)
  ==43111==    by 0x4E68653: ??? (in /usr/lib/libgio-2.0.so.0.6400.2)
  ==43111==    by 0x4E6DA26: ??? (in /usr/lib/libgio-2.0.so.0.6400.2)
  ==43111==    by 0x224F0B: flash_do (mm-port-serial.c:1776)
  ==43111==    by 0x502AC03: ??? (in /usr/lib/libglib-2.0.so.0.6400.2)
  ==43111==    by 0x502B58E: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6400.2)
  ==43111==
2020-05-16 10:33:29 +02:00
Giacinto Cifelli
fae614becf udev rules for the PLS62 in 005b enumeration 2020-05-16 09:37:46 +02:00
Aleksander Morgado
6b36fe9f19 huawei: NDISDUP based devices may use plain TTYs for control
So don't warn if no associated cdc-wdm port is found.
2020-05-15 14:12:12 +02:00
Giacinto Cifelli
f109b528d3 plugins/cinterion: added Signal interface
Not all Cinterion modems support AT+CESQ.
However a much larger group of them support AT^SMONI
This commit uses the latter instead of the default former.
2020-05-15 13:49:18 +02:00
Aleksander Morgado
8b7bdea7e0 telit: flag GPS port in the LE910C1 2020-05-14 15:34:47 +00:00
David Khouya
9c77fb8834 telit: add LE910C1 udev rule 2020-05-14 15:34:47 +00:00
Giacinto Cifelli
bbd39a457c configure.ac: check for xsltproc 2020-05-14 09:48:35 +02:00
Aleksander Morgado
d33a883be4 build: require libmbim 1.23.1 for autoptr support 2020-05-13 10:06:37 +02:00
Aleksander Morgado
26b589cc02 broadmobi: new plugin
Right now, just with port type hints for the BM818.
2020-05-10 10:51:45 +02:00
Aleksander Morgado
0ddadbdc37 port: use correct enum to string conversion when logging
CC       mm-port.lo
    mm-port.c: In function 'log_object_build_id':
    mm-port.c:117:60: error: implicit conversion from 'MMPortType' to 'MMModemPortType' [-Werror=enum-conversion]
      117 |                             mm_modem_port_type_get_string (mm_port_get_port_type (self)));
          |                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
2020-05-10 09:56:10 +02:00
Aleksander Morgado
83952c5a30 bearer-qmi: get correct bearer object pointer from task
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/207
2020-05-08 13:24:14 +02:00
Aleksander Morgado
d4a45315cf cli: add allowed-auth bearer property in output
Given as a list of items, because the bearer can be created with one
or more allowed authentication protocols.
2020-05-05 11:28:37 +00:00
Eric Caruso
dfc2c51b9c introspection: use correct node name for ModemManager1 object
In the D-Bus specification it is stated that the root node of
an introspection file should have an absolute path[1]. This path
should not be the root path in D-Bus as putting objects there is
considered incorrect, and also because the MM1 object does not
actually sit at the root path (instead, it uses MM_DBUS_PATH, which
is /org/freedesktop/ModemManager1). Fix this in the introspection
file.

[1] https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format
2020-05-01 14:12:43 -07:00
Murithi Borona
479d8e723c huawei: updated HCSQ regex to match unquoted response 2020-04-28 15:09:49 +02:00
Aleksander Morgado
18a7d9da7a broadband-modem-qmi: GByteArray can be casted to GArray in USSD encoding
Reported by: Maxim Anisimov <linaro85@yandex.ru>
2020-04-22 18:08:41 +02:00
Maxim Anisimov
d3c5771b1f broadband-modem-qmi: USSD data in UTF-16 not always given
E.g. in the Quectel EP06-E only the ASCII/UCS-2 data TLV is given.
2020-04-22 18:08:41 +02:00
Maxim Anisimov
6086c6877c broadband-modem-qmi: fix unicode names in USSD iconv() operations
So that the limited iconv() in OpenWRT supports the conversion
properly.
2020-04-22 15:42:26 +02:00
Aleksander Morgado
ae90ed66a2 broadband-modem-qmi: 3GPP USSD support
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/26
2020-04-20 16:48:52 +02:00
Teijo Kinnunen
d98597e430 quectel: Check SIM swap after "+QUSIM: 1" URC
Quectel emits "+QUSIM: 1" after eUICC reinitialization. Detect it
and perform SIM swap check if one is encountered.

The motivation here is that M2M eUICC profile switch causes eUICC
reset and this is one way to detect and handle profile switches
properly on Quectel modems. The existing SIM hot swap mechanism is
used as it appears to be suitable for handling profile switches as
well as physical swapping of SIM cards.
2020-04-17 07:45:47 +00:00
Aleksander Morgado
1802bd07ac man,mmcli: remove non-existent --list-bearers option
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/203
2020-04-16 15:52:54 +02:00
Aleksander Morgado
b95bcfe6e3 api,location: improve InjectAssistanceData() method docs
Explain when this method should be used instead of A-GPS.
2020-04-12 17:49:36 +02:00
Aleksander Morgado
ef56114244 api,location: improve Setup() method docs
Explicitly state that the signals_location argument affects the
behavior of the Location property.
2020-04-12 17:40:52 +02:00
Aleksander Morgado
d93526a114 api,location: improve Location property docs
Clearly specify that GetLocation() is another way to retrieve the
location information instead of the Location property.
2020-04-12 17:15:58 +02:00
Aleksander Morgado
330e0b33a4 base-bearer: log connection attempt failure reason
We were logging it as debug, increase logging level to warning to make
sure it's always logged.
2020-04-10 11:45:03 +00:00
Aleksander Morgado
073043ca6b base-bearer: log stats on disconnection 2020-04-10 11:45:03 +00:00
Aleksander Morgado
eebd7582bb base-bearer: don't run disconnection path multiple times 2020-04-10 11:45:03 +00:00
Aleksander Morgado
79daa3099e api,bearer: add 'total-rx-bytes', 'total-tx-bytes' and 'total-duration' stats
Compiling the amount of bytes transferred and received during all
tracked connection attempts, as well as the total duration of all the
connections.
2020-04-10 11:45:03 +00:00
Aleksander Morgado
f325ef5902 api,bearer: add 'attempts' and 'failed-attempts' statistics
When we're reusing over and over the same bearer object, we can
provide statistical information about the number of connection
attempts that have been done and how many of them failed.
2020-04-10 11:45:03 +00:00
Aleksander Morgado
b3ec30403f doc,api: add reference to --with-at-command-via-dbus in Command() info 2020-04-10 11:38:47 +02:00