aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem.c
AgeCommit message (Collapse)Author
2020-09-14iface-modem: don't reconfigure sim hot swap context on SIM PIN unlockAleksander Morgado
If we had already successfully run the sim hot swap context setup during the initial initialization, make sure we don't re-run on SIM PIN unlock, because we may be re-creating signal handlers and such.
2020-09-08iface-modem: add mm_iface_modem_check_for_sim_swap functionTeijo Kinnunen
The function shall be needed for profile switch checking.
2020-09-07iface-modem: add an optional iccid parameter to check_for_sim_swapTeijo Kinnunen
If the new iccid is already available, reading the iccid from the card can be skipped.
2020-08-28api,modem: new 'SetPrimarySimSlot' methodAleksander Morgado
This new method allows changing the SIM slot considered as primary, when the modem supports multiple SIM slots. The generic handling of this method will make sure that the modem object and all its SIM objects are re-probed from scratch as soon as a successful SIM slot switch happens. Implementations may report MM_CORE_ERROR_EXISTS when the switch doesn't need to happen (e.g. if the requested SIM slot is already the active one).
2020-08-28api,modem: new 'SimSlots' and 'PrimarySimSlot' propertiesAleksander Morgado
The 'SimSlots' property exposes an array of SIM object paths, with one array item for each available SIM slot in the system. If a valid SIM card is found in a given slot, the path of the SIM object will be exposed in the array item; if no valid SIM card is found, the empty object path ("/") will be exposed instead. The 'PrimarySimSlot' property exposes which of the SIM slots available in the system is the one configured as being primary. In a Multi-SIM Single-Standby setup, the primary slot will be the one corresponding to the single active SIM in the system. In a Multi-SIM Multi-Standby setup, the primary slot will be the one configured to act as primary (e.g. the one that will be used for the data connection) among all the active SIM cards found.
2020-08-12iface-modem: avoid connection status flapping if briefly unregisteredAleksander Morgado
If the modem is connected and we receive indications of a quick unregistration cycle (i.e. unregistered, then registered again) we should not end up flagging the modem as disconnected. We already had some logic to avoid this with the "deferred 3GPP unregistration" logic in the base bearer object, but this logic only took into account the status of the bearer, not the status of the modem. Wed Jul 29 15:35:44 2020 daemon.info [1567]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state changed (home -> idle) Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP location updated (MCC: '0', MNC: '0', Location area code: '0', Tracking area code: '1CE8', Cell ID: '68F832') Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Connected bearer not registered in 3GPP network Wed Jul 29 15:35:44 2020 daemon.info [1567]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> enabled) Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Modem /org/freedesktop/ModemManager1/Modem/0: signal quality updated (0) Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Modem /org/freedesktop/ModemManager1/Modem/0: access technology changed (lte -> unknown) Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Periodic signal checks disabled Wed Jul 29 15:35:44 2020 daemon.info [1567]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state changed (idle -> registering) Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP location updated (MCC: '0', MNC: '0', Location area code: '0', Tracking area code: '1C84', Cell ID: 'A3E050') Wed Jul 29 15:35:44 2020 daemon.debug [1567]: <debug> Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP location updated (MCC: '238', MNC: '1', Location area code: '0', Tracking area code: '1C84', Cell ID: 'A3E050') Wed Jul 29 15:35:44 2020 daemon.info [1567]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state changed (registering -> home) Wed Jul 29 15:35:44 2020 daemon.info [1567]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabled -> registered) We now try to improve this situation by also considering the case where modem is supposed to get into "enabled" state (i.e. not registered, not searching), but we still consider the amount of connected bearers to decide the final state reported by the modem. In other words, a modem with the 3GPP registration reported as 'idle' will still be reported as 'connected' if there is at least one bearer in connected state. This situation will end as soon as the 'deferred 3GPP unregistration' timeout expires, as that will force the bearer to be disconnected.
2020-08-01iface-modem: move sim hot swap ready to correct place in sequenceAleksander Morgado
2020-06-12broadband-modem-qmi: also build 5GS reg state from Serving SystemAleksander Morgado
2020-05-19iface-modem: avoid cast-align errorsAleksander Morgado
We can safely cast the data in a GArray to gpointer first, and then to the pointer type we require. mm-iface-modem.c: In function 'after_set_load_current_bands_ready': mm-iface-modem.c:2358:55: error: cast increases required alignment of target type [-Werror=cast-align] requested_str = mm_common_build_bands_string ((MMModemBand *)requested_bands->data, requested_bands->len); ^ mm-iface-modem.c:2359:55: error: cast increases required alignment of target type [-Werror=cast-align] current_str = mm_common_build_bands_string ((MMModemBand *)current_bands->data, current_bands->len); ^ mm-iface-modem.c: In function 'validate_bands': mm-iface-modem.c:2474:48: error: cast increases required alignment of target type [-Werror=cast-align] (const MMModemBand *)supported_bands_array->data, ^ mm-iface-modem.c: In function 'mm_iface_modem_set_current_bands': mm-iface-modem.c:2535:50: error: cast increases required alignment of target type [-Werror=cast-align] bands_string = mm_common_build_bands_string ((MMModemBand *)bands_array->data, ^
2020-05-18AT modem: charset definition in initGiacinto Cifelli
Charset definition moved from enable state machine to init state machine, so that the right current charset is available also during further initialization steps
2020-04-09iface-modem-3gpp: don't fixup CS network supportAleksander Morgado
This is already done by the modem interface as soon as current capabilities are loaded.
2020-04-09iface-modem-3gpp: new 5GS network supportAleksander Morgado
2020-04-09api: new 5G modeAleksander Morgado
2020-04-09api: new 5GNR capabilityAleksander Morgado
2020-04-09api: deprecate MM_MODEM_CAPABILITY_LTE_ADVANCEDAleksander Morgado
It's not used anywhere.
2020-04-09iface-modem: simplify is_cdma_only() checkAleksander Morgado
The check needs to look for a matching single bit, so no need to make it too complex.
2020-04-08iface-modem: port to use object loggingAleksander Morgado
2020-02-12iface-modem: allow loading current required lock infoAleksander Morgado
2020-01-30iface-modem: fix warnings with -Wimplicit-fallthroughAleksander Morgado
mm-iface-modem.c: In function ‘peridic_signal_check_step’: mm-iface-modem.c:1311:26: error: this statement may fall through [-Werror=implicit-fallthrough=] 1311 | ctx->running_step++; | ~~~~~~~~~~~~~~~~~^~ ...
2020-01-30iface-modem: fix warnings with -Wswitch-defaultAleksander Morgado
mm-iface-modem.c: In function ‘bearer_status_changed’: mm-iface-modem.c:483:9: error: switch missing default case [-Werror=switch-default] 483 | switch (mm_base_bearer_get_status (bearer)) { | ^~~~~~ mm-iface-modem.c: In function ‘peridic_signal_check_step’: mm-iface-modem.c:1293:5: error: switch missing default case [-Werror=switch-default] 1293 | switch (ctx->running_step) { | ^~~~~~ mm-iface-modem.c: In function ‘interface_enabling_step’: mm-iface-modem.c:3965:5: error: switch missing default case [-Werror=switch-default] 3965 | switch (ctx->step) { | ^~~~~~ mm-iface-modem.c: In function ‘interface_initialization_step’: mm-iface-modem.c:4708:5: error: switch missing default case [-Werror=switch-default] 4708 | switch (ctx->step) { | ^~~~~~
2019-12-03iface-modem: allow Command() while in Failed stateAleksander Morgado
Allow the generic command API while in FAILED state, in case the modem integrator has some special commands to recover the device. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/163
2019-10-11iface-modem: allow plugins to disable access technology pollingAleksander Morgado
Same as with the signal quality polling, we may want to disable explicitly the access technology polling if we can rely on plugin specific URCs for this purpose.
2019-10-11iface-modem: allow disabling signal quality polling during runtimeAleksander Morgado
E.g. if we have a specific command to enable the signal quality URCs, we should only disable polling if the command is supported by the specific modem and the command succeeds. If unsupported or fails, we shouldn't disable the polling.
2019-10-11iface-modem: don't log error if it's in progressAleksander Morgado
If we're loading signal quality or access technology, skip reporting any error message if the specific error received is 'in-progress'. Plugins will use this error when they cannot process the response to the operation, e.g. if it was already consumed by a URC handler.
2019-10-11iface-modem: avoid using MM_CORE_ERROR_CANCELLEDAleksander Morgado
2019-09-15iface-modem: report last attempt to load_unlock_required implementationsAleksander Morgado
The load_unlock_required() step will be automatically retried by the generic interface logic unless some specific errors happen (e.g. it won't be retried if a SIM missing error is received). This patch allows telling the implementation of the method whether this time being run is the last one before reporting a hard error or not.
2019-07-22iface-modem: don't assume that setting modes is immediateAleksander Morgado
The modem may take the request to set modes and reply right away with a success before actually changing the current modes in use. Therefore, If we reload modes right after we receive the set response, we may still see the old modes instead of the new ones. Try to avoid this, by reloading current modes a couple of times after we have set them if they are not yet the expected ones.
2019-07-21iface-modem: don't assume that setting bands is immediateAleksander Morgado
The modem may take the request to set bands and reply right away with a success before actually changing the current bands in use. Therefore, If we reload bands right after we receive the set response, we may still see the old band mask instead of the new one. Try to avoid this, by reloading current bands a couple of times after we have set them if the band mask is not the expected one.
2019-06-01build: allow unconditionally enabling Modem.Command() methodAleksander Morgado
If ModemManager is being used in a custom system, make it easy to unconditionally enable the Modem.Command() method, in case the modem needs to be configured in some way that is not supported via standard modem interfaces.
2019-05-30iface-modem: fix reporting state while registration is deniedAleksander Morgado
When registration is denied, we should be reporting the modem with 'enabled' state instead of 'registered'. This was not happening because the logic to build the consolidated state (for 3GPP+3GPP2 modems) was using as default initial state the current old state, and so if the old one was 'registered' it never allowed getting a consolidated state of 'enabled', because 'registered' > 'enabled'. Instead of using the old initial state, the consolidated modem state should use 'enabled' as default initial value, which is the lowest among 'enabled, 'searching' and 'registered'.
2019-04-02api,modem: new 'CarrierConfigurationRevision' propertyAleksander Morgado
Which reports the version of the currently active carrier configuration. We also update the firmware 'version' reported in the firmware settings so that carrier-specific upgrades can be performed (e.g. when the firmware stays the same but the MCFG is updated).
2019-04-02firmware: export a device id containing the carrier infoAleksander Morgado
In order to support different per-carrier upgrade paths in fwupd.
2019-04-02iface-modem: new carrier config supportAleksander Morgado
During initialization phase we will allow querying the modem for the details of which carrier-specific configuration is being used, and will expose a description string in the API. In addition to showing the current configuration, we will also allow automatically switching the configuration based on the SIM card detected in the device. In order to allow this, plugins/modems will need to provide the expected mapping between carrier config description and MCCMNC. This mapping cannot be generic, because different manufacturers may use different description strings.
2019-01-03api,firmware: expose firmware versionAleksander Morgado
2018-12-07iface-modem: always connect all method handlers, even in failed stateAleksander Morgado
So that the returned error is much more descriptive. E.g. instead of this: $ sudo mmcli -m 0 -e error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method Enable is not implemented on interface org.freedesktop.ModemManager1.Modem' We'll get this: $ sudo mmcli -m 0 -e error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: modem in failed state' https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/96
2018-12-07iface-modem: remove redundant logic to update failed stateAleksander Morgado
When the MMIfaceModem initialization returns with the SIM_NOT_INSERTED error, the base logic is already updating the modem failed reason to SIM_MISSING. There is no need to do that explicitly for the case where SIM hot swap is supported.
2018-08-08iface-modem: reload current bands after settingAleksander Morgado
Setting bands is a very device-specific operation. Sometimes the device requires specific band combinations, or sometimes the 'any' specific logic doesn't apply to all supported bands (e.g. may apply only to the currently selected modes, as in XMM based devices). So, don't assume that if the set command succeeds we have set all expected bands. Instead, do an explicit loading of the current bands after the set operation, same thing as we do when setting modes.
2018-04-25iface-modem: allow initial signal check after the modem is re-enabledBen Chan
Commit 708b00ae3 "modem: allow periodic signal check to be disabled" added a "iface-modem-periodic-signal-check-disabled" property in MMIfaceModem/MMBroadbandModem to indicate if the periodic signal check should be disabled. If the property is set to TRUE, the signal_quality_polling_supported field of SignalCheckContext is set to FALSE, which is sticky across modem disable/enable operations. However, that is undesirable as we would like to issue an initial signal check to refresh the signal quality value after the modem is re-enabled from a state when the RF may have been previously turned off.
2018-04-24modem: allow periodic signal check to be disabledBen Chan
ModemManager decides to disable periodic signal check if either load_signal_quality is not implemented or load_signal_quality returns an unsupported error. However, in some cases, we want to use load_signal_quality to query the initial signal quality but rely on unsolicited signal quality updates from the modem afterwards without periodically polling for signal quality. To support that, this patch introduces a property in MMIfaceModem/MMBroadbandModem to indicate if the periodic signal check should be disabled.
2018-01-25*: Spelling fixesVille Skyttä
2017-12-18mm-iface-modem: add check_for_sim_swap method and enable stepsEric Caruso
When in low-power mode, some modems will not dispatch unsolicited notifications, such as for SIM hot swapping. There is code in MMBroadbandModemTelit to handle this by checking the SIM identifier during modem power up against the identifier cached in the SIM D-Bus object. If they're different, the SIM has likely been swapped while we were powered down. We can move this code out to MMBroadbandModem because it doesn't actually rely on any Telit-specific details, and invoke it from MMIfaceModem via a new method.
2017-11-23iface-modem: remove invalid modem reference count in update_lock_info()Aleksander Morgado
The modem object is being explicitly referenced and stored in the Context, but then never unref-ed, completely leaking a modem reference forever. Fixes: 4df545884733bbc5a851ab86e0983dec057d5482
2017-09-20iface-modem: add hook to load hardware revisionBen Chan
2017-09-20iface-modem: add mm_iface_modem_get_unlock_retries helperBen Chan
This patch adds a mm_iface_modem_get_unlock_retries helper for getting the current MMUnlockRetries value of a MMIfaceModem object, which later allows us to partially update (e.g. a specific MMModemLock) the MMUnlockRetries value of a MMIfaceModem object.
2017-09-07iface-modem: export update_unlock_retries outside MMIfaceModemBen Chan
This patch exports the internal function update_unlock_retries() in MMIfaceModem as mm_iface_modem_update_unlock_retries(), which later allows us to call it from other classes.
2017-08-08iface-modem: remove unnecessary error checkBen Chan
This patch removes an unnecessary error check in the update_unlock_retries() where the error is never set.
2017-08-01sim hot swap: improved error managementCarlo Lobrano
Currently, when SIM hot swap fails in either mm-iface or plugin, the ModemManager still opens ports context and prints a message saying that SIM hot swap is supported and that it's waiting for SIM insertion, instead of clearly saying that SIM hot swap is not working. This patch: 1. introduces a new property MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED which is FALSE by default and set to TRUE only when setup_sim_hot_swap_finish() succeded. 2. subordinates the completion of SIM hot swap setup (in mm-broadband-modem) and the related messages to the the value of MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED Finally, this patch replaces the MBIM's sim_hot_swap_on private property with the new property MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED, since they have the same meaning.
2017-07-17iface-modem: minor coding style fixesBen Chan
2017-07-12iface-modem: fix mm_iface_modem_initialize_finishBen Chan
This fixes commit 66f10d61a20e6c661cb04225835ec7a343f4fe36 ("iface-modem: port mm_iface_modem_initialize to use GTask"), which didn't update mm_iface_modem_initialize_finish to use g_task_propagate_boolean.
2017-07-06iface-modem: check error returned by g_task_propagate_error insteadBen Chan
When returning an enum value via g_task_return_int, some code assumes the enum value is always non-negative and thus considers that a negative value implies an error. This assumption could be invalidated if a negative value is later added to the enum. To make it less error prone to future changes, this patch modifies the code to check if the GError argument to g_task_propagate_error is populated instead.