Commit Graph

220 Commits

Author SHA1 Message Date
Aleksander Morgado
b935782010 cinterion: increase ^SCFG? timeout to 120s
The timeout in this command is extremely large, because there are some
modules like the EGS5 that build the response based on the current
network registration, and that implies the module needs to be
registered. If for any reason there is no serving network where to
register, the response comes after a very long time, up to 100s.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/408
2021-07-29 13:06:11 +02:00
Aleksander Morgado
3e037dc158 plugins: AT/QCDM/GPS port type hints only applicable to TTY ports
There are modems out there, that reuse the same vid:pid for multiple
USB layouts, so there may be port type hints that are not really
applicable in all layouts.

E.g. the EM7565 in MBIM layout uses interface #0 for the MBIM port,
while in QMI layout it uses interface #0 for the QCDM port (which is
what the port type hint included in MM states). With these rules, if
we don't bind the port type hint to TTY ports only, we would be
wrongly flagging the MBIM port as possible QCDM port:

    <debug> [plugin/sierra] probes required for port cdc-wdm0: 'mbim'
    <debug> [cdc-wdm0/probe] no AT/QMI/MBIM probing in possible QCDM port
    <debug> [cdc-wdm0/probe] port is not AT-capable
    <debug> [cdc-wdm0/probe] port is not QMI-capable
    <debug> [cdc-wdm0/probe] port is not MBIM-capable
    <debug> [cdc-wdm0/probe] port probing finished: no more probings needed

Avoid this, by making sure all port type hints are added exclusively
to TTY ports. It's not a perfect solution, but it's enough for the
known cases.
2021-07-13 10:56:11 +02:00
Aleksander Morgado
4102cbc700 cinterion: ignore Intel Firmware Update service completely 2021-07-11 15:30:02 +02:00
Aleksander Morgado
dc09d3350c cinterion,shared: add missing interface prerequisites 2021-07-11 15:16:41 +02:00
Aleksander Morgado
b126e84b56 cinterion: implement custom shared reset operation
Implemented for all QMI, MBIM and AT based modems. The parent reset
operation always takes priority if available.
2021-07-10 17:20:41 +02:00
Aleksander Morgado
3dd3d6faf6 cinterion: new custom MBIM modem object 2021-07-10 17:04:00 +02:00
Aleksander Morgado
e1fbc1ccb7 cinterion: fix double free when loading initial EPS context
The properties object stored in the context is being returned as task
result; so we should make sure that object is no longer left in the
context so that it's not freed twice.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/395
2021-06-30 22:31:17 +02:00
Felipe Borges
0b8607bc5d cinterion: avoid maybe-uninitialized warning by GCC 10
Reported at https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1371
2021-05-27 15:05:55 +02:00
Aleksander Morgado
4038c243f9 cinterion: reuse the same method for load and reload
The load_() method is used for connection monitoring; while the
reload_() method is used to sync connection status after a
suspend/resume operation. The same method can be used for both things
in the Cinterion plugin.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
e4f106f311 broadband-modem-qmi: assume all QMI based modems support SIM hot swap
As we have a generic SIM hot swap implementation in the QMI broadband
modem object.
2021-05-26 12:20:00 +00:00
Aleksander Morgado
25a1b28fbf core: strict return type in g_object_ref()
This is now a requirement when using glib 2.56.
2021-04-30 11:05:42 +00:00
Aleksander Morgado
887358663d broadband-bearer: rely on profile management for the cid selection
There is no longer need to perform all the CID selection logic in the
broadband bearer connection procedure, we can rely on the new profile
management operations to do the same thing.

We can do this because we're sure that all the MMBroadbandModem
objects implement the MMModem3gppProfileManager interface.

Additionally, given that we now provide the profile ID value as part
of the MMBearerConnectResult, we no longer need a custom
mm_broadband_bearer_get_3gpp_cid() as we can use the generic
mm_base_bearer_get_profile_id() for the same purpose.
2021-04-29 10:13:22 +00:00
Aleksander Morgado
3179006351 cinterion: remove unused checkup of default IP family
Looks like the logic is just there to write a debug log, as the
selected IP family is not used anywhere else. Just remove this.
2021-03-31 23:13:33 +02:00
Aleksander Morgado
634682b602 cinterion: make sure FALSE sets GError in parse_smong_response()
The g_regex_match_full() method may return FALSE without setting the
GError, so that case needs to be considered.

In addition to that, the following g_assert() was not doing what it
should have been, as it was comparing the address of the variable and
not the variable itself; rework the code to avoid that as well:
  g_assert (access_tech != MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
2021-03-21 13:44:16 +01:00
Aleksander Morgado
d01bca493d cinterion: make sure FALSE sets GError in provcfg_response_to_cid()
The g_regex_match_full() method may return FALSE without setting the
GError, so that case needs to be considered.

Reported by Jan Mazura.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/347
2021-03-21 13:40:01 +01:00
Aleksander Morgado
5285e958ab cinterion: allow '*' in Prov/Cfg response
E.g. in a Cinterion PLS8-E (REVISION 04.004) to match the following
line:

  ^SCFG: "MEopMode/Prov/Cfg","fallback*"

Fix suggested by Jan Mazura.

See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/347
2021-03-21 13:39:33 +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
1b35d74c15 kernel-device: add get_interface_number() method
We already have methods to query for interface specific attributes
like class/subclass/protocol, so add a new one for the interface
number, and make sure we use ATTRS{bInterfaceNumber} to load it
always, instead of assuming the ID_USB_INTERFACE_NUM property is set.
2021-02-24 20:47:57 +01:00
Aleksander Morgado
ab4c31ec0b cinterion: rework mno decoding to use str_to_utf8() 2021-02-23 11:35:11 +00:00
Aleksander Morgado
6bc07b4b14 cinterion: rework band encoding to use str_to_utf8()
Also providing support to report errors when attempting to decode the
strings.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
3ac248a7a6 cinterion: move sequence to set bands to private ctx
The sequence of commands is exclusively used during the set current
bands operation, so there is no point in storing it in the private
object data.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
e5363b546b charsets: use new str_from_utf8() instead of take_and_convert_to_current_charset() 2021-02-23 11:35:11 +00:00
Andrew Lassalle
52b44aeb49 cinterion: remove unused variables 2021-02-03 09:31:28 -08:00
Aleksander Morgado
243272c111 cinterion: add AT primary/secondary port type hints for PLS8 2020-12-14 09:58:59 +01:00
Aleksander Morgado
ba4b3f60b7 cinterion: add QCDM and GPS port type hints for PLS62 2020-12-14 09:58:15 +01:00
Aleksander Morgado
067b09c835 cinterion: add PLS83 port type hints 2020-12-14 09:58:08 +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
f21fde3855 cinterion: fix port reference leaks
The mm_base_modem_get_port_*() returns a full reference, we should use
the mm_base_modem_peek_port_*() methods instead. Also, refactor a bit
the logic because both ports are really configured in the same way, so
just apply the same setup to both.
2020-11-04 09:51:14 +01:00
Aleksander Morgado
2d28969df7 cinterion: source reorder
The class object definition should always be last in the file,
following the interface definitions. The actual method implementations
should be given before any other type system method (i.e. before even
the _new() method).
2020-11-04 09:51:14 +01:00
Aleksander Morgado
35ecd45b66 cinterion: load initial EPS bearer cid only once
There is no need to reload it on every settings update attempt; just
load it once when the 3GPP interface is initialized, and re-use the
loaded value on every new update attempt.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
eb6ec1913f cinterion: fallback to RF on on error right away
Don't go to next step and then check if we need to jump to the RF on
step, jump right away.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
7e70911074 cinterion: failure to set low power in initial EPS setting is fatal
Attempting to change the initial EPS bearer settings while in full
functionality mode shouldn't happen, so make sure we don't attempt to
do that if going into low power mode fails.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
f280573f6d cinterion: setup SGAUTH response parser as a helper method 2020-11-04 09:50:13 +01:00
Aleksander Morgado
eb338c967f cinterion: move auth helpers to the helpers sources 2020-11-04 09:50:13 +01:00
Aleksander Morgado
9ce496613b cinterion: improve logging when loading initial EPS status or settings 2020-11-04 09:50:13 +01:00
Aleksander Morgado
411cce677d cinterion: refactor the initial EPS related logic
Multiple changes that shouldn't affect behavior:

 * Avoid reusing the same context and state machine for the set and
   the load operations, because they truly have different behaviors.

 * Setup the common load operation in a separate async method, and
   reuse the common operation for both the runtime state loading and
   the settings configuration loading.

 * Avoid having a "generic step ready" method, and instead provide
   proper ready methods for each step, so that we can give
   comprehensive warning logs when things fail.

 * Use the common CFUN? response parser instead of a custom
   implementation.
2020-11-04 09:50:13 +01:00
Aleksander Morgado
50c1550c9f cinterion: fix missing GError initialization 2020-10-14 14:41:19 +02:00
Jessy Diamond Exum
7f39c16c8c cinterion: Add SIM hot swap to AT broadband modems (PLS8 & PLAS9).
Enable the SCKS Unsolicited Result Code (URC) to detect SIM hot
swap, and trigger SIM redetection.
2020-09-15 07:35:04 +00:00
Jessy Diamond Exum
b1679b5893 cinterion: Configure the PLAS9 to correctly send Unsolicited Result Codes.
The PLS8 and PLAS9 modems (and likely many others modems supported by
this driver) have two AT capable serial ports: The 'MODEM' AT port
(default for PPP) and the 'APPLICATION' AT port (used for general
control).

The PLS8 modem sends URCs to the APPLICATION port by default, while he
PLAS9 defaults sending URCs to the MODEM port. To get URCs to behave
on both modems, it is necessary to explicitly set the URC reporting
port to APPLICATION.
2020-09-15 07:35:04 +00:00
Giacinto Cifelli
2f684ce92e cinterion: remove limitation to IPv4 only PDP contexts
There was a limitation in the past in the plugin, because one of the steps
during the dial (CONNECT_3GPP_CONTEXT_STEP_PDP_CTX) was to reconfigure a
specific CID hardcoding the IP type to IPv4.

That logic was removed in commit af2d6c1c4b,
but we didn't remove the IPv4 limitation at that point.
2020-08-11 15:52:45 +00:00
Giacinto Cifelli
a36beb0a95 cinterion: clarify role of the AT ports for the ELS61/PLS62 family 2020-08-11 15:33:57 +00:00
Giacinto Cifelli
e2ab49db0f cinterion: setup initial LTE parameters 2020-08-11 07:17:07 +00:00
Giacinto Cifelli
422a9070c4 cinterion: fixed cast from wrong object
MM_BROADBAND_MODEM_CINTERION shall be applied to a *MMBaseModem
    (ctx->modem here)
and not to a *MMBaseBearer (self here)
2020-08-04 11:04:17 +02:00
Giacinto Cifelli
4f1da87972 cinterion: IMT family SGAUTH
some ITM family modems require full parameters:
	AT^SGAUTH=cid,type,user,pwd
even when type is AUTH_NONE.
Fortunately, all modules of the IMT family tolerate this syntax,
so it can be adopted for the entire family.
2020-07-27 11:34:16 +00:00
Giacinto Cifelli
07ac85e2f7 cinterion: ignore ^SYSSTART urc 2020-07-27 12:24:17 +02:00
Giacinto Cifelli
408ec530e0 cinterion: extend SGAUTH syntax
AT^SGAUTH syntax depends on the modem family:
  AT^SGAUTH=cid,type,user,pwd   for the IMT family
  AT^SGAUTH=cid,type,pwd,user   for the rest
2020-07-27 09:42:03 +02:00
Giacinto Cifelli
cec6fe9cce cinterion: radio/band single scfg line: no variance
the AT^SCFG="Radio/Band" command does not return a different answer
for different charsets.
This code was working previously because the charset was left to default (GSM)
at the time of this operation, and therefore the string was unchanged anyway.
2020-07-26 13:33:05 +00: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
a131c6953a cinterion: quote user/password strings in AT^SGAUTH calls
The ELS61 doesn't like authentication given without quotes:
  [modem3/ttyACM1/at] --> 'AT^SGAUTH=8,1,tm,t-mobile<CR>'
  [modem3/ttyACM1/at] <-- '<CR><LF>+CME ERROR: 4<CR><LF>'

Only when user/pass strings are quoted it works:
  [modem6/ttyACM1/at] --> 'AT^SGAUTH=8,1,"t-mobile","tm"<CR>'
  [modem6/ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
2020-07-06 16:54:07 +02:00