Commit Graph

46 Commits

Author SHA1 Message Date
Carlo Lobrano
ac243f9467 sms: prevent crash if date is out of range
g_date_time_new, and g_date_time_new_utc return NULL if inputs are out
of range, and currently mm_new_iso8601_time passes the GDateTime created
by those two functions to date_time_format_iso8601 without checking for
NULL values, causing a g_date_time_format_iso8601 crash if PDU data is
corrupted with wrong date.

To prevent this, mm_new_iso8601_time now can return NULL and set a new
GError if GDateTime created by g_date_time_new is NULL.

Fixes #546
2022-04-08 15:41:49 +02:00
Frederic Martinsons
9d82d30978 cli, plugins: factorize usage of iso8601 datetime format
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

Includes updates by Aleksander Morgado to fix coding style issues.
2021-10-22 13:48:20 +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
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
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
Andrew Lassalle
52b44aeb49 cinterion: remove unused variables 2021-02-03 09:31:28 -08: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
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
Giacinto Cifelli
e2ab49db0f cinterion: setup initial LTE parameters 2020-08-11 07:17:07 +00: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
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
Giacinto Cifelli
793132d56d cinterion: radio/band handling for LTE modems 2020-05-26 15:05:52 +02:00
Aleksander Morgado
0926031119 Revert "charsets: don't warn in unlikely case of needing to convert to HEX from UTF-8"
This reverts commit 6a7dd87f30.

Reverting because the merge request was set to squash all together....
2020-05-26 15:04:20 +02:00
Giacinto Cifelli
6a7dd87f30 charsets: don't warn in unlikely case of needing to convert to HEX from UTF-8
This would really be an implementation detail, not a real use
case. Just don't warn in this case, as in the conversion in the
opposite direction.
2020-05-26 12:45:40 +00:00
Aleksander Morgado
58ae8f4c24 cinterion,helpers: minor coding style fix 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
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
261ba90d08 cinterion: port to use object logging 2020-04-08 16:35:09 +02: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
fe11a3fa1f cinterion: new +CTZU URC parser 2019-07-11 23:21:00 +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
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
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
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
aae7105743 cinterion: update frequency bands support
Updated to use the non-deprecated MMModemBand values.
2017-09-07 10:55:17 +02:00
Aleksander Morgado
f4c4e36461 cinterion: use ^SIND unsolicited messages for access tech reporting
If the modem supports ^SIND psinfo reporting, we enable the URC and
flag the access technology polling unsupported, so that we only update
access technology via the +CIEV URCs.

E.g.:

    (ttyACM1): --> 'AT^SIND="psinfo",1<CR>'
    (ttyACM1): <-- '<CR><LF>^SIND: psinfo,1,10<CR><LF><CR><LF>OK<CR><LF>'
    Reporting initial access technologies...
    Modem /org/freedesktop/ModemManager1/Modem/0: access technology changed (unknown -> hsdpa, hsupa)
    ...
    (ttyACM1): <-- '<CR><LF>+CIEV: psinfo,4<CR><LF>'
    Modem /org/freedesktop/ModemManager1/Modem/0: access technology changed (hsdpa, hsupa -> edge)
    ...
2017-06-06 15:21:08 +02:00
Aleksander Morgado
c1d04f4cc0 cinterion: improve ^SCFG=? response parser to handle EHS5 format
Two main changes in the regex:
  * Ignore double quotes around interval numbers.
  * Ignore second set of values (i.e. the one after the comma), as it
  may not even be given).

We now support at least these two formats:
   ^SCFG: "Radio/Band",("1-511","0-1")
   ^SCFG: "Radio/Band\",("1"-"147")

Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-03-07 18:40:51 +01:00
Aleksander Morgado
37df2643d2 cinterion: improve ^SMONG response parser:
* Allow whitespaces prefixing the values row.
  * Allow more than one \r\n between the title and the table header.

Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-02-16 12:27:57 +01:00
Aleksander Morgado
421713208b cinterion: support number ranges in CNMI=? parser
https://lists.freedesktop.org/archives/modemmanager-devel/2017-February/003911.html
2017-02-13 10:47:20 +01:00
Aleksander Morgado
11297bcc79 cinterion: implement connection status monitoring via ^SWWAN?
And consolidate the connection status checks done during connection and
disconnection so that we re-use the same logic.
2017-01-04 14:11:17 +01:00
Aleksander Morgado
37521ed2b6 cinterion: simplify ^SWWAN response parsing
We get as input the ^SWWAN index we're interested in, and we loop
through the list of ^SWWAN lines looking for the one we need.

This updated helper method allows working with multi-line ^SWWAN
responses, e.g. given when more than one PDP context is active.
2017-01-04 14:11:17 +01:00
Matthew Stanger
1ffcb16349 cinterion: implement support for the new SWWAN interface 2017-01-04 14:11:17 +01:00
Aleksander Morgado
58d2806f4c cinterion: new 'AT+CNMI=?' parser helper 2014-06-25 15:04:09 +02:00
Aleksander Morgado
191168e3ef cinterion: after SIM unlock, query SIM status until ready 2014-03-03 14:33:12 +01:00
Aleksander Morgado
f2024b78b2 cinterion: consolidate setting current bands in 2G and 3G devices 2014-02-28 16:37:32 +01:00
Aleksander Morgado
c1e2a3a5bc cinterion: consolidate current bands loading for 2G and 3G devices 2014-02-28 16:35:18 +01:00
Aleksander Morgado
0877f68a84 cinterion: consolidate supported bands loading for 2G and 3G devices 2014-02-28 16:35:18 +01:00
Aleksander Morgado
87d867c8ae cinterion: add helper to build Cinterion band mask 2014-02-28 16:35:18 +01:00
Aleksander Morgado
e6430acaaa cinterion: add helper to parse AT^SCFG="Radio/Band" response in 3G devices 2014-02-28 16:35:18 +01:00
Aleksander Morgado
82067915d1 cinterion: use AT^SCFG=? to parse supported bands in 3G devices 2014-02-28 16:35:18 +01:00