aboutsummaryrefslogtreecommitdiff
path: root/src/mm-shared-qmi.c
AgeCommit message (Collapse)Author
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-06-23shared-qmi: fix memory leak in set_supl_server commandAndrey Skvortsov
ctx->supl is allocated in mm_shared_qmi_location_set_supl_server using g_strdup. g_strdup requires to free string when unneeded. The problem could be reproduced using following commands ``` while true; do mmcli -m any --location-set-supl-server="supl.google.com:7276"; mem=$(cat /proc/$(pgrep ModemManager)/statm | awk '{print $6}') echo $(date +"%s"), $mem | tee -a mm-leak.log; done; ```
2023-06-14iface-modem: sim swap check always refers to the active SIMAleksander Morgado
Since 503e886c02 the events on inactive SIMs don't trigger a full modem reprobe, and the slot index check is fully unused.
2023-05-03shared-qmi: don't assume cancellation signal handler is setup in the ↵Aleksander Morgado
registration wait The cancellation_id will not be set if the cancellable is already cancelled by the time g_cancellable_connect() is called.
2023-05-03shared-qmi: ensure cancellation is setup last in the registration waitAleksander Morgado
register_in_network_cancelled() may be called early if the given cancellable is already cancelled, and if so, we want it to remove the timeout and signal handler, which should have been configured before setting up the cancellation signal handler.
2023-01-18broadband-modem-mbim,qmi-shared: Fallback from qmi uim service only when not ↵Ulrich Mohr
supported When using qmi uim service from mbim broadband modem, a fallback from using qmi uim service to normal mbim operations is done every time a call to qmi_set_primary_sim_slot fails. But this may fall for various reasons, and a fallback only makes sense when the device does not support that call Patch reworked by Aleksander Morgado <aleksandermj@chromium.org>
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-08-20mm-shared-qmi: Fix current modesAkash Aggarwal
Modem reports 2G+3G+4G+5G current modes, while 2G is not supported. Consider device capabilities in deciding current modes.
2022-08-04shared-qmi: minor rework SetPacketServiceState()Aleksander Morgado
Port to using g_autoptr() so that we avoid the gotos.
2022-08-04broadband-modem-qmi,mm-shared-qmi: implement support for ↵Akash Aggarwal
'SetPacketServiceState()'
2022-07-16shared-qmi: improve logging of steps in SIM hot swap setupAleksander Morgado
2022-07-16shared-qmi: only transfer state to priv info if SIM hotswap setup succeedsAleksander Morgado
Don't transfer state to the private info until we know the operation has fully succeeded.
2022-07-16shared-qmi: move indication callbacks out of the SIM hot swap setupAleksander Morgado
2022-07-16shared-qmi: return error if none of the methods succeeded in SIM hot swap setupAleksander Morgado
2022-07-16shared-qmi: avoid jumps in the SIM hot swap setup state machineAleksander Morgado
Always transition to the next step, and decide what to do based on the state tracked by the previously run steps.
2022-07-16shared-qmi: make refresh all non-fatal during SIM hot swap setupAleksander Morgado
If for any reason "Refresh all" fails, don't return an error, as we may have already configured SIM slot status correctly.
2022-07-16shared-qmi: add slot status indication in its own step during SIM hot swap setupAleksander Morgado
2022-07-16shared-qmi: add slot status check in its own step during SIM hot swap setupAleksander Morgado
Also, don't make the "Get Slot Status" operation fatal; just go on assuming that the slot status indications are unsupported.
2022-07-16shared-qmi: new step in SIM hot swap setup to connect to refresh signalAleksander Morgado
Instead of connecting to the signal in multiple places, do it in one single place in the logic.
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-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-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-23shared-qmi: ignore slot status indications until initial status is knownStephan Gerhold
Recent ModemManager versions no longer work on the Samsung A5 (Qualcomm MSM8916) smartphone: MM ends up in an infinite loop trying to probe the modem over and over again. Looking at the debug log it seems to be related to a "Slot Status" indication that comes in during probe time and causes MM to restart the probing process: [/dev/wwan0qmi0] Sent generic request (translated)... << QMUX: service = "uim" << QMI: message = "Register Events" (0x002E) << TLV: translated = physical-slot-status [/dev/wwan0qmi0] Received generic indication (translated)... << QMUX: service = "uim" << QMI: message = "Slot Status" (0x0048) << TLV: translated = { [0] = '[ physical_card_status = 'present', ... [/dev/wwan0qmi0] Received generic response (translated)... << QMUX: service = "uim" << QMI: message = "Register Events" (0x002E) << TLV: translated = SUCCESS [modem42] registered for slot status indications [/dev/wwan0qmi0] Sent generic request (translated)... << QMUX: service = "uim" << QMI: message = "Get Slot Status" (0x0047) [modem42] received slot status indication [modem42] An active slot had a status change, will reprobe the modem <infinite loop> The "Slot Status" indication (uim_slot_status_indication_cb) arrives immediately after starting to listen for the event, which is before ModemManager has actually loaded the initial slot status in uim_get_slot_status_ready. In this situation !slot_array_status_equal() will always cause the modem to reprobe, even though it is not necessary during the probe phase. To fix this add a simple check to uim_slot_status_indication_cb() that ignores the indication if the initial slot status was not loaded yet.
2022-03-09mm-shared-qmi: Return an error in load_current_capabilities() if none is found.Prakash Pabba
2022-02-28shared-qmi: use the new QmiSlotEidElement typeAleksander Morgado
This type was introduced to avoid having GArrays of GArrays in libqmi.
2022-02-28shared-qmi: avoid the deprecated QmiConfigTypeAndId typeAleksander Morgado
This type was a JSON description bug in libqmi, it should have never been a struct by itself. This was changed in libqmi by the 1.31.3 snapshot, so let's use the new methods instead of the deprecated ones.
2022-01-31shared-qmi: filter out modes not currently availableAleksander Morgado
Do not build the mask of "all" modes based only on the supported radio interfaces, also filter out those modes that would not be available based on the current capabilities enabled.
2022-01-31modem-helpers-qmi: multimode devices shouldn't always have 4G/5G only modesAleksander Morgado
In GSM/UMTS+CDMA/EVDO multimode devices, the 4G and 5G mode switching operations are exclusively limited to the capability selection that has LTE+5GNR exclusively. We cannot allow switching to 4G-only, 5G-only or 4G+5G if the current capabilities have GSM/UMTS or CDMA/EVDO. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/503
2022-01-31modem-helpers-qmi: new helper to build array of supported modesAleksander Morgado
2022-01-31modem-helpers-qmi: new helper to build array of supported capabilitiesAleksander Morgado
2022-01-31modem-helpers-qmi: refer explicitly to current capabilities in helper methodAleksander Morgado
The helper method for which we have unit tests available refers exclusively to the current capabilities loading, so rename it to clarify that.
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-11-17iface-modem: use external dispatcher to attempt FCC unlockAleksander Morgado
We remove the built-in FCC unlock procedures from the ModemManager, we will no longer run them automatically, and instead rely on external scripts/programs to do that. Packages providing the external FCC unlock tools can install them in ${pkglibdir}/fcc-unlock.d. Users manually enabling external FCC unlock tools can install them in ${pkgsysconfdir}/fcc-unlock.d. The user-enabled path takes precedence over the package-enabled one.
2021-11-14shared-qmi,modem-helpers-qmi: Add support for NR5G band preferencePrakash Pabba
Implement support for the NR5G band list to get current NR5G bands. This will also allow us to configure supported NR5G bands via mmcli.
2021-11-14shared-qmi,modem-helpers-qmi: Add support for NR5G band capabilityPrakash Pabba
Implement support for the NR5G band list to get supported NR5G band capabilities. localhost ~ # qmicli -d qrtr://0 --dms-get-band-capabilities [qrtr://0] Device band capabilities retrieved: Bands: 'bc-0-a-system, bc-0-b-system, bc-1-all-blocks, gsm-dcs-1800, gsm-900-extended, bc-10, gsm-850, gsm-pcs-1900, wcdma-2100, wcdma-pcs-1900, wcdma-1700-us, wcdma-850-us, wcdma-800, wcdma-900, wcdma-850-japan' LTE bands: '1, 2, 3, 4, 5, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20, 21, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42, 43' LTE bands (extended): '1, 2, 3, 4, 5, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20, 21, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42, 43, 46, 48, 66, 68, 71' NR5G bands: '1, 2, 3, 5, 7, 8, 12, 13, 14, 18, 20, 25, 26, 28, 29, 30, 38, 40, 41, 48, 66, 70, 71, 77, 78, 79'
2021-11-14mm-shared-qmi: Add check for 5g modem iface typePrakash Pabba
2021-11-04core: replace 'dummy' with 'placeholder'Aleksander Morgado
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-07-12shared-qmi: fix use of uninitialized memoryAleksander Morgado
==636642== Syscall param socketcall.sendto(msg) points to uninitialised byte(s) ==636642== at 0x5282BAC: send (in /usr/lib/libpthread-2.33.so) ==636642== by 0x4EF20AF: UnknownInlinedFun (gsocket.c:3426) ==636642== by 0x4EF20AF: g_socket_send_with_blocking (gsocket.c:3529) ==636642== by 0x4EDF176: g_output_stream_write (goutputstream.c:242) ==636642== by 0x4EDF2D4: g_output_stream_write_all (goutputstream.c:301) ==636642== by 0x4A5CDAC: endpoint_send (qmi-endpoint-qmux.c:409) ==636642== by 0x4A5B963: qmi_endpoint_send (qmi-endpoint.c:225) ==636642== by 0x4A55408: qmi_device_command_abortable (qmi-device.c:2897) ==636642== by 0x4A554C3: qmi_device_command_full (qmi-device.c:2923) ==636642== by 0x4B52664: qmi_client_nas_set_system_selection_preference (qmi-nas.c:61099) ==636642== by 0x1F6FDC: register_in_network_sssp (mm-shared-qmi.c:455) ==636642== by 0x1F71E6: mm_shared_qmi_3gpp_register_in_network (mm-shared-qmi.c:505) ==636642== by 0x19FCF0: mm_iface_modem_3gpp_register_in_network (mm-iface-modem-3gpp.c:484) ==636642== Address 0x880a3b3 is 19 bytes inside a block of size 32 alloc'd ==636642== at 0x484383F: realloc (vg_replace_malloc.c:1192) ==636642== by 0x50DC130: g_realloc (gmem.c:171) ==636642== by 0x50A067C: g_array_maybe_expand (garray.c:1009) ==636642== by 0x50A0A0C: UnknownInlinedFun (garray.c:520) ==636642== by 0x50A0A0C: g_array_append_vals (garray.c:509) ==636642== by 0x50A0A9E: g_byte_array_append (garray.c:2430) ==636642== by 0x4A4B70D: qmi_message_tlv_write_guint8 (qmi-message.c:686) ==636642== by 0x4B14CA8: __qmi_message_nas_set_system_selection_preference_request_create (qmi-nas.c:33477) ==636642== by 0x4B525B6: qmi_client_nas_set_system_selection_preference (qmi-nas.c:61087) ==636642== by 0x1F6FDC: register_in_network_sssp (mm-shared-qmi.c:455) ==636642== by 0x1F71E6: mm_shared_qmi_3gpp_register_in_network (mm-shared-qmi.c:505) ==636642== by 0x19FCF0: mm_iface_modem_3gpp_register_in_network (mm-iface-modem-3gpp.c:484) ==636642== by 0x1B0BD4: check_next_registration (mm-iface-modem-simple.c:154)
2021-07-12shared-qmi,iface-modem : Do not reprobe on hotswap in inactive slotPavan Holla
Prior to this change, a hotswap on the inactive slot would result in reprobe of the modem. With this change, the sim object would be updated, but no reprobe will be performed. The advantage is 1) we do not drop connections on the active slot 2) Slot status on the inactive slot is susceptible to firmware bugs. We have seen scenarios where the inactive slot is reported as absent/ iccid={0}, followed by a correction. We should not reprobe the modem if our active slot hasn't changed.
2021-06-02shared-qmi: add missing g_autoptr() NULL initializerAleksander Morgado
2021-05-23broadband-modem-qmi: setup FCC unlock stepAleksander Morgado
Use the new generic FCC unlock step instead of implementing it within the operating mode setup logic. The operation is implemented in the MMSharedQmi interface as it will also be used by the MBIM modem object.
2021-05-17shared-qmi: set MNC PCS digit for manual network registrationTeijo Kinnunen
Set the MNC PCS digit status when attempting to register to a network with 3 digit MNC and MNC < 100.
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-05-14broadband-modem-mbim: get model through QMI-over-MBIMFreedom Liu
move the modem_load_model() async method from mm-broadband-modem-qmi.c to mm-shared-qmi.c, and then make use of the method from both the QMI and MBIM implementations.
2021-05-05mm-shared-qmi: parse ICCID as hex instead of BCDEric Caruso
Fixes issue 364.
2021-04-30core: strict return type in g_object_ref()Aleksander Morgado
This is now a requirement when using glib 2.56.
2021-04-12shared-qmi: Remove iteration over slots at startupPavan Holla
MM used to iterate over each SIM slot to load IMSI, operator name etc. However, switching slots at start up caused a few issues in the real world. a) Sierra Wireless' AUTO-SIM feature, the hidden SIM slot switching is actually triggering a full modem reset (because the firmware detects a new SIM for a different operator, and automatically resets itself to load the firmware+carrier config associated to that other operator). b) The IMSI on slot 2 is reported to be the same as slot 1. This is solved by adding a 1000ms delay before reading IMSI on slot 2, after GET_CARD_STATUS indicates the sim is ready. The delay means a 2s startup penalty when both slots are loaded. c) 2/5 developers have encountered a fw bug where the modem incorrectly reports that the SIM on slot 1 has vanished after the sequence of slot switches. This makes the modem unusable. d) If the eSIM daemon changes slots and opens a channel to the eUICC, MM will detect a hotswap, and break the channel during reprobe. e) SIMs from a certain large operator in the US take over 20s to be ready. Thus, switching to such a SIM for just loading IMSI may not be worth it. This change does not affect detection of sims in all slots. We still expose the iccid and presence of all sims. However, properties like IMSI and operator_name will not be exposed for the inactive slot.
2021-03-31shared-qmi: Fix crash when a hotswap occurs while loading slotsPavan Holla
2021-03-15shared-qmi: acquisition order preference TLV always same itemsAleksander Morgado
The acquisition order preference TLV must always have the same number of elements, just the order of the elements should be different. Also, always prefer the acquisition order preference TLV to the GSM+WCDMA specific one, which is the same logic the modem applies. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/340