aboutsummaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers.c
AgeCommit message (Collapse)Author
2025-05-22broadband-modem,modem-helpers: generalize call end regex creationDan Williams
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-20modem-helpers: handle spaces in +CPMS query responseDan Williams
Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/990 Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-19modem-helpers: remove unused variable in mm_3gpp_parse_cmer_test_responseDaniele Palmas
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-05-19broadband-modem: support +CGEREP values different than 2Daniele Palmas
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-05-14modem-helpers: fix method for distinguishing lac and stat valuesKirill Buksha
Stat value may be multidigit e.g. 10 or 11. Signed-off-by: Kirill Buksha <kirbuk200@gmail.com>
2025-05-14modem-helpers: support multi-digit "stat" values in CREG responseKirill Buksha
The 'stat' field in CREG responce may contain multi-digit numbers, such as "10" meaning "registered for "CSFB not preferred", roaming". Furtermore, some modems use value "11" to indicate that only emergency services are available. Signed-off-by: Kirill Buksha <kirbuk200@gmail.com>
2025-05-08modem-helpers: add IPv6 support to +CGCONTRDP parsingDan Williams
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-08broadband-bearer,modem-helpers: don't use or match disabled profilesDan Williams
When matching profiles ignore disabled ones. When activating a specific profile index, return an error if that profile is marked as disabled. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-07modem-helpers: report C*REG=2 AcT 9 as NB-IOT access technologyDan Williams
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-12modem-helpers: fix checking of CDMA/EVDO access technologyDan Williams
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-03-28modem-helpers: Add helpers to parse channel listsGuido Günther
`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-11treewide: Fix typosGuido Günther
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-01-17modem-helpers: fix gsize formatLukas Voegl
2024-12-01modem-helpers: Add regex to parse CBM out of the serial streamGuido Günther
This will allow us to fetch cell broadcast messages. Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-09-25sim: add common helpers to parse operator name and mnc lengthMichal Mazur
2024-09-17helpers: consolidate some uses of mm_kernel_device_get_subsystem()Dan Williams
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2024-09-10modem-helpers: remove duplicate includeDan Williams
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2024-05-31modem-helpers: do not leak past PDP on errorLubomir Rintel
If CID parsing from the +CGDCONT response fails, the very last PDP structure allocated is not put on the list yet and therefore mm_3gpp_pdp_context_list_free() wouldn't free it. Let's put it on the list first, as to not leak it on error.
2024-03-12modem-helpers: rework AT string quote operation and add unit testsAleksander Morgado
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-01-25bearer-mbim: When an IP type is unspecified in the profile, default to ↵Madhav
IPv4v6 (dual-stack) To address limitations in reading IP_TYPE information (in some cases) for profile requests, default to IPv4v6 (dual-stack) for profile requests and IPv4 only for user requests (to ensure backward compatibility) if nothing specific is requested. This ensures network compatibility across IPv4 and IPv6 networks, preventing potential connectivity issues in IPv6 environments.
2023-12-01modem-helpers: improve CGDCONT read response parsingPetr Krasnoshchekov
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.
2022-11-10modem-helpers: new method to check if reg state is registeredAleksander Morgado
2022-09-30mm-modem-helpers.c: adjust the RING regexAngus Ainslie
The Broadmobi BM818 has some additional carriage returns in the RING message Fixes: #626 Signed-off-by: Angus Ainslie <angus@akkea.ca>
2022-09-16enum, bearer: added non-ip bearerAlexey Orishko
2022-09-05modem-helpers: rework the +CGEV indication parserAleksander Morgado
We setup all output variables with g_autofree and then use g_steal_pointer() to return the needed ones.
2022-09-05modem-helpers: rework +CGCONTRDP response parserAleksander Morgado
We setup all output variables with g_autofree and then use g_steal_pointer() to return the needed ones.
2022-09-05core: port GRegex/GMatchInfo to use autoptr()Aleksander Morgado
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-04-08sms: prevent crash if date is out of rangeCarlo Lobrano
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-03-29core: remove "all rights reserved" from copyright linesAleksander Morgado
The rights each contributor has are the ones stated by the GPL/LGPL, not more and not less.
2022-03-16modem-helpers: improve and fix COPS=? numeric fields parsingAleksander Morgado
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-16modem-helpers: act given in COPS=? may have more than one digitAleksander Morgado
The new 5GNR related values are >= 10, so don't expect one single digit (\d), expect one or more (\d+).
2022-03-09modem-helpers: Consider minimum ID when choosing best profileSven Schwermer
+CGDCONT? may list profiles with IDs that are illegal to write, i.e. +CGDCONT=? returns a minimum ID larger than some of the existing profiles. E.g. for Fibocom L610-EU, +CGDCONT=? returns +CGDCONT: (1-7),"IP",,,(0-3),(0-4) +CGDCONT: (1-7),"IPV6",,,(0-3),(0-4) +CGDCONT: (1-7),"IPV4V6",,,(0-3),(0-4) +CGDCONT: (1-7),"PPP",,,(0-3),(0-4) +CGDCONT: (1-7),"Non-IP",,,(0-3),(0-4) while the default EPS bearer is established at profile 0: +CGDCONT: 0,"IP","xxx","xxx.xxx.xxx.xxx",0,0 [...] Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2022-01-30mm-shared-qmi,mm-modem-helpers: Fix supported capabilities and modes for ↵Prakash Pabba
multimode device We use capability switching logic exclusively for configuring GSM/UMTS+CDMA/EVDO devices (regardless of whether it has LTE/5GNR or not) to add or remove the GSM/UMTS and CDMA/EVDO capabilities. Based on the same logic, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE+5GNR device: "GSM/UMTS+CDMA/EVDO+LTE+5GNR", "GSM/UMTS+LTE+5GNR", "CDMA/EVDO+LTE+5GNR" and "LTE+5GNR" Similarly, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE device: "GSM/UMTS+CDMA/EVDO+LTE", "GSM/UMTS+LTE", "CDMA/EVDO+LTE" and "LTE" And, we will allow 3 combinations for GSM/UMTS+CDMA/EVDO device: "GSM/UMTS+CDMA/EVDO", "GSM/UMTS" and "CDMA/EVDO" Also, supported combination modes should be based on current capabilities and not entirely upon supported radio interfaces. 1) If current capability has "gsm-umts" or "cdma-evdo" or both, do not support 4G only, 5G only, or 4G+5G combination modes 2) If current capability neither has "gsm-umts" nor "cdma-evdo", only support combination modes involving 4G and 5G.
2021-12-26iface-modem-3gpp-profile-manager: support 'apn-type' as index fieldAleksander Morgado
The modem may report the 'apn-type' field is the one to be used as index; if that's the case, allow setting and deleting profiles based on the given 'apn-type' field. This change also makes the internal profile management operations use one index field or another, based on what the protocol implements.
2021-11-02broadband-modem: implement support for 'SetPacketServiceState()'Aleksander Morgado
2021-10-22cli, plugins: factorize usage of iso8601 datetime formatFrederic Martinsons
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com> Includes updates by Aleksander Morgado to fix coding style issues.
2021-09-19sim-mbim: add support for loading eid via mbim protocolSom_SP
Support is added to set eid dbus interface property using MBIM protocol when the inserted sim is esim.
2021-09-08mm-modem-helpers: only parse calls in voice modeDylan Van Assche
Calls in a CLCC response in data-only or fax-only mode do not count as actuall calls.
2021-08-02modem-helpers: allow unquoted operator code in AT+CPOL? responseTeijo Kinnunen
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/409
2021-06-16helpers: skip g_warning() in mm_3gpp_parse_ws46_test_response()Aleksander Morgado
Use mm_obj_warn() instead.
2021-05-17modem-helpers: add 3 digit MNC output to mm_3gpp_parse_operator_id()Teijo Kinnunen
MNC digit count information is lost on conversion to integers. Make it possible for the caller to get this information through a separate boolean.
2021-04-29broadband-bearer: rely on profile management for the cid selectionAleksander Morgado
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-29modem-helpers: new profile list helpersAleksander Morgado
The new helpers allow converting a PDP context list returned from the +CGDCONT? parser to a list of 3GPP profile objects. The new mm_3gpp_profile_list_find_best() method is equivalent to the mm_3gpp_select_best_cid() one, but using profile objects as input/output instead of specific settings. The unit tests that were testing mm_3gpp_select_best_cid() are also converted to use mm_3gpp_profile_list_find_best().
2021-04-08modem-helpers: new helper to lookup range from CGDCONT=? responseAleksander Morgado
2021-04-01modem-helpers: ip family normalization doesn't need log_objectAleksander Morgado
2021-03-31base-bearer: remove default IP family propertyAleksander Morgado
There is no point in providing a configurable default IP family in the bearer object, because we can always assume IPv4 as being the only default expected. Simplify the logic and also provide a new method to get the normalize the IP family, using IPv4 as default always.
2021-03-09modem-helpers,mm-base-sim: Sim.SetPreferredNetworks AT implementationTeijo Kinnunen
Implement Sim.SetPreferredNetworks method by using the AT+CPOL command.
2021-02-26libmm-glib,modem-helpers,mm-base-sim: implement Sim.PreferredNetworksTeijo Kinnunen
The ModemManager1.Sim.PreferredNetworks property contains the preferred networks (and access technologies, if available) configured to the SIM card. This commit implements preferred networks reading with AT+CPOL.
2021-02-23helpers: rework normalize_operator() to use str_to_utf8()Aleksander Morgado
Instead of blindly assuming that we can take whatever string given as valid UTF-8, we'll always attempt to convert from the current modem charset into UTF-8. Before we were doing this for hex-encoded UCS2, but not for example for GSM-7. And due to the now applied GSM-7 conversion, the mf627a/mf627b +COPS parsing unit tests are updated accordingly, because when converting from an input string that contains byte 0x40 ('@' in UTF-8) as if it were GSM-7, the 0x40 is taken as character '¡', encoded as 0xc2,0xa1 in UTF-8).
2021-02-23libmm-glib,common-helpers: make hexstr2bin() return a guint8 arrayAleksander Morgado
It makes much more sense than returning a gchar array, as gchar is signed.