aboutsummaryrefslogtreecommitdiff
path: root/src/mm-broadband-modem.c
AgeCommit message (Collapse)Author
2023-12-01broadband-modem: set read sms timeout to 120sPetr Krasnoshchekov
A7600E-H prints read sms response very slow. Having a lot of SMS can lead to timeout expiration and errors during next requests
2023-12-01iface-modem: allow cancellability during unlock required checksAleksander Morgado
The process doing the unlock required checks may need a lot of retries e.g. to decide whether a SIM card is available or not. If we do a quick SIM eject, so the unlock required check starts looping, and then insert the SIM again, we expect the loop to be cancelled right away, so that the new modem object can be reprobed without any interference from the old modem object. We now take the modem-wide cancellable and bind it to the GTask in mm_iface_modem_update_lock_info(), and we pass it down to every sub-step of the async logic in the operation. We also plug the cancellable to the delayed retries in the interface logic, to allow aborting the checks right away
2023-10-11iface-modem: new logic to detect SIM swap with explicit IMSI/ICCID queryRukun Mao
This improves SIM hot swap check process, and it can help avoid unnecessary modem reprobe during suspend-resume without SIM inserted. The changes in this CL implemented the new logic ONLY for MBIM, and the new logic has not been implemented for QMI and AT yet. Thus, we keep the legacy `mm_iface_modem_check_for_sim_swap()' till the new logic for QMI and AT has been implemented.
2023-09-18api,modem: new 'Physdev' propertyLukas Voegl
Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
2023-09-11broadband-modem: don't assert if no AT port in QMI modem enabling ↵Aleksander Morgado
unsolicited messages 2023-09-11T20:23:49.294555Z <err> mm_port_get_device: assertion 'self != NULL' failed 2023-09-11T20:23:49.294691Z <dbg> [modem0] enabling messaging unsolicited events on primary port (null) 2023-09-11T20:23:49.294865Z <dbg> [modem0] enabling parent messaging unsolicited events failed: Cannot run sequence: port not given
2023-06-16broadband-modem-qmi|mbim: allow limiting multiplexed links with udev tagsAleksander Morgado
Certain QMI or MBIM devices may not be able to support multiplexing at all, or they may support a limited amount of links. The new ID_MM_MAX_MULTIPLEXED_LINKS udev tag allows specifying the maximum number of supported multiplexed links; e.g. 0 to report none supported or 1 to report that one single multiplexed link is supported.
2023-05-17broadband-modem: plug leak processing SIM loading stepsAleksander Morgado
==6971== 52 (16 direct, 36 indirect) bytes in 1 blocks are definitely lost in loss record 3,764 of 6,140 ==6971== at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==6971== by 0x4A1ADE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x4A31FF1: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x4A3266D: g_slice_alloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x49FD397: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x49FD8B4: g_error_new_valist (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x49FDACE: g_set_error (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x187A4C: mm_base_modem_peek_best_at_port (mm-base-modem.c:1129) ==6971== by 0x184116: _at_command (mm-base-modem-at.c:634) ==6971== by 0x1841FE: mm_base_modem_at_command (mm-base-modem-at.c:660) ==6971== by 0x18F6F1: load_sim_identifier (mm-base-sim.c:2016) ==6971== by 0x18CA03: mm_base_sim_load_sim_identifier (mm-base-sim.c:820)
2023-05-03broadband-modem: explicitly abort ongoing attempt when disablingAleksander Morgado
2023-05-03bearer-list: new common method to disconnect one or all bearersAleksander Morgado
2023-02-15iface-modem-3gpp: enable reading of IMEI in FAILED stateMichal Mazur
It was not possible to read IMEI of modem when SIM was not inserted or initialization failed due to modem facility locks. To load IMEI, the 3gpp interface need to be initialized before going to FALLBACK_LIMITED.
2022-11-04broadband-modem: improve logging during SIM swap checkAleksander Morgado
Log the contents loaded during the operation and treat them as personal info so that they are hidden if needed.
2022-11-04core,log: new 'MSG' log level between 'INFO' and 'WARN'Aleksander Morgado
We're bumping the current "INFO" level messages to the new "MSG" level, also making the new level the default. The old "INFO" level will be used to setup an intermediate level of logging which is not as verbose as "DEBUG" but still provides some capabilities to analyze the behavior of a modem.
2022-09-20iface-modem-3gpp: allow applying domain registration updates altogetherAleksander Morgado
When processing QMI and MBIM messages to report domain registration updates, we should do that altogether so that we don't report bogus transitions to idle if the registration state switches from one domain to another. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/629
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-08-17broadband-modem: remove unused variableAleksander Morgado
mm-broadband-modem.c:10703:23: warning: unused variable 'cmd' [-Wunused-variable] g_autofree gchar *cmd = NULL; ^
2022-08-04iface-modem-simple: wait for packet service 'attach' state in ConnectionStepAkash Aggarwal
2022-08-04broadband-modem: SIM swap check should consider errors loading as no SIMAleksander Morgado
A failure loading IMSI or ICCID (unless for the UNSUPPORTED case) could be an indication that there is no SIM. Ideally, the logic checking if a SIM swap happened should have checked first if there is a SIM card in the slot, and only if there is one go on to try to load IMSI or ICCID.
2022-08-01broadband-modem: notify when a sync is needed after a suspend/resumeAleksander Morgado
Modem/SIM implementations that keep cached info that is not supposed to change during runtime of a modem may need to be notified about when a suspend/resume has happened, so that they can clear and reload the internally cached data.
2022-07-29broadband-modem: quick sync the Modem interface also if disabledAleksander Morgado
If the modem was in disabled state, we still want to sync the Modem interface, among other things to make sure no SIM event happened during the system suspension. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/605
2022-07-16broadband-modem: don't make fatal SIM swap check of IMSI or ICCIDAleksander Morgado
If the SIM swap check using ICCID or IMSI fail, don't completely fail the operation, as the other one may still succeed. Fail the operation only if both checks failed.
2022-07-16broadband-modem: plug leaks in sim_swap_context_free()Aleksander Morgado
2022-07-16mm-iface-modem,mm-broadband-modem,mm-shared-qmi: support SIM IMSI switchPrakash Pabba
It is possible that SIM IMSI might change in roaming conditions for a sim. Register for UIM refresh indication always and reprobe if ICCID or IMSI changes for QMI modem.
2022-06-09suspend: add suspend/resume support with powerd on ChromeOSRukun Mao
ModemManager handles suspend and resume signals sent from powerd Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/547
2022-05-25iface-modem: report failed modems with unknown capabilitiesAleksander Morgado
Instead of not creating a modem object, create it in failed state with the "unknown capabilities" failed state reason.
2022-05-25iface-modem: fail initialization if eSIM without profilesAleksander Morgado
A modem using an eSIM without profiles should not be allowed to get enabled, it should be really treated as a modem without a physical SIM.
2022-05-25broadband-modem: rework checking for SIM swapAleksander Morgado
Avoid calling the MMBaseSim class method directly, and use the helper mm_base_sim_load_sim_identifier() instead. Also, rework a bit the logic to have a single completion method once we know the current ICCID.
2022-05-20base-modem: if ABORTED during initialization, modem not exportedAleksander Morgado
Commit b497de325 introduced a change by which some common errors (e.g. SIM missing) would be reported as MM_CORE_ERROR_ABORTED. This had the undesired effect of making the MMBaseModem object not flag as valid the modem, because the returned error wasn't MM_CORE_ERROR_WRONG_STATE. We now change this logic so that only ABORTED makes the modem object not flagged as valid, and we'll do that only if the Modem interface isn't exposed in DBus. Fixes b497de325
2022-05-20iface-modem: common SIM event reporting logicAleksander Morgado
We no longer have separate mm_base_modem_process_sim_event() and mm_broadband_modem_sim_hot_swap_detected() methods. The only difference between both of them was that one of them would attempt to cleanup the ports context associated to the SIM hot swap event logic as soon as a swap was detected, in order to avoid queueing up multiple such events. The previous logic wasn't working well, though, as there could be mixed AT+QMI or AT+MBIM devices that would also require that same cleanup and so we didn't always know which one should have been called. Now we have a single mm_iface_modem_process_sim_event() method, which will trigger the reprobe and disabling, but which will also perform the cleanup of the SIM ports swap setup as specified by the implementation. So, if a plugin explicitly initializes the serial ports context for SIM hot swap handling, it should also explicitly clean it up. Also, the initialization of the serial ports context for SIM hot swap handling is no longer done automatically for all modems, it will be done only for those modems using it; i.e. the modems that explicitly report support SIM hot swap handling using AT URCs.
2022-05-20iface-modem: remove MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED propertyAleksander Morgado
This property is used in the MMIfaceModem to flag whether the SIM hot swap setup has been performed or not. The flag is now moved to the iface-specific private context. The property was also used in AT-based modems, so that implementations supporting the SIM hot swap via AT URCs could flag the upper layers whether the enabling of the feature was done correctly or not, and if so, create and keep the AT ports context open. But this feature only made sense in AT-based modems, i.e. an MBIM modem that detects SIM hot swaps via MBIM indications exclusively should not require the AT ports context open for anything. The check in the MMBroadbandModem object has therefore been removed, and the logic will be updated so that it only applies to AT-based modems.
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.
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-12-26iface-modem-3gpp-profile-manager: initialize the 'IndexField' propertyAleksander Morgado
2021-12-24broadband-modem: new profile settings not available in generic AT protocolAleksander Morgado
2021-11-02broadband-modem: implement support for 'SetPacketServiceState()'Aleksander Morgado
2021-10-18modem-helpers: setup common RSSI to signal quality converterAleksander Morgado
2021-10-13broadband-modem: add the sar interfacelvmaorui
2021-10-03broadband-modem: ensure mm_broadband_modem_create_device_identifier() sets ↵Lubomir Rintel
an error on all bad returns modem_load_device_identifier_finish() expect it to do so and trips an assertion failure in g_propagate_error(): ModemManager[256038]: <warn> [1633083601.491190] [modem0] couldn't load equipment identifier: Unknown error ModemManager[256038]: <debug> [1633083601.491204] [modem0] loading device identifier... ModemManager[256038]: <debug> [1633083601.491215] [modem0/modemu/at] device open count is 3 (open) ModemManager[256038]: <debug> [1633083601.491231] [modem0/modemu/at] device open count is 2 (close) ModemManager[256038]: <debug> [1633083601.491254] [modem0/modemu/at] --> 'ATI<CR>' ModemManager[256038]: <debug> [1633083601.494616] [modem0/modemu/at] <-- '<CR><LF>ERROR<CR><LF>' ModemManager[256038]: <debug> [1633083601.494643] [modem0/modemu/at] operation failure: 100 (Unknown error) (ModemManager:256038): GLib-CRITICAL **: 06:20:01.494: g_propagate_error: assertion 'src != NULL' failed Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap. g_logv (log_domain=0x7ffff77d1071 "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=<optimized out>) at ../glib/gmessages.c:1413 1413 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth)); Missing separate debuginfos, use: dnf debuginfo-install libmbim-1.26.0-2.el9.x86_64 libqmi-1.30.2-1.el9.x86_64 (gdb) bt #0 g_logv (log_domain=0x7ffff77d1071 "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=<optimized out>) at ../glib/gmessages.c:1413 #1 0x00007ffff77813d3 in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at ../glib/gmessages.c:1451 #2 0x000055555561122d in modem_load_device_identifier_finish (self=0x5555557e62d0, res=<optimized out>, error=0x7fffffffd320) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-broadband-modem.c:1168 #3 0x00005555555ea69a in load_device_identifier_ready (self=0x5555557e62d0, res=0x5555557ea6b0, task=task@entry=0x7fffe8011e20 [GTask]) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-iface-modem.c:4727 #4 0x00007ffff7951b62 in g_simple_async_result_complete (simple=0x5555557ea6b0 [GSimpleAsyncResult]) at ../gio/gsimpleasyncresult.c:802 #5 0x00005555555d1b0a in at_sequence_parse_response (port=<optimized out>, res=<optimized out>, ctx=ctx@entry=0x5555557ed7f0) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-base-modem-at.c:250 #6 0x00007ffff7951b62 in g_simple_async_result_complete (simple=0x5555557e5440 [GSimpleAsyncResult]) at ../gio/gsimpleasyncresult.c:802 #7 0x00005555556805dc in serial_command_ready (port=<optimized out>, res=<optimized out>, simple=simple@entry=0x5555557e5440 [GSimpleAsyncResult]) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-port-serial-at.c:378 #8 0x00007ffff7951b62 in g_simple_async_result_complete (simple=0x5555557d6730 [GSimpleAsyncResult]) at ../gio/gsimpleasyncresult.c:802 #9 0x000055555567fb35 in command_context_complete_and_free (ctx=ctx@entry=0x7fffe800c200, idle=idle@entry=0) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-port-serial.c:141 #10 0x0000555555682a96 in port_serial_got_response (self=0x5555557dd4e0 [MMPortSerialAt], parsed_response=0x0, error=0x5555557d5040) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-port-serial.c:755 #11 0x00005555556870d2 in parse_response_buffer (self=<optimized out>) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-port-serial.c:934 #12 common_input_available (self=0x5555557dd4e0 [MMPortSerialAt], condition=(G_IO_NVAL | unknown: 0xf762a5c0)) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/mm-port-serial.c:1035 #13 0x00007ffff7778f9f in g_main_dispatch (context=0x5555557527c0) at ../glib/gmain.c:3337 #14 g_main_context_dispatch (context=0x5555557527c0) at ../glib/gmain.c:4055 #15 0x00007ffff77cd608 in g_main_context_iterate.constprop.0 (context=0x5555557527c0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4131 #16 0x00007ffff7778563 in g_main_loop_run (loop=0x55555576da60) at ../glib/gmain.c:4329 #17 0x00005555555b7b60 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/ModemManager-1.18.2-1.el9.x86_64/src/main.c:216
2021-09-08mm-broadband-modem-qmi: add AT URCs fall back for callsDylan Van Assche
Enable AT URCs for calls on top of QMI Voice indications for AT+QMI devices only. Some AT+QMI devices send unreliable QMI indications when the host is resuming. In such cases, AT URCs can be used as a fall back to make calls reliable. While AT+QMI devices relied before on AT commands to load call list information and handle AT URCs for async updates, this is now handled through QMI by forcefully reloading the call list instead of processing the AT URCs. This approach is disabled by default through the MM_IFACE_MODEM_VOICE_INDICATION_CALL_LIST_RELOAD_ENABLED property. This property is set to true in case of QMI modems.
2021-06-17broadband-modem: plug memleak when listing profilesAleksander Morgado
==4263== 747 (72 direct, 675 indirect) bytes in 3 blocks are definitely lost in loss record 5,739 of 5,787 ==4263== at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==4263== by 0x50C6DE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==4263== by 0x50DDFF1: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==4263== by 0x50B8EB9: g_list_prepend (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==4263== by 0x27CE4C: mm_3gpp_parse_cgdcont_read_response (mm-modem-helpers.c:1845) ==4263== by 0x1E5485: profile_manager_cgdcont_query_ready (mm-broadband-modem.c:10200) ==4263== by 0x4ED54A1: g_simple_async_result_complete (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1) ==4263== by 0x18605E: at_command_ready (mm-base-modem-at.c:538) ==4263== by 0x4ED54A1: g_simple_async_result_complete (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1) ==4263== by 0x25ADFA: serial_command_ready (mm-port-serial-at.c:393) ==4263== by 0x4ED54A1: g_simple_async_result_complete (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1) ==4263== by 0x254752: command_context_complete_and_free (mm-port-serial.c:141)
2021-06-16helpers: skip g_warning() in mm_3gpp_parse_ws46_test_response()Aleksander Morgado
Use mm_obj_warn() instead.
2021-05-26broadband-modem: abort sync if locked SIM card foundAleksander Morgado
We made sure that the after resume synchronization was only started on modems that had been enabled (and so unlocked). If we detect a locked SIM card during the sync operation, it's either because the SIM card was swapped, or because the modem was fully shutdown during the suspension (and so the SIM requires SIM-PIN again). Either way, we cannot sync the state cleanly at this point, we must trigger a full modem reprobe in order to move back the modem state to Locked.
2021-05-26broadband-modem: fix state machine logic when synchronizing modem interfaceAleksander Morgado
2021-05-26broadband-modem: fail synchronization if no modem exported in DBusAleksander Morgado
2021-05-26iface-modem: synchronize state when resumingDylan Van Assche
Refresh signal strength and access technologies, check for SIM swaps, and check if the SIM is locked. The modem may have switched to a different access technologies or have a different signal strength when resuming. Moreover, the user may swap or remove the SIM when suspended.
2021-05-26broadband-modem: skip 3GPP interface sync if no 3GPP supportAleksander Morgado
2021-05-26broadband-modem: fix type in the ready() for iface_modem_3gpp_sync()Aleksander Morgado
When calling an async method ona given type, the convention is to use the same type in the corresponding ready() method, so that we can use it without additional casts on the finish().
2021-05-26iface-modem-3gpp: synchronize state when resumingDylan Van Assche
On resume, refresh the EPS bearers and 3GPP registration as the registration and bearers may expired during suspend.
2021-05-26broadband-modem: skip time interface sync if no time supportAleksander Morgado
2021-05-26iface-modem-time: synchronize state when resumingDylan Van Assche
On resume, fetch the current network time as the network time may be changed when suspended.
2021-05-26broadband-modem: skip synchronization after resume if not neededAleksander Morgado
The synchronization after resume should only be needed on enabled modems, as otherwise there is really no chance that the state of the modem may have changed during suspend. E.g. if a modem is failed because it doesn't have a SIM card, or if the SIM-PIN is locked, or if the modem has never been enabled, there is no point in attempting to synchronize the runtime state of the modem.