Commit Graph

154 Commits

Author SHA1 Message Date
Aleksander Morgado
abc417f37a sierra: disable CPOL in the EM7345
Using CPOL? in the EM7345 (firmware FIH7160_V1.1_MODEM_01.1349.12)
ends up with the whole AT port stuck and non-responsive, which leads
to flagging the modem as unusable later on as soon as 10 consecutive
AT command timeouts happen.

In order to avoid that, we explicitly disable all CPOL based features
in this specific module.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/336
2021-03-12 12:41:35 +01:00
Aleksander Morgado
5d176a1e61 base-modem: explicitly say if NET or TTY data ports are supported
A modem that creates exclusively bearer objects that work with NET
ports (e.g. all QMI or MBIM modems) must not add any TTY port in the
list of data ports.

A modem that creates exclusively bearer objects that work with TTY
ports (e.g. the generic modem) must not add any NET port in the
list of data ports.

A modem that may use both TTY and NET ports should add all in the list
of data ports.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/324
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/329
2021-03-04 18:03:28 +01:00
Aleksander Morgado
5d150ed23e core,plugins: consolidate connection/disconnection timeout values
Each different plugin or protocol had a different connection attempt
value. E.g. QMI and MBIM both used 60s max for the connection attempt,
while the u-blox plugin had up to 180s for ECM based connection
setups.

This commit consolidates all plugins and protocols to use the same
timeout values for commands that may take long to respond, e.g. a
connection atempt under low signal quality conditions.

A value of 180s for the connection attempt steps and 120s for a
disconnection attempt step is considered. Note, though, that in some
cases (like a IPv4v6 setup attempt using QMI) we may have more than
one such long step, so this doesn't mean that a connection attempt
will always take less than 180s.

Users of the connection/disconnection APIs should be able to handle
the case where the attempt times out in their side (e.g. with a lower
DBus request timeout), and which would not mean the actual request
they did really failed. E.g. a connection attempt with a DBus timeout
of 30s may fail in the user with a timeout error, but the attempt
would still go on for as much as the plugin/protocol needs.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/270
2020-11-14 09:41:43 +00:00
Aleksander Morgado
950abbf8ee core: stop monitoring the 'usb' subsystem
Back in Linux < 3.6 days, the cdc-wdm ports exposed by the QMI driver
were flagged as owned by the 'usb' subsystem. That changed in 3.6 when
the subsystem was renamed to 'usbmisc':

  https://mail.gnome.org/archives/networkmanager-list/2012-June/msg00125.html

This patch removes all monitoring of the 'usb' subsystem completely,
which is anyway a valid subsystem but for which we shouldn't need any
special handling. Right now, with newer kernels, we were using that
monitoring exclusively to get notified of full USB device remove
events, which is really not required as we already process the port
removals one by one.

We simplify the logic everywhere that attempted to match either the
'usb' or 'usbmisc' subsystems, and we no longer require the explicit
checks for the port name being named 'cdc-wdm[0-9]*' in the code, as
that is already taken care of by the ID_MM_CANDIDATE udev tag rule.
2020-11-13 08:57:06 +00:00
Aleksander Morgado
86a183778b api,sim: new 'Active' property
In preparation for the multi-SIM setup, we need a way to tell whether
a given SIM card is active or not in the system.

On systems with one single SIM slot, the available SIM card will
always be active.

On Multi-SIM Single-Standby setups we may have multiple SIM slots with
multiple SIM cards, but only one of them will be active at any given
time.

On Multi-SIM Multi-Standby setups we may have multiple SIM slots with
multiple SIM cards that may be active at the same time. E.g. the QMI
protocol allows up to 5 different active SIM cards (primary,
secondary, tertiary...).
2020-08-28 14:59:06 +00:00
Aleksander Morgado
28ad994e37 sierra: XMM-specific features in XMM based modems (e.g. EM7345)
We create XMM-based modems like the EM7345 with XMM-specific features
like the AT+XLCSLSR based GNSS support. E.g.:

  $ mmcli -m a --location-status
    ------------------------
    Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
             |      enabled: 3gpp-lac-ci
             |      signals: no
    ------------------------
    GPS      | refresh rate: 30 seconds

  $ sudo mmcli -m a --location-enable-gps-nmea
  successfully setup location gathering

  $ sudo mmcli -m a --location-get
    --------------------------
    3GPP |      operator code: 214
         |      operator name: 7
         | location area code: 0000
         | tracking area code: 6FFE
         |            cell id: 0465CD20
    --------------------------
    GPS  |               nmea: $GPGSA,A,1,,,,,,,,,,,,,,,*1E
         |                     $GNGSA,A,1,,,,,,,,,,,,,,,,1*1D
         |                     $GNRMC,235951.000,V,,,,,,,,,,N,V*20
         |                     $GNVTG,,T,,M,,N,,K,N*32
         |                     $GNGGA,235951.000,,,,,0,0,,,M,,M,,*5F

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/25
2020-08-10 19:38:38 +02:00
Giacinto Cifelli
4d58278d7f changed default authentication algorithm to CHAP
CHAP is almost universal nowadays, and so it is a better default
than PAP

Not changed for uBlox, that prefers an error if not specified,
and for Huawei, which uses NONE with user/pwd and has 2 CHAP choices
2020-07-24 16:34:40 +02:00
Aleksander Morgado
4b37b7d3cf base-modem,at: response processors return a more specific enum
Instead of using the FALSE return of the method to indicate either a
fatal error (if result_error was set) or the continuation request (if
result_error wasn't set), provide a enum that has explicit states for
all three possible values (failure, success or continue).
2020-06-28 15:07:34 +02:00
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
d15da9cf60 sierra: port to use object logging 2020-04-08 16:35:10 +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
accd1a5841 base-modem: define new helper MMBaseModemAtCommandAlloc
It has the same exact format as MMBaseModemAtCommand, but its contents
are assumed heap allocated.

The only real purpose of this type is to allow defining static
constant MMBaseModemAtCommand variables without warnings when using
-Wdiscarded-qualifiers.
2020-01-31 15:18:35 +01:00
Aleksander Morgado
b8a8b772b4 sierra: remove unused cdma_manual_activation_context_free() 2020-01-31 14:52:49 +01:00
Aleksander Morgado
54a6e9fc85 sierra: fix warnings with -Wdiscarded-qualifiers
sierra/mm-broadband-modem-sierra.c:1815:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1815 |     { "!TIME?", 3, FALSE, parse_time_reply },    /* 3GPP */
        |       ^~~~~~~~
  sierra/mm-broadband-modem-sierra.c:1816:7: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   1816 |     { "!SYSTIME?", 3, FALSE, parse_time_reply }, /* CDMA */
        |       ^~~~~~~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado
4a74ae07bc sierra: fix warnings with -Wimplicit-fallthrough
sierra/mm-broadband-bearer-sierra.c: In function ‘dial_3gpp_context_step’:
  sierra/mm-broadband-bearer-sierra.c:304:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    304 |         ctx->step++;
        |         ~~~~~~~~~^~
  sierra/mm-broadband-bearer-sierra.c:306:5: note: here
    306 |     case DIAL_3GPP_STEP_PS_ATTACH:
        |     ^~~~
  sierra/mm-broadband-bearer-sierra.c:398:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    398 |         ctx->step++;
        |         ~~~~~~~~~^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado
8e216b30a6 sierra: fix warnings with -Wswitch-enum
sierra/mm-broadband-modem-sierra.c: In function ‘modem_time_load_network_time’:
  sierra/mm-broadband-modem-sierra.c:1733:5: error: enumeration value ‘TIME_METHOD_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   1733 |     switch (MM_BROADBAND_MODEM_SIERRA (self)->priv->time_method) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado
e71819fcfe sierra: fix warnings with -Wswitch-default 2020-01-31 14:52:49 +01:00
Aleksander Morgado
32d1f1deda sierra: implement manual CDMA activation 2019-12-03 08:43:40 +00:00
Aleksander Morgado
af08492209 sierra: implement automatic CDMA activation 2019-12-03 08:43:39 +00:00
Aleksander Morgado
23df25f25c sierra: setup as loadable 'shared' utils 2019-11-27 10:11:43 +00:00
Amol Lad
8f4b5b52ee sierra: add port hints for EM7565 modem 2019-11-19 16:01:41 +05:30
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
b0ec3030a3 sierra: add port type hints for the MC74xx modules
As suggested by Paul Bartell <paul.bartell@gmail.com>
2019-08-26 09:07:38 +02:00
Ben Chan
beb1aab178 sierra: remove unused 'self' variable in scact_periodic_query_ready() 2018-10-22 11:23:29 +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
fa67a4f9bb sierra-legacy: implement connection status monitoring with !SCACT?
Devices like the Netgear AC313U require explicit context monitoring,
otherwise the device may end up disconnected internally and MM would
still think that the connection is ongoing.
2018-10-09 14:34:59 +00: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
291300cfcb sierra: enable QMI connection status polling in Netgear AC341U
The Netgear AC341U seems to delay reporting packet service status
indications or actually not even send them. This leaves us with modems
in connected state in ModemManager but actually disconnected. We can
detect this situation by actively polling ourselves the connection
status.

See e.g. this case where the indication is received 2.5 mins after the
first OutOfCall error detected when loading statistics.

    Aug 30 22:52:50 ModemManager[574]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
    Aug 30 22:52:50 ModemManager[574]: <info>  Simple connect state (8/8): All done
    Aug 30 22:52:50 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:53:20 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:53:50 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:54:20 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:56:21 ModemManager[574]: <info>  bearer call end reason (2): 'generic-client-end'
    Aug 30 22:56:21 ModemManager[574]: <info>  bearer verbose call end reason (3,2000): [cm] client-end
    Aug 30 22:56:21 ModemManager[574]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> registered)
2017-11-23 14:20:39 +01:00
Aleksander Morgado
f710278b3d sierra: remove unneeded explicit casts 2017-09-18 21:21:59 -07:00
Aleksander Morgado
fd508d7057 sierra: skip setting GError if not used
The return status of mm_base_modem_at_command_finish() already
specifies whether an error has happened or not, so skip creating the
GError if we don't care about the actual error details.
2017-09-18 20:50:45 -07:00
Ben Chan
4fbd88395d sierra: port get_detailed_registration_state to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
7ca5e8875a sierra: port modem_time_check_support to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
509ba7475a sierra: port setup_registration_checks to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
26be99b8a7 sierra: port modem_power_down to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
841d175961 sierra: port modem_create_bearer to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
7446e411c7 sierra: port modem_load_own_numbers to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
85915853e5 sierra: port modem_after_sim_unlock to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
228bd14a11 sierra: port set_current_modes to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
5dbf7f77e2 sierra: port load_current_modes to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
abff4adf62 sierra: port load_supported_modes to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
8f129d64ed sierra: port load_access_technologies to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
f663022aca sierra: port modem_create_bearer to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
d0dc8b97a7 sierra: port disconnect_3gpp to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
4c2ebaba16 sierra: port dial_3gpp to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
043645ea57 sierra: port mm_common_sierra_load_power_state to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
1eb51d96f7 sierra: port mm_common_sierra_modem_power_up to use GTask 2017-09-18 20:39:03 -07:00
Ben Chan
c401646db8 sierra: port mm_common_sierra_custom_init to use GTask 2017-09-18 20:39:03 -07:00