Commit Graph

208 Commits

Author SHA1 Message Date
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
Aleksander Morgado
0a89a9ae4e cinterion: if user OR password given, don't set the other as (null)
[modem2/ttyACM1/at] --> 'AT^SGAUTH=8,1,t-d1,(null)<CR>'
  [modem2/ttyACM1/at] <-- '<CR><LF>+CME ERROR: 4<CR><LF>'

We should use an empty string instead.
2020-07-06 16:23:57 +02:00
Aleksander Morgado
e933fe1413 cinterion: increase SWWAN connection attempt timeout
It's critical not to timeout early on devices with AT ports, or we may
end up flagging the modem as invalid.

  ModemManager[26829]: <debug> [1593097973.552712] [modem1/ttyACM0/at] --> 'AT^SWWAN=1,2,1<CR>'
  ....
  ModemManager[26829]: <debug> [1593098064.195217] [modem1] couldn't connect bearer: Serial command timed out
  ....
  ModemManager[26829]: <error> [1593098091.167987] [modem1] port ttyACM0 timed out 10 consecutive times, marking modem as invalid
2020-07-06 16:23:36 +02:00
Aleksander Morgado
c79dcf7940 cinterion,signal: ^SMONI=? support check may be cached 2020-07-04 06:37:07 +02:00
Aleksander Morgado
ee262a473d cinterion,signal: report error from parent signal support check 2020-07-04 06:37:07 +02:00
Aleksander Morgado
2cb8e5ef5d cinterion,signal: minor coding style fixes 2020-07-04 06:37:07 +02:00
Walter Hagstrom
88923ffe39 iface-modem-signal: added 5G signal information
Extended the ModemManager Signal interface to include 5G signal
information for RSRP, RSRQ and SINR via libqmi.  Also extended mmci
to print 5G signal info.
2020-07-04 05:50:41 +02:00
Aleksander Morgado
ecf54efc67 cinterion: added port type hints for the mPLS62-w in MBIM mode
T:  Bus=01 Lev=02 Prnt=04 Port=01 Cnt=01 Dev#= 40 Spd=480 MxCh= 0
  D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
  P:  Vendor=1e2d ProdID=005d Rev=17.30
  S:  Manufacturer=Cinterion Wireless Modules
  S:  Product=PLSx
  C:  #Ifs=12 Cfg#= 1 Atr=e0 MxPwr=100mA
  I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=01 Driver=cdc_acm
  I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
  I:  If#=0xa Alt= 1 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
  I:  If#=0xb Alt= 2 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
  I:  If#=0x2 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
  I:  If#=0x3 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
  I:  If#=0x4 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
  I:  If#=0x5 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
  I:  If#=0x6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
  I:  If#=0x7 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
  I:  If#=0x8 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
  I:  If#=0x9 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
2020-06-19 12:28:57 +00:00
Aleksander Morgado
c2ee73173e cinterion: allow MBIM-powered devices
Like the mPLS62-w when setup to be controlled in MBIM mode instead of
plain AT commands.
2020-06-19 12:28:57 +00:00
Giacinto Cifelli
df36f8d2d3 cinterion: fix syntax error for setting radio/bands/[23]g 2020-05-28 05:30:08 +02:00
Giacinto Cifelli
0cc5a6ce4f cinterion: skip sim ready check for modules that don't support it 2020-05-27 05:33:12 +00:00
Giacinto Cifelli
84ec3d2fcf cinterion: simplify check
no longer need to check the charset because of the fix in charsets,
that now accepts GSM and UCS2.
2020-05-26 14:26:14 +00:00
Aleksander Morgado
87b8c9b295 cinterion: minor coding style fixes in new band management 2020-05-26 15:05:52 +02:00