Commit Graph

150 Commits

Author SHA1 Message Date
Aleksander Morgado
4b058872a0 plugins: don't add plugin name in log message explicitly 2020-04-08 17:53:42 +02:00
Aleksander Morgado
8722215f7e plugins: use logging module name as plugin name 2020-04-08 17:53:42 +02:00
Aleksander Morgado
e956bac47b log: common logging method definition for all testers and helpers 2020-04-08 17:53:42 +02:00
Aleksander Morgado
261ba90d08 cinterion: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
0f708daf0b modem-helpers: port supported modes filtering to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
9bcadea172 log: new object logging support
So that we can provide the specific object id in every log associated
to a given object.
2020-04-08 16:35:08 +02:00
Aleksander Morgado
00dc961cad iface-modem-location: common helper code to test raw gps 2020-02-07 14:42:16 +00:00
Aleksander Morgado
497398158f cinterion: fix warnings with -Wimplicit-fallthrough
cinterion/mm-broadband-bearer-cinterion.c: In function ‘dial_3gpp_context_step’:
  cinterion/mm-broadband-bearer-cinterion.c:393:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    393 |         ctx->step++;
        |         ~~~~~~~~~^~
  cinterion/mm-broadband-bearer-cinterion.c:396:5: note: here
    396 |     case DIAL_3GPP_CONTEXT_STEP_AUTH: {
        |     ^~~~
  cinterion/mm-broadband-bearer-cinterion.c:419:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    419 |         ctx->step++;
        |         ~~~~~~~~~^~
  cinterion/mm-broadband-bearer-cinterion.c:422:5: note: here
    422 |     case DIAL_3GPP_CONTEXT_STEP_START_SWWAN: {
        |     ^~~~
  cinterion/mm-broadband-bearer-cinterion.c: In function ‘disconnect_3gpp_context_step’:
  cinterion/mm-broadband-bearer-cinterion.c:613:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    613 |         ctx->step++;
        |         ~~~~~~~~~^~
  cinterion/mm-broadband-bearer-cinterion.c:615:5: note: here
    615 |     case DISCONNECT_3GPP_CONTEXT_STEP_STOP_SWWAN: {
        |     ^~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
eff4ca989d cinterion: fix warnings with -Wswitch-default
cinterion/mm-broadband-bearer-cinterion.c: In function ‘dial_3gpp_context_step’:
  cinterion/mm-broadband-bearer-cinterion.c:370:5: error: switch missing default case [-Werror=switch-default]
    370 |     switch (ctx->step) {
        |     ^~~~~~
  cinterion/mm-broadband-bearer-cinterion.c: In function ‘disconnect_3gpp_context_step’:
  cinterion/mm-broadband-bearer-cinterion.c:610:5: error: switch missing default case [-Werror=switch-default]
    610 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
546715490d cinterion: fix warnings with -Wswitch-enum
cinterion/mm-broadband-modem-cinterion.c: In function ‘common_create_bearer’:
  cinterion/mm-broadband-modem-cinterion.c:1699:5: error: enumeration value ‘FEATURE_SUPPORT_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   1699 |     switch (self->priv->swwan_support) {
        |     ^~~~~~
  ...
2020-01-31 15:18:35 +01:00
Aleksander Morgado
63d21151e2 cinterion: fix warnings with -Wimplicit-fallthrough
cinterion/mm-shared-cinterion.c: In function ‘disable_location_gathering_context_gps_step’:
  cinterion/mm-shared-cinterion.c:414:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
    414 |         ctx->gps_step++;
        |         ~~~~~~~~~~~~~^~
  cinterion/mm-shared-cinterion.c:417:5: note: here
    417 |     case DISABLE_LOCATION_GATHERING_GPS_STEP_SGPSS:
        |     ^~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
198529495a cinterion: fix warnings with -Wswitch-default
cinterion/mm-shared-cinterion.c: In function ‘disable_location_gathering_context_gps_step’:
  cinterion/mm-shared-cinterion.c:412:5: error: switch missing default case [-Werror=switch-default]
    412 |     switch (ctx->gps_step) {
        |     ^~~~~~
  cinterion/mm-shared-cinterion.c: In function ‘enable_location_gathering_context_gps_step’:
  cinterion/mm-shared-cinterion.c:665:5: error: switch missing default case [-Werror=switch-default]
    665 |     switch (ctx->gps_step) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
52e4a6744c cinterion,helpers: fix warnings with -Wdiscarded-qualifiers
CC       cinterion/tests/test_modem_helpers_cinterion-test-modem-helpers-cinterion.o
  cinterion/tests/test-modem-helpers-cinterion.c: In function ‘test_slcc_urc_single’:
  cinterion/tests/test-modem-helpers-cinterion.c:749:64: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    749 |         { 1, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE, "123456789" }
        |                                                                ^~~~~~~~~~~
  cinterion/tests/test-modem-helpers-cinterion.c: In function ‘test_slcc_urc_multiple’:
  cinterion/tests/test-modem-helpers-cinterion.c:764:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    764 |         { 2, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE,  "123456789" },
        |                                                                 ^~~~~~~~~~~
  cinterion/tests/test-modem-helpers-cinterion.c:765:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    765 |         { 3, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE,  "987654321" },
        |                                                                 ^~~~~~~~~~~
  cinterion/tests/test-modem-helpers-cinterion.c: In function ‘test_slcc_urc_complex’:
  cinterion/tests/test-modem-helpers-cinterion.c:781:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    781 |         { 1, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE,  "123456789" },
        |                                                                 ^~~~~~~~~~~
  cinterion/tests/test-modem-helpers-cinterion.c:782:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    782 |         { 2, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_WAITING, "987654321" },
        |
2020-01-31 14:52:49 +01:00
Aleksander Morgado
88983fd157 cinterion: use common re-registration logic when needed
If the modem requires +COPS re-registration after setting modes,
use the common logic provided by the 3GPP interface, which
already knows e.g. whether the registration was automatic or the
actual requested operator id in case of being manual.
2020-01-06 20:17:08 +00:00
Aleksander Morgado
8d96d1d660 cinterion: fix using correct finish() method in AT command
When using mm_base_modem_at_command_full(), the corresponding
mm_base_modem_at_command_full_finish() should be used.
2019-12-05 15:45:38 +01:00
Aleksander Morgado
45cf1ba20a cinterion: don't cache voice support check AT commands
The result of these commands may be different before and after SIM-PIN
unlock, so never cache them.
2019-10-17 08:31:46 +00:00
Aleksander Morgado
d5d0ed0b24 tests: print MM logs only on verbose test mode
Therefore, avoid needing ENABLE_TEST_MESSAGE_TRACES build symbol.
2019-10-14 15:30:27 +02:00
Aleksander Morgado
3b18d21ba5 tests: avoid g_print() and use g_debug() instead
The debug-level logs won't be printed e.g. during 'make check', but
will be included when running the tester manually.
2019-10-14 15:30:03 +02:00
Aleksander Morgado
a1148f878b cinterion: fix calling setup_unsolicited_events_finish() 2019-09-23 18:14:20 +02:00
Ben Chan
ee63bf4033 cinterion: fix memory leak in common_test_ctzu_urc() 2019-08-02 20:03:38 -07:00
Aleksander Morgado
8c8e0e8805 voice,call,cinterion: add Purism as copyright holder
The GSM supplementary services related changes, as well as the rework
done to manage calls per call id, is copyrighted by Purism SPC.
2019-07-12 11:31:04 +02:00
Aleksander Morgado
d833b8644c cinterion: setup/cleanup time unsolicited events
We will parse +CTZU URCs, which end up getting in the way of other
commands if we don't process them.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/135
2019-07-11 23:21:00 +02:00
Aleksander Morgado
fe11a3fa1f cinterion: new +CTZU URC parser 2019-07-11 23:21:00 +02:00
Aleksander Morgado
f699308958 cinterion: disable call list polling if ^SLCC is supported
Early detect that ^SLCC is supported, and disable the call list
polling in the interface if so.
2019-07-11 23:01:29 +02:00
Aleksander Morgado
faaaf20276 cinterion: when ^SLCC is supported, detailed call state updates are implicit 2019-07-11 23:01:08 +02:00
Aleksander Morgado
47dd9fffac cinterion: support ^SLCC URCs as part of voice management
This command will give us URCs whenever the extended list of current
calls changes, which includes information about the actual state of
each call, even for calls in waiting state.

Therefore, as this is a URC that applies to all calls, it's enabled
and disabled as part of the modem voice interface, instead of doing it
as part of the call object itself (i.e. not treated as an in-call URC).
2019-07-11 23:01:08 +02:00
Aleksander Morgado
e931c0ae9c cinterion: implement reset 2019-07-11 23:00:50 +02:00
Aleksander Morgado
0f8580f36e cinterion: port type hints for the PLS8
The first two ports are AT control ports (application/modem). We rely
on AT^SQPORT to decide which one is which.

The last two ports are unknown and we explicitly ignore them to make
port probing much quicker.
2019-07-11 23:00:50 +02:00
Ben Chan
8d8b3a722a misc: use g_regex_match() for simplicity
This CL converts a few g_regex_match_full() expressions to their
equivalent g_regex_match() in order to simplify the code, i.e.

  g_regex_match_full (regex, str, strlen (str), 0, 0, &match_info, NULL)

is equivalent to:

  g_regex_match_full (regex, str, -1, 0, 0, &match_info, NULL)

or simply:

  g_regex_match (regex, str, 0, &match_info)
2019-07-10 14:48:22 -07:00
Aleksander Morgado
1d52e5c24d cinterion: make custom +CIEV parser much more generic
The custom +CIEV parser configured for Cinterion modems was
exclusively matching the "psinfo" indicator updates, which were the
ones really used afterwards.

But, in order to avoid having undesired URCs mixed with other command
responses, we should anyway match any +CIEV indicator reported, not
only "psinfo".

The text indicator ids used in +CIEV seem to bee specific to Cinterion
devices when they're configured via AT^SIND, so we do a generic match
for any lowercase ascii text as indicator id.
2019-06-13 18:43:06 +02:00
Ben Chan
7de6b6f2e1 core: remove unnecessary NULL checks for g_match_info_free()
g_match_info_free() already check if the given pointer is NULL and does
nothing on a NULL pointer.
2018-10-18 13:17:36 +02:00
Aleksander Morgado
a19be8952f cinterion: report selected RTS/CTS flow control to modem 2018-09-12 17:15:46 +00:00
Aleksander Morgado
59e79c996b cinterion: new 'MMSharedCinterion' interface
Implement a new interface to keep the code shared between the QMI and
non-QMI modem implementations.

While doing that, also fix the parent interface pointer handling, so
that it isn't a static pointer applicable to all modems, and make it a
per-modem specific pointer. Without this fix, ModemManager would crash
if e.g. running with both a QMI and non-QMI Cinterion modem at the
same time.

The new shared Cinterion logic will be in charge of managing all GPS
sources not already managed by the parent interface. E.g. if the
parent implementation already supports QMI-based GPS location (using
the LOC service for example) prefer that to the custom AT-based
logic.
2018-08-21 17:06:55 +00:00
Aleksander Morgado
86f840d97b port-probe: explicitly report GPS port type if port flagged
And remove all custom logic from all plugins that were doing just that.
2018-08-10 04:19:13 +00:00
Aleksander Morgado
85adbdbdd1 plugins: consolidate ID_MM_PORT_TYPE_GPS flag name
Use the same flag name across all plugins with support for
NMEA-capable TTYs.
2018-08-10 04:19:13 +00:00
Aleksander Morgado
b8c7773a74 cinterion: fix band related unit tests
The sort_band() method used in the tester was totally wrong, it was
comparing the addresses of the variables instead of the MMModemBand
values.

Use the common mm_common_bands_garray_sort() instead, which works as
expected.
2018-07-31 00:23:25 +02:00
Reinhard Speyerer
ebe9fcd574 mm-modem-helpers-cinterion: update band table for PLS8-J
The default AT^SCFG="Radio/Band" value for Cinterion PLS8-J devices is
"16819472". Add UMTS band 19 and LTE band 19 entries based on the
information given in the PLS8 datasheet.
2018-07-30 21:22:07 +02:00
mstanger
7913fe4faf mm-modem-helpers-cinterion: update freq/band table
This info comes from PLS8-X/E/J/V/US, HC25 & PHS8 references, the
last two can be found publicly via Google search.

Swapped bit-mask locations for G850 & PCS bands as they may have
changed with FW or where accidently put in the wrong place.

Updated many 3G & 4G bit-mask fields.
2018-07-27 17:47:23 +02:00
Aleksander Morgado
c07382a486 udev: add tags also on bind action
When a new USB device is hotplugged, e.g. a USB<->RS232 converter that
exposes a single ttyUSB0, these udev events happen:

  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)

Our udev rules in MM only added tags in the 'add' events, and it looks
like the only ones 'persistent' after this sequence are those of the
last event happening on the specific path.

This meant that all TTY subsystem rules (e.g. ID_MM_CANDIDATE) would
be stored for later check (e.g. if ModemManager is started after these
rules have been applied), which was ok. "udevadm info -p ..." would
show these tags correctly always.

But this also meant that the 'bind' udev event happening for the USB
device didn't get any of our device-specific tags, and so we would be
missing them (e.g. ID_MM_DEVICE_MANUAL_SCAN_ONLY) if MM is started
after the last event has happened. "udevadm info -p ..." would
not show these tags.

Modify all our rules to also run at the 'bind' events.

See, for context:
  https://github.com/systemd/systemd/issues/8221
2018-06-02 16:54:37 +02:00
Aleksander Morgado
882f6b04d6 cinterion: port modem_create_bearer to GTask 2017-10-07 14:10:12 +02:00
Aleksander Morgado
e9f56ddf15 cinterion: port after_sim_unlock to GTask 2017-10-07 13:58:55 +02:00
Aleksander Morgado
b1948f83a5 cinterion: port load_unlock_retries_context to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
e1b2b88e68 cinterion: port setup_flow_control to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
926e0176fb cinterion: port set_current_bands to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
ea58d35947 cinterion: port load_current_bands to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
c1e17b9cad cinterion: port load_supported_bands to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
7f2520a83d cinterion: port register_in_network to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
f9e2ebf3a0 cinterion: port modem_power_off to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
00aa9cd09b cinterion: port modem_power_down to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
73f748f7ac cinterion: port messaging_check_support to GTask 2017-10-07 13:40:30 +02:00