Commit Graph
308 Commits
Author SHA1 Message Date
Daniele Palmas 0e1ba4c530 modem-helpers-qmi: support EUTRAN bands 85 and 106
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-07-09 10:41:43 +02:00
Daniele Palmas c070b9015e test,modem-helpers-qmi: add unit tests for bands
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-07-09 10:33:26 +02:00
Guido Günther aa9447c833 tests: Allow to run some tests under asan
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 16:10:05 -05:00
Guido Günther 04229ca146 modem-helpers: Don't leak in tests
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 16:10:05 -05:00
Guido Günther 5ecf00aaf0 cbm: Don't leak cbm-part in tests
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 15:27:08 -05:00
Guido Günther c89266facb cbm: Don't check language past free
Fixes: 3559f606d ("cbm-part: Fix parsing of language encodings")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 15:27:08 -05:00
Dan Williams dad2d49b69 tests: test call DTMF functionality
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 08:06:11 -05:00
Dan Williams 56fe8e7d31 modem-helpers: add utility function to split DTMF runs
Split into groups of non-pause characters and single pause characters
by themselves and return as an array of strings.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 08:02:47 -05:00
Dan Williams a769bbed6d port-serial: add serial port command scheduler
Add an interface and implementation for a port scheduler that round-
robins between ports the scheduler is attached to, serializing command
execution among one or more MMPortSerial instances.

Theory of operation:

Sources (e.g. MMPort subclasses) register themselves with the scheduler.

Each source notifies the scheduler whenever its command queue depth changes,
for example when new commands are submitted, when commands are completed,
or when commands are canceled.

The scheduler will round-robin between all sources with pending commands,
sleeping when there are no pending commands from any source.

For each source with a pending command the scheduler will emit the
'send-command' signal with that source's ID. The given source should
send the next command in its queue to the modem.

When that command is finished (either successfully or with an error/timeout)
the source must call mm_port_scheduler_notify_command_done() to notify the
scheduler that it may advance to the next source with a pending command, if
any. If the 'send-command' signal and the notify_command_done() call are not
balanced the scheduler may stall.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-23 18:46:53 -05:00
Guido Günther 0bd0cad705 cbm-part: Handle additional coding schemes and parse languages
We store the language as iso639 as this is what the what TS 23.038
references.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-23 14:15:14 -05:00
Guido Günther 3559f606d2 cbm-part: Fix parsing of language encodings
According to TS 23.038 the language is stored at the beginning of the
information page not in the "header".

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-23 14:15:14 -05:00
Dan Williams 757df26b29 broadband-modem,modem-helpers: move +CPIN response parsing to modem helpers
Unit test it better, plus remove code duplication in various plugins.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-23 08:31:04 -05:00
Dan Williams c3c6fdc55e serial-parsers: don't echo-remove strange call start/end URCs
Some Sierra devices omit the leading <CR> from call start/end URCs
like NO CARRIER and CONNECT, which caused the echo-removal code to
remove from the response buffer because the leading <CR><LF> did
not exist. That can break call control and hangup handling on
those devices.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-22 08:05:58 -05:00
Dan Williams 24f9309d6e serial-parsers,port-serial-at: move echo removal into serial parser
Mainly because we need somewhere to stash the call end regex, and
it's silly to have a 3rd instance of that in MMPortSerialAt when
we already have one in the serial parsers that MMPortSerialAt
relies on pretty heavily.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-22 08:05:58 -05:00
Dan Williams 5888949fa3 modem-helpers: handle spaces in +CPMS query response
Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/990

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-20 09:56:49 -05:00
Daniele Palmas b0589932d7 broadband-modem: support +CGEREP values different than 2
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-05-19 08:59:00 -05:00
Kirill Buksha e5c4cbc79a tests,modem-helpers: add cases for multidigit "stat" value in CREG response
Signed-off-by: Kirill Buksha <kirbuk200@gmail.com>
2025-05-14 13:21:01 +02:00
Dan Williams d4c0bbc839 modem-helpers: add IPv6 support to +CGCONTRDP parsing
Add some test responses from the Quectel EG915Q and some other Quectel devices.
Then try to parse those responses.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 20:37:09 -05:00
Dan Williams 1d5cc0addb broadband-modem-qmi,broadband-modem-mbim: always use SMS_PART_INVALID_INDEX unstored parts
MMSmsList has logic to allow multiple unstored messages as long as
they use SMS_PART_INVALID_INDEX. These messages aren't stored so
they don't have an index.

But the MBIM and QMI modems used index 0 for unstored messages,
meaning there could only ever be one and also that multipart
messages would fail to be combined.

Let's fix that by just using SMS_PART_INVALID_INDEX for every
scenario where an unstored message comes in.

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/979

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 20:25:22 -05:00
Dan Williams 9e205f4784 modem-helpers: fix checking of CDMA/EVDO access technology
Missing ! for strncmp() meant the test was backwards and would
erroneously report 1xRTT and EVDOr0 when those access technologies
were not in use.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-12 23:37:00 -05:00
Dan Williams f5ae14d0b2 modem-helpers-qmi: better handle no supported modes
Dell Snapdragon X62 before FCC Unlock reports no radio interfaces
from QMI and no device capabilities from MBIM. Instead of asserting
in mm_filter_supported_modes() when called from
mm_supported_modes_from_qmi_supported_modes_context() gracefully
handle the lack of supported modes.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-09 13:19:50 +00:00
Dan Williams ceb1cd9a99 tests: add tests for mm_signal_from_mbim_signal_state()
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-03 15:33:45 -05:00
Guido Günther d8135be6e2 modem-helpers: Add helpers to parse channel lists
`CSCB` has the form

```
CSCB: [0|1],"<channel-list>","<data-coding-scheme>"
```

If the first parameter is `0` this specifies the accepted types if `1`
it specifies rejected.

So far seen in the wild were CSCB strings with accepted types only and a
coding scheme of "" so this is what we handle for the moment.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-28 20:53:52 +00:00
Guido Günther c69a64c0cb cbm: Add parsing bits for cell broadcast messages
This allows to parse the CBMs parameters like channel, part number and
message text. We parse uncompressed GSM7 and UCS2 encodings as
described in 3GPP TS 23.038.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-12-01 21:41:10 +00:00
Michal Mazur a030eaef76 sim: add common helpers to parse operator name and mnc length 2024-09-25 12:08:40 +00:00
Dan Williams 478e9645ca tests: test mm_split_string_groups()
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2024-09-10 19:03:31 -05:00
Aleksander Morgado 07f1f58642 modem-helpers: rework AT string quote operation and add unit tests
Rework the AT string quote operation to build the output with the
GString helper, instead of manually calculating how many bytes we'll
need in the output. It just makes it clearer.
2024-03-12 10:15:59 +00:00
Petr Krasnoshchekov 277d785735 modem-helpers: improve CGDCONT read response parsing
SIM A7600E-H sends only 3 parameters in CGDCONT read response (+CGDCONT: 1,"IP","nate.sktelecom.com").
The parsing regex requeres 4 parameters, so the response is not matched.
In addition fourth parameter is not used by parsing code.
2023-12-01 12:49:45 +00:00
Aleksander Morgado bfb0658909 modem-helpers-qmi: register QMI error translations
We register translations for QMI core and QMI protocol errors. These
translations are a best-effort, and they are not meant to be
exhaustive.

The original error description is included in the translated GError,
so that the details of the issue are not lost.
2023-10-26 12:35:50 +00:00
Aleksander Morgado cbb825a236 modem-helpers-mbim: register MBIM error translations
We register translations for MBIM core, MBIM protocol and MBIM status
errors. These translations are a best-effort, and they are not meant
to be exhaustive.

The original error description is included in the translated GError,
so that the details of the issue are not lost.
2023-10-26 12:35:50 +00:00
Aleksander Morgado 59aae421a1 core,error-helpers: new method to normalize GErrors
The ModemManager API should not expose or return error types out of
the error domains it supports.

Default to a generic core error "Failed", while keeping the original
error description.
2023-10-26 12:35:50 +00:00
Aleksander Morgado bf2843ad77 libmm-glib: separate files for flags and enums types
This allows us to skip needing to include the non-existent
build_string_from_mask() or get_string() counterparts in the
documentation index.
2023-04-27 12:23:04 +00:00
Aleksander Morgado 11539a2d82 sms-part-cdma: fix invalid reads due to wrong byte counts in read_bits
==174467== Invalid read of size 1
  ==174467==    at 0x10B80C: read_bits (mm-sms-part-cdma.c:255)
  ==174467==    by 0x10B886: read_bits (mm-sms-part-cdma.c:260)
  ==174467==    by 0x10DC2F: read_bearer_data_user_data (mm-sms-part-cdma.c:882)
  ==174467==    by 0x10DC2F: read_bearer_data (mm-sms-part-cdma.c:1000)
  ==174467==    by 0x10DC2F: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1180)
  ==174467==    by 0x10DF24: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:331)
  ==174467==    by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114)
  ==174467==    by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126)
  ==174467==    by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412)
  ==174467==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==  Address 0x51a6457 is 0 bytes after a block of size 7 alloc'd
  ==174467==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==174467==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==174467==    by 0x10DF06: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:325)
  ==174467==    by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114)
  ==174467==    by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126)
  ==174467==    by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412)
  ==174467==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
2023-03-30 22:51:48 +00:00
Aleksander Morgado 1b60330032 sms-part-cdma: fix invalid memory read when parsing empty ascii text
Same fix also applied to latin encoded text as it also makes sense there.

  ==158856== Invalid read of size 1
  ==158856==    at 0x10B814: read_bits (mm-sms-part-cdma.c:257)
  ==158856==    by 0x10DB07: read_bearer_data_user_data (mm-sms-part-cdma.c:878)
  ==158856==    by 0x10DB07: read_bearer_data (mm-sms-part-cdma.c:990)
  ==158856==    by 0x10DB07: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1170)
  ==158856==    by 0x10DE54: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:333)
  ==158856==    by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90)
  ==158856==    by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104)
  ==158856==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x10A509: main (test-sms-part-cdma.c:595)
  ==158856==  Address 0x51a627b is 0 bytes after a block of size 11 alloc'd
  ==158856==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==158856==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==158856==    by 0x10DE36: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:327)
  ==158856==    by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90)
  ==158856==    by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104)
  ==158856==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==
2023-03-30 22:07:47 +00:00
Aleksander Morgado 6dccfc5abd sms-part-cdma: fix warning when attempting g_convert() with NULL input
GLib-CRITICAL **: 21:21:51.419: g_convert: assertion 'str != NULL' failed

  Program received signal SIGTRAP, Trace/breakpoint trap.
  0x00007ffff7db3e82 in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  (gdb) bt
  #0  0x00007ffff7db3e82 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #1  0x00007ffff7db40ef in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #2  0x00007ffff7d8a5da in g_convert () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #3  0x00005555555592cf in read_bearer_data_user_data (log_object=0x0, subparameter=<optimized out>, sms_part=0x555555578000)
      at ../src/mm-sms-part-cdma.c:929
  #4  read_bearer_data (log_object=0x0, parameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:982
  #5  mm_sms_part_cdma_new_from_binary_pdu
2023-03-30 22:07:45 +00:00
Aleksander Morgado 3d9497ffbe sms-part-3gpp: fix invalid memory ready by checking UDH length byte can be read
[debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   submit type PDU detected
  [debug]   message reference: 1
  [debug]   address size: 1 digits (1 bytes)
  [debug]   number parsed: 00
  [debug]   validity available, format relative
  [debug]   PID: 0
  [debug]   user data encoding is GSM7
  [debug]   user data length: 0 elements
  [debug]   user data length: 0 bytes

  ==125780== Command: ./build/test/mmsmspdu --pdu=00F101010C0000000000 --verbose
  ==125780==
  ==125780== Invalid read of size 1
  ==125780==    at 0x10B422: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:698)
  ==125780==    by 0x10BF57: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==125780==    by 0x10A44D: main (mmsmspdu.c:242)
  ==125780==  Address 0x519988a is 0 bytes after a block of size 10 alloc'd
  ==125780==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==125780==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==125780==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==125780==    by 0x10BF36: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==125780==    by 0x10A44D: main (mmsmspdu.c:242)
2023-03-30 21:04:57 +00:00
Aleksander Morgado dbafff23a4 sms-part-3gpp: avoid underflow in tp_user_data_size_elements
==101461== Command: ./build/test/mmsmspdu --pdu=004100010100014B00002E --verbose
  ==101461==
  [debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   submit type PDU detected
  [debug]   message reference: 0
  [debug]   address size: 1 digits (1 bytes)
  [debug]   number parsed: 00
  [debug]   PID: 1
  [debug]   user data encoding is GSM7
  [debug]   user data length: 0 elements
  [debug]   user data length: 0 bytes
  [debug] decoding SMS text with 4294967294 elements

Based on a patch from Michal Mazur <mkm@semihalf.com>.
2023-03-30 20:32:37 +00:00
Aleksander Morgado 60ef408cd7 sms-part-3gpp: fix invalid memory read due to wrong size check when reading address
Before the actual number digits there is always a Type of Address byte
that we were not considering during the size check.

  [debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   deliver type PDU detected
  [debug]   address size: 1 digits (1 bytes)

  ==90832== Command: ./build/test/mmsmspdu --pdu=001C011C --verbose
  ==90832==
  ==90832== Invalid read of size 1
  ==90832==    at 0x10AC90: sms_semi_octets_to_bcd_string (mm-sms-part-3gpp.c:71)
  ==90832==    by 0x10AC90: sms_decode_address (mm-sms-part-3gpp.c:157)
  ==90832==    by 0x10B0C5: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:512)
  ==90832==    by 0x10BF77: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==90832==    by 0x10A44D: main (mmsmspdu.c:242)
  ==90832==  Address 0x5199874 is 0 bytes after a block of size 4 alloc'd
  ==90832==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==90832==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==90832==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==90832==    by 0x10BF56: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==90832==    by 0x10A44D: main (mmsmspdu.c:242)
2023-03-30 20:32:37 +00:00
Aleksander Morgado bc2aeeb7bd sms-part-3gpp: fix invalid memory read parsing address
[debug] parsing PDU (0)...
    [debug]   no SMSC address given
    [debug]   status report type PDU detected
    [debug]   message reference: 191
    [debug]   address size: 0 digits (0 bytes)

  ==78906== Command: ./build/test/mmsmspdu --pdu=000ABF00 --verbose
  ==78906==
  ==78906== Invalid read of size 1
  ==78906==    at 0x10AA80: sms_decode_address (mm-sms-part-3gpp.c:132)
  ==78906==    by 0x10AF7C: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:507)
  ==78906==    by 0x10BE17: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==78906==    by 0x10A44D: main (mmsmspdu.c:202)
  ==78906==  Address 0x5199874 is 0 bytes after a block of size 4 alloc'd
  ==78906==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==78906==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==78906==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==78906==    by 0x10BDF6: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==78906==    by 0x10A44D: main (mmsmspdu.c:202)
2023-03-30 20:32:37 +00:00
Aleksander Morgado 5d64ea7633 test-sms-part-3gpp: prepare common invalid PDU tester operation 2023-03-30 20:25:24 +00:00
Aleksander Morgado 3aefc983b5 sms-part-3gpp|cdma: new fuzzer tests 2023-03-30 13:19:30 +00:00
Aleksander Morgado 4a2e13c16f test,modem-helpers-qmi: unit tests for NAS system info registration processing
Requires the response parser methods in libqmi.
2022-11-10 10:57:54 +00:00
Aleksander Morgado f419f56628 build: drop autotools 2022-11-07 14:26:02 +00:00
Andrey Skvortsov 22ba849724 charsets: Add test_text_split_two_pdu_gsm7_extended_chars to use extended character 2022-09-13 20:49:01 +00:00
Andrey Skvortsov 2ece78c80f charsets: move mm_sms_part_3gpp_util_split_text to mm_charset_util_split_text 2022-09-13 20:49:01 +00:00
Aleksander Morgado 74fc5baca2 core: port GRegex/GMatchInfo to use autoptr()
The behavior of GRegex changed in 2.73.2 once it was ported from pcre1
to pcre2. In some cases it was made more strict, which is fine, in
other cases it exposed some change in how it behaves on certain
matches that is not extremely clear whether it's ok or not.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2729
See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/601
See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/621

Either way, one thing that was assumed was that initializing all
GRegex/GMatchInfo variables to NULL and making sure they're NULL
before they're initialized by glib (especially the GMatchInfo) was a
good and safer approach.

So, whenever possible, g_autoptr() is used to cleanup the allocated
GMatchInfo/GRegex variables, and otherwise, g_clear_pointer() is used
to ensure that no free/unref is attempted unless the given variable is
not NULL, and also so that the variable is reseted to NULL after being
disposed.
2022-09-05 17:33:11 +00:00
Aleksander Morgado 51a333cd9a test-modem-helpers: add EOL to strings matched with G_REGEX_NEWLINE_CRLF
Looks like pcre2 (used since glib 2.73.2) requires EOLs to match if
G_REGEX_NEWLINE_CRLF is explicitly used. The tests are updated
accordingly, because the modem responses will anyway have the EOLs
as well.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2729#note_1544130

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/601
2022-09-02 17:23:56 +02:00
Aleksander Morgado d5805002c1 core: remove "all rights reserved" from copyright lines
The rights each contributor has are the ones stated by the GPL/LGPL,
not more and not less.
2022-03-29 16:36:15 +02:00
Aleksander Morgado 598d99b5bd test,modem-helpers: add test for the EM9191 COPS=? response
Including 5GNR network reporting (act=12)

https://forum.sierrawireless.com/t/5g-network-scan-with-the-em9191-operation-not-allowed/26374/9
2022-03-16 11:04:06 +00:00
Aleksander Morgado 2c8cfb4768 modem-helpers: improve and fix COPS=? numeric fields parsing
The numeric fields in the +COPS=? response were relying on a very weak
parsing logic, assuming that they were single-digit numeric values and
not using the common string to integer conversion utilities.

This commit improves the conversion from the 3GPP/ETSI defined network
availability and access technology values to the MM defined ones,
providing enum-based matches even if the numeric values are the same.

The commit also fixes the parsing of access technology values > 10,
required to report 5G related values.
2022-03-16 11:04:06 +00:00