aboutsummaryrefslogtreecommitdiff
path: root/src/mm-shared-qmi.c
AgeCommit message (Collapse)Author
2021-03-15shared-qmi: process all feature checks in SSP response togetherAleksander Morgado
Loading capabilities is the very first step of the state machines, and so we can rely on the "NAS Get SSP" method performed there to process all feature checks of the SSP response.
2021-03-15shared-qmi: if getting TP/SSP fails, assume unsupportedAleksander Morgado
Until now we were only considering TP/SSP unsupported if we received a QMI protocol error (e.g. reporting unknown command). We now also consider TP/SSP unsupported if the actual request succeeds, but an error is reported in the response. There is no point in considering TP/SSP supported if the plain get request without input TLVs given fails.
2021-03-15shared-qmi: add missing feature check flag initialization to UNKNOWNAleksander Morgado
2021-03-15shared-qmi: rename feature check variablesAleksander Morgado
We want the "extended_lte_band_preference" with the "nas_ssp" prefix, as we're going to add more checks for SSP features.
2021-02-27iface-modem: detect hotswap on all slotsPavan Holla
Prior to this change, hotswap was detected on the primary sim slot only. After this change, hotswap on any slot triggers reenumeration of the modem. SIM hotswap events happening on the non-active slot would also trigger a full modem reprobe. The modem may already have been connected while the SIM event happens on the secondary slot, and we force disconnection to reload the inactive SIM info. However, a user would expect feedback for their SIM action, so we need to reprobe the modem.
2021-02-26shared-qmi: network registration cancellation logic with asserts disabledAleksander Morgado
g_assert() calls may be disabled, and if so, the network registration task would never get completed.
2020-10-29shared-qmi: ignore NoEffect errors on slot switchingAleksander Morgado
When "UIM Switch Slot" returns a NoEffect error it's because we're already in the desired slot, so just treat it as a successful operation.
2020-10-19mm-shared-qmi: load EID during SIM slot loadingEric Caruso
SIMs can be created with an EID fetched during load_sim_slots while initializing the modem, if present. Since load_eid would be implemented with the same mechanism we avoid using it here (if Get Slot Status fails once, it probably doesn't make a lot of sense to try it again).
2020-10-16mm-modem-helpers: add low_nybble_first argument to mm_bcd_to_stringEric Caruso
All BCD-encoded strings used by MM currently have the low nybble of each byte come before the high nybble, but some strings (such as the EID string returned by QMI Get Slot Status) are meant to be read in order with the high nybble before the low one. As such, extend mm_bcd_to_string to decode both.
2020-09-28shared-qmi: cleanup UIM client if SIM hot swap setup failsAleksander Morgado
The cleanup was missing in one of the steps.
2020-09-28shared-qmi: minor style changes in SIM hot swap logicAleksander Morgado
2020-09-28shared-qmi: implement SIM/profile change detectionTeijo Kinnunen
Implement eUICC change detection for QMI based modems using one of the following mechanisms (in order of preference): 1. If the modem supports "get slot status" operation, we monitor physical slot status indications from the modem for the active slot to detect when ICCID changes. 2. Use "refresh register all" to subscribe refresh indications when the eUICC triggers REFRESH operation following the enablement of a new profile. 3. Use "refresh register" to subscribe refresh indications (file path of EF_ICCID is used) in a similar way. This is used with older modems that do not support "refresh register all". If ICCID change is detected, the already existing SIM hot swap mechanism in MM is triggered.
2020-09-28Revert "shared-qmi: implement SIM/profile change detection"Aleksander Morgado
This reverts commit e91f2ef315526a1a8a1b451acb5a190686b05225. This was wrongly merged squashing multiple commits together. Reverting to merge separate commits.
2020-09-28shared-qmi: implement SIM/profile change detectionTeijo Kinnunen
Implement eUICC change detection for QMI based modems using one of the following mechanisms (in order of preference): 1. If the modem supports "get slot status" operation, we monitor physical slot status indications from the modem for the active slot to detect when ICCID changes. 2. Use "refresh register all" to subscribe refresh indications when the eUICC triggers REFRESH operation following the enablement of a new profile. 3. Use "refresh register" to subscribe refresh indications (file path of EF_ICCID is used) in a similar way. This is used with older modems that do not support "refresh register all". If ICCID change is detected, the already existing SIM hot swap mechanism in MM is triggered.
2020-08-28shared-qmi: implement SIM slot switchingAleksander Morgado
Using the 'UIM switch slot' operation, this commit introduces the ability to change which SIM slot to be active at any given time in a Multi-SIM Single-Standby setup. There is no validation done on whether the selected SIM slot has a valid SIM card inserted or not; if the user selects a slot without any SIM card, the newly probed modem object will start in Failed state right away.
2020-08-28shared-qmi: implement SIM slots loading during initializationAleksander Morgado
This commit introduces Multi-SIM Single-Standby support in all QMI capable devices that support multiple SIM slots. The 'UIM Get Slot Status' method is used to list all available physical slots as well as the availability of SIM cards in the different slots. This method also provides UICC already, so the SIM objects are created early and exposed early in DBus. Once all slots are listed, the logic will briefly make each of the available SIM cards active in order to read additional settings like IMSI, MCCMNC or the Operator name. This brief switching is required because in a Single-Standby setup only one SIM can be active at any given time. The last slot to probe is always the one that was active originally, making sure that the modem initialization logic can go on with the correct SIM slot.
2020-07-16qmi: Network registration via SSSP if possibleSven Schwermer
Doing the network registration via Set System Selection Preference is preferable because it doesn't override the currently set allowed mode, i.e. access technology. https://lists.freedesktop.org/archives/modemmanager-devel/2020-July/007972.html Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2020-06-01shared-qmi: require minimum set of NMEA types before starting GNSS engineAleksander Morgado
2020-04-09shared-qmi: include all possible 5G related combinations if SSP is supportedAleksander Morgado
2020-04-08modem-helpers-qmi: port qmi capabilities parser to use object loggingAleksander Morgado
2020-04-08modem-helpers-qmi: port acquisition order preference parser to use object ↵Aleksander Morgado
logging
2020-04-08modem-helpers-qmi: port qmi interface parser to use object loggingAleksander Morgado
2020-04-08modem-helpers-qmi: port qmi band parser to use object loggingAleksander Morgado
2020-04-08modem-helpers: port supported modes filtering to use object loggingAleksander Morgado
2020-04-08shared-qmi: port to use object loggingAleksander Morgado
2020-01-30shared-qmi: fix warnings with -Wswitch-enumAleksander Morgado
mm-shared-qmi.c: In function ‘pds_set_default_tracking_session_ready’: mm-shared-qmi.c:4209:5: error: enumeration value ‘GPS_OPERATION_MODE_UNKNOWN’ not handled in switch [-Werror=switch-enum] 4209 | switch (ctx->mode) { | ^~~~~~ mm-shared-qmi.c: In function ‘loc_location_set_operation_mode_indication_cb’: mm-shared-qmi.c:4354:5: error: enumeration value ‘GPS_OPERATION_MODE_UNKNOWN’ not handled in switch [-Werror=switch-enum] 4354 | switch (ctx->mode) { | ^~~~~~
2020-01-30shared-qmi: fix warnings with -Wsign-compareAleksander Morgado
mm-shared-qmi.c: In function ‘get_config_info_indication’: mm-shared-qmi.c:2843:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare] 2843 | for (i = 0; i < ctx->config_list->len; i++) { | ^ mm-shared-qmi.c:2850:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare] 2850 | if (i == ctx->config_list->len) | ^~ mm-shared-qmi.c: In function ‘list_configs_indication’: mm-shared-qmi.c:2927:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare] 2927 | for (i = 0; i < configs->len; i++) { | ^
2020-01-30shared-qmi: fix warnings with -Wswitch-defaultAleksander Morgado
mm-shared-qmi.c: In function ‘set_current_capabilities_step’: mm-shared-qmi.c:601:5: error: switch missing default case [-Werror=switch-default] 601 | switch (ctx->step) { | ^~~~~~ mm-shared-qmi.c: In function ‘load_current_capabilities_step’: mm-shared-qmi.c:868:5: error: switch missing default case [-Werror=switch-default] 868 | switch (ctx->step) { | ^~~~~~ mm-shared-qmi.c: In function ‘setup_carrier_config_step’: mm-shared-qmi.c:2473:5: error: switch missing default case [-Werror=switch-default] 2473 | switch (ctx->step) { | ^~~~~~
2019-10-14shared-qmi: fix NAS SSP support check during supported caps loadingAleksander Morgado
2019-07-26shared-qmi: fix potentially uninitialized 'mcc' variableBen Chan
mm-shared-qmi.c:358:9: error: variable 'mcc' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized] if (operator_id && !mm_3gpp_parse_operator_id (operator_id, &mcc, &mnc, &error)) { ^~~~~~~~~~~ mm-shared-qmi.c:367:9: note: uninitialized use occurs here if (mcc) { ^~~ mm-shared-qmi.c:358:9: note: remove the '&&' if its condition is always true if (operator_id && !mm_3gpp_parse_operator_id (operator_id, &mcc, &mnc, &error)) { ^~~~~~~~~~~~~~ mm-shared-qmi.c:339:51: note: initialize the variable 'mcc' to silence this warning guint16 mcc; ^ = 0
2019-07-15shared-qmi: monitor attempt after NAS initiate network registerAleksander Morgado
The QMI NAS Initiate Network Register command will return a successful response when the request to register is received and accepted by the module, but this does not mean the requested registration has been completed yet. This issue was making e.g. manual registration attempts to a forbidden network report success right away, even if the actual registration would end up failing. In order to avoid that, the QMI based network registration relies on receiving QMI NAS Serving System indications after QMI NAS Initiate Network Register replies. As soon as we get a non-searching registration state in the indication, we'll report the operation as successful. Note that the 3GPP interface logic is anyway in charge of checking if the specific request was successful or not, no need to do that explicitly in the QMI implementation.
2019-04-15shared-qmi: config list may be emptyAleksander Morgado
Reported by: Enrico Mioso <mrkiko.rs@gmail.com>
2019-04-09shared-qmi: implement support for MSB A-GPSAleksander Morgado
2019-04-09location,agps: explicitly specify that MSA A-GPS is implementedAleksander Morgado
The A-GPS based implementations we currently have assume MSA A-GPS, so rename the MMModemLocationSource enum value to reflect that.
2019-04-02build: fix -Wunused-but-set-variable support and handle clang betterDan Williams
By default the build used -Wno-unused-but-set-variable but that's clearly not what we want. Fix those problems. When using clang, the compiler doesn't error on unknown compile options, so let's add -Werror to the checking too. CC='clang' configure:3408: checking for gcc configure:3435: result: clang ... configure:17644: checking whether gcc understands -Wno-unused-but-set-variable configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable conftest.c >&5 warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] 1 warning generated. configure:17657: $? = 0 configure:17666: result: yes Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
2019-04-02shared-qmi: always use newest carrier config if more than one foundAleksander Morgado
2019-04-02shared-qmi: if requested config not installed, fallback to genericAleksander Morgado
If there is a known match for a specific config, but the config is not available in the module, we should fallback to the generic configuration.
2019-04-02shared-qmi: no active carrier config means default is in useAleksander Morgado
In addition to any installed MCFG file, the firmware itself as a 'default' config that will be selected when no carrier config is installed. So it is not an error if 'QMI PDC Get Selected Config' doesn't return the 'Active ID' TLV, it just means the default one is selected.
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-02shared-qmi: implement QMI PDC based carrier config supportAleksander Morgado
We implement both loading the current configuration in use, as well as automatically switching to a different one if a mapping file is available.
2018-10-09shared-qmi: implement support for the 'extended' LTE band listAleksander Morgado
This will allow us to configure via mmcli devices that support LTE bands that would not fit in the standard TLVs (e.g. band 66 below) or bands which aren't really reported in the standard TLVs (e.g. bands 46 and 48 below). $ sudo qmicli -d /dev/cdc-wdm0 -p --dms-get-band-capabilities [/dev/cdc-wdm0] Device band capabilities retrieved: Bands: 'wcdma-2100, wcdma-pcs-1900, wcdma-1700-us, wcdma-850-us, wcdma-800, wcdma-900, wcdma-1700-japan, wcdma-850-japan' LTE bands: '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 38, 39, 40, 41, 42, 43' LTE bands (extended): '1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 38, 39, 40, 41, 42, 43, 46, 48, 66'
2018-09-12shared-qmi: reuse band management logic in MBIM whenever possibleAleksander Morgado
2018-09-12shared-qmi: implement 3GPP network registration logicAleksander Morgado
Ported from the broadband modem QMI implementation, keeping the logic in place. We will need this to integrate mode/capability switching in MBIM devices, for nothing else really (as MBIM already supports this operation).
2018-09-12shared-qmi: implement reworked mode and capabilities managementAleksander Morgado
This commit introduces several improvements and changes in the way modes and capabilities are managed in QMI capable devices. It is organized into a single commit, as all changes in all 6 operations (load current capabilities, load supported capabilities, set current capabilities, load supported modes, load current modes, set current modes) are related one to the other (given that the same QMI commands are used for both capabilities and mode management). The primary change is related to which capabilities are reported as supported for a given device. In the previous implementation we allowed switching between every combination possible for GSM/UMTS+LTE, CDMA/EVDO+LTE or GSM/UMTS+CDMA/EVDO+LTE devices. E.g. we would allow "LTE only" and "GSM/UMTS only" capabilities for GSM/UMTS+LTE devices, even if they would both be managed in exactly the same way. That setup wasn't ideal, because it meant that switching to a "LTE only" configuration would require a power cycle, as capability switching requires a power cycle, even if no change was expected in the exposed DBus interfaces (which is why we require the power cycle). So, instead of allowing every possible capability combination, we use capability switching logic exclusively for configuring GSM/UMTS+CDMA/EVDO devices (regardless of whether it has LTE or not) to add or remove the GSM/UMTS and CDMA/EVDO capabilities. E.g. for a GSM/UMTS+CDMA/EVDO+LTE device we would allow 3 combinatios: "GSM/UMTS+LTE", "CDMA/EVDO+LTE" and "GSM/UMTS+CDMA/EVDO+LTE". The "GSM/UMTS+CDMA/EVDO+LTE" is a special case because for this one we allow switching to "LTE only" capabilities while we forbid switching to "4G only" mode. As the same commands are used for mode and capability switching, if we didn't have "LTE only" and we allowed "4G only" mode instead and rebooted the device, we would end up not being able to know which other capabilities (GSM/UMTS or CDMA/EVDO or both) were also enabled. Now that we have capability switching confined to a very subset of combinations, we can use the mode switching logic to e.g. allow "4G only" configurations in all non multimode devices, as well as masks of allowed modes with one being preferred, which we didn't allow before. In the previous implementation all mode switching logic was disabled for LTE capable QMI devices. In the new implementation, we use the "Acquisition Order Preference" TLV in NAS Set System Selection Preference to define the full list of mode preferences for all supported modes. We also no longer just assume that NAS Technology Preference is always available and NAS System Selection Preference only after NAS >= 1.1. This logic is flawed, instead we're going to probe for those features once when loading current capabilities, and we then just implement the capabilities/mode switching logic based on that.
2018-09-12shared-qmi: reuse device factory reset logic in MBIM whenever possibleAleksander Morgado
2018-09-12shared-qmi: reuse device reset logic in MBIM whenever possibleAleksander Morgado
2018-09-12iface-modem-location: validate SUPL server addressAleksander Morgado
Devices will expect SUPL server given as either IP:PORT or FQDN:PORT, so just avoid saying we require a 'URL' because it's not true. We will use a new helper method to parse and validate user-provided SUPL server address.
2018-08-21shared-qmi: include string.h for memset()Ben Chan
This patch fixes the following compiler warning: mm-shared-qmi.c:447:9: error: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned long)' [-Werror,-Wimplicit-function-declaration] memset (buf, 0, sizeof (buf)); ^
2018-08-21shared-qmi: refactor parse_as_utf16_url()Aleksander Morgado
Let it return a GArray directly. We don't expect this method to ever fail, as it's converting from UTF-8 to UTF-16.
2018-08-21shared-qmi: fix context type in GPS operation mode timeout handlerAleksander Morgado