aboutsummaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers.c
AgeCommit message (Collapse)Author
2020-04-08modem-helpers: parse cgdcont test parser to use object loggingAleksander Morgado
2020-04-08modem-helpers: port cid selection helper to use object loggingAleksander Morgado
2020-04-08modem-helpers: port cops test parser to use object loggingAleksander Morgado
2020-04-08modem-helpers: port ifc test parser to use object loggingAleksander Morgado
2020-04-08modem-helpers: port supported modes filtering to use object loggingAleksander Morgado
2020-04-08modem-helpers: port device identifier to use object logging and autoptrAleksander Morgado
2020-01-31modem-helpers: fix warnings with -Wswitch-enumAleksander Morgado
mm-modem-helpers.c: In function ‘mm_3gpp_get_pdp_type_from_ip_family’: mm-modem-helpers.c:4166:5: error: enumeration value ‘MM_BEARER_IP_FAMILY_NONE’ not handled in switch [-Werror=switch-enum] 4166 | switch (family) { | ^~~~~~ mm-modem-helpers.c:4166:5: error: enumeration value ‘MM_BEARER_IP_FAMILY_ANY’ not handled in switch [-Werror=switch-enum]
2020-01-31modem-helpers: fix warnings with -Wdiscarded-qualifiersAleksander Morgado
mm-modem-helpers.c:4019:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4019 | { MM_MODEM_3GPP_FACILITY_SIM, "SC" }, | ^~~~ mm-modem-helpers.c:4020:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4020 | { MM_MODEM_3GPP_FACILITY_PH_SIM, "PS" }, | ^~~~ mm-modem-helpers.c:4021:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4021 | { MM_MODEM_3GPP_FACILITY_PH_FSIM, "PF" }, | ^~~~ mm-modem-helpers.c:4022:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4022 | { MM_MODEM_3GPP_FACILITY_FIXED_DIALING, "FD" }, | ^~~~ mm-modem-helpers.c:4023:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4023 | { MM_MODEM_3GPP_FACILITY_NET_PERS, "PN" }, | ^~~~ mm-modem-helpers.c:4024:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4024 | { MM_MODEM_3GPP_FACILITY_NET_SUB_PERS, "PU" }, | ^~~~ mm-modem-helpers.c:4025:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4025 | { MM_MODEM_3GPP_FACILITY_PROVIDER_PERS, "PP" }, | ^~~~ mm-modem-helpers.c:4026:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 4026 | { MM_MODEM_3GPP_FACILITY_CORP_PERS, "PC" } | ^~~~
2020-01-31modem-helpers: fix warnings with -Wsign-compareAleksander Morgado
mm-modem-helpers.c: In function ‘parse_uint’: mm-modem-helpers.c:1953:36: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘glong’ {aka ‘long int’} [-Werror=sign-compare] 1953 | if ((nmin == nmax) || (ret >= nmin && ret <= nmax)) | ^~ mm-modem-helpers.c:1953:51: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘glong’ {aka ‘long int’} [-Werror=sign-compare] 1953 | if ((nmin == nmax) || (ret >= nmin && ret <= nmax)) | ^~
2020-01-06broadband-modem: +COPS=? response may give strings in UCS2Aleksander Morgado
If the charset selected via CSCS is UCS2, the modem may decide to return all the strings in the +COPS=? response in UCS2: <debug> (ttyACM0): --> 'AT+COPS=?<CR>' <debug> (ttyACM0): <-- '<CR><LF>+COPS: (2,"004D006F007600690073007400610072","004D006F007600690073007400610072","00320031003400300037",7) <debug> Found network '00320031003400300037' ('004D006F007600690073007400610072','004D006F007600690073007400610072'); availability: current, access tech: lte
2019-10-17sim: load emergency numbers from EF_ECCAleksander Morgado
2019-10-14modem-helpers: support reporting 'terminated' call state in +CLCCAleksander Morgado
2019-09-13broadband-bearer: setup cid selection as a testable methodAleksander Morgado
Rework how the broadband bearer runs CGDCONT? and CGDCONT=? and setup a helper method to perform the CID selection logic. Also, implement unit tests for the CID selection logic.
2019-07-19broadband-modem,voice: implement call waiting status setup/query with +CCWAAleksander Morgado
2019-07-11helpers: new '+CLCC' test response parserAleksander Morgado
2019-07-11broadband-modem: implement +CCWA URC handlingAleksander Morgado
2019-07-10misc: use g_regex_match() for simplicityBen Chan
This CL converts a few g_regex_match_full() expressions to their equivalent g_regex_match() in order to simplify the code, i.e. g_regex_match_full (regex, str, strlen (str), 0, 0, &match_info, NULL) is equivalent to: g_regex_match_full (regex, str, -1, 0, 0, &match_info, NULL) or simply: g_regex_match (regex, str, 0, &match_info)
2019-06-28modem-helpers: ignore format of unneeded fields in +CLIP URCAleksander Morgado
The regex was expecting empty values in several of the fields, which is wrong. Instead of matching empty fields, just ignore all fields that we don't require in our logic.
2019-04-03modem-helpers: fix memory leak in mm_3gpp_parse_pdu_cmgl_responseBen Chan
This patch fixes a potential memory leak in mm_3gpp_parse_pdu_cmgl_response() where the allocated MM3gppPduInfo may be leaked when failing to parse the +CMGL response.
2018-11-26broadband-modem: enable and handle +CGEV indicationsAleksander Morgado
The +CGEV indications allow us to get notified of packet domain events like network-initiated or ME-initiated disconnections on specific connected contexts, as well as full PS detach events (all contexts disconnected). If the modem supports these indications, we will enable them with +CGEREP and will then process them when they are emitted by the modem. If a full PS detach event happens, we will explicitly disconnect all connected bearers. If a deactivation inidication is received for a single context, we will look for the associated bearer by CID and explicitly disconnect it.
2018-10-27modem-helpers: remove useless checks on always true conditionBen Chan
mm-modem-helpers.c:3075:31: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] g_return_val_if_fail (idx >= 0, NULL); ^
2018-10-26modem-helpers: new helper to convert binary-coded decimalsBen Chan
This patch adds a mm_bcd_to_string() helper function to convert a byte array representing a binary-coded decimal (BCD) number to a string representing the equivalent decimal number.
2018-10-18core: remove unnecessary NULL checks for g_match_info_free()Ben Chan
g_match_info_free() already check if the given pointer is NULL and does nothing on a NULL pointer.
2018-10-09sierra-legacy: implement connection status monitoring with !SCACT?Aleksander Morgado
Devices like the Netgear AC313U require explicit context monitoring, otherwise the device may end up disconnected internally and MM would still think that the connection is ongoing.
2018-10-04libmm-glib, modem-helpers: unref enum/flags GType classes in enum gettersThomas Haller
2018-09-13modem-helpers: Make 3gpp signal quality functions publicPaul Bartell
2018-09-12helpers: allow [A-F] range in operator-specific ICCID account numberAleksander Morgado
There are operators (e.g. the Chinese CMCC operator) that abuse the fact that 4 bits are used to store the BCD encoded numbers, and also use the [A-F] range as valid characters for the ICCID in the operator specific account number part. Haven't seen any documentation where this format with [A-F] characters is explicitly allowed, but I have seen multiple real cases where it happens. E.g.: 898602F9091830030220 898602C0123456789012 This patch also removes the 'last F' validation, used when reading 19-digit ICCIDs with +CRSM, as it no longer applies.
2018-09-12helpers: allow 19-digit reported ICCIDsAleksander Morgado
The mm_3gpp_parse_iccid() method does validation of the ICCID string and was originally implemented to handle +CRSM reported values. The implementation was looking for 20-digit strings, even for 19-digit ICCIDs (those finished with a trailing 'F'). We now extend the logic to also validate ICCID strings reported as 19-digit values directly, and when that happens we won't allow swapping of the digits (a +CRSM specific requirement) or trailing 'F' characters (as that is only required when reporting 19-digit ICCIDs with 20-digit strings). This change allows us to e.g. use the u-blox specific AT+CCID command and validate the returned ICCID with the same helper method, which currently fails: (ttyACM2): --> 'AT+CCID<CR>' (ttyACM2): <-- '<CR><LF>+CCID: 8934077700015848638<CR><LF><CR><LF>OK<CR><LF>' couldn't load SIM identifier: 'Invalid ICCID response size (was 19, expected 20)'
2018-09-12modem-helpers: reuse nicknames for the flow control tagsAleksander Morgado
And check that the string given in the tag is actually a valid one.
2018-09-12modem-helpers: add flow control udev tag parserAlfonso Sánchez-Beato
Add function for parsing the content of the udev tag ID_MM_TTY_FLOW_CONTROL.
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-04-30broadband-bearer: allow matching empty APN when looking for PDP CIDAleksander Morgado
The PDP contexts that are found with an empty APN configured are right now used as placeholders that can be overwritten with the user provided APN if no direct match is found. We want to keep that logic in place, but for the case where we do get an empty APN requested by the user, we need to perform the full context match, so that the first PDP context matching the empty APN is used. Right now we're overwriting with the empty APN again the last PDP context found with an empty APN, which doesn't make much sense: Apr 27 08:15:21 ModemManager[4251]: <debug> Found '3' PDP contexts Apr 27 08:15:21 ModemManager[4251]: <debug> PDP context [cid=1] [type='ipv4'] [apn=''] Apr 27 08:15:21 ModemManager[4251]: <debug> PDP context [cid=2] [type='ipv4'] [apn='broadband'] Apr 27 08:15:21 ModemManager[4251]: <debug> PDP context [cid=15] [type='ipv4'] [apn=''] Apr 27 08:15:21 ModemManager[4251]: <debug> Found PDP context with CID 1 and no APN Apr 27 08:15:21 ModemManager[4251]: <debug> Found PDP context with CID 15 and no APN Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3) device open count is 3 (open) Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3) device open count is 2 (close) Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3): --> 'AT+CGDCONT=15,"IP",""<CR>' Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3): <-- '<CR><LF>OK<CR><LF>'
2018-01-25*: Spelling fixesVille Skyttä
2018-01-20broadband-modem: implement support for the +CEMODE commandAleksander Morgado
The +CEMODE command is defined in 3GPP TS 27.007 (e.g. in section 10.1.28 in v11.0.0). This command allows querying or updating the current UE mode, as well as checking the supported modes. We implement support for loading the current mode and updating it. It is assumed that the device does any additional operation needed by the setting update, e.g. un-registering from CS when selecting an EPS-only mode.
2018-01-01helpers: move generic load_unlock_retries from Telit pluginColin Helliwell
As a precursor to a generic load_unlock_retries method, move the CSIM Response parser from the Telit plugin into the core code.
2017-08-09modem-helpers: allow unquoted strings in +CCLK responsesAleksander Morgado
Also: * define the leading '+' as a escaped value * allow any number of spaces between '+CCLK' and the string value.
2017-07-19helpers: +CNUM parser doesn't return any errorAleksander Morgado
2017-07-14modem-helpers: minor coding style fixesBen Chan
2017-06-16helpers: extend +WS46=? response parser to support rangesDaniele Palmas
Telit LTE modems could reply to +WS46=? with: +WS46: (12,22,25,28-31) This patch extends +WS46=? response parser to support ranges.
2017-06-07helpers: remove unnecessary `>= 0' checks on guint valueBen Chan
This CL removes the unnecessary `>= 0' check on `mode_val' and `ind_val', which are both guint values extracted from a GArray with guint values, in mm_3gpp_parse_cmer_test_response to address the following compiler warnings: mm-modem-helpers.c:2933:22: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] if (mode_val >= 0 && mode_val <= 3) ~~~~~~~~ ^ ~ mm-modem-helpers.c:2943:21: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] if (ind_val >= 0 && ind_val <= 2) ~~~~~~~ ^ ~
2017-05-29helpers: new 'AT+CMER=?' parserAleksander Morgado
2017-04-18helpers: new parser for AT+IFC=?Aleksander Morgado
Instead of having the parser return separate list of supported flow controls for TE and TA, we simplify it by only returning those settings that apply to both TE and TA. This logic isn't perfect either, though, as some settings (e.g. '3' in TE in some modems, specifying a different XON/XOFF behavior) may not have a corresponding setting in the other end. The most common cases we care about (i.e. standard XON/XOFF, RTS/CTS) should be properly reported with this logic.
2017-04-02broadband-modem: normalize also operator codeAleksander Morgado
The operator code (MCCMNC) may also be given encoded in the current charset (e.g. UCS2). Based on a patch from Colin Helliwell <colin.helliwell@ln-systems.com>
2017-04-02modem-helpers: if operator not in UCS2, see if already valid UTF-8Aleksander Morgado
The method doing the operator name normalization takes as input the current configured modem charset. If this is UCS2, we will now just assume this is a hint: the string may or may not come in hex/UCS2. This logic makes the custom operator name loading in Huawei unneeded, if the modem is configured in UCS2, we still properly process operator names coming in plain ASCII.
2017-03-24broadband-modem,helpers: implement AT+WS46=? response parserAleksander Morgado
We want a parser that returns the full list of combinations found.
2016-11-18modem-helpers: improve +CCLK parsingAleksander Morgado
Added support for 4-digit format years (i.e. YYYY), and also made the timezone information optional, as per +CSDF in 3GPP TS 27.007. https://bugs.freedesktop.org/show_bug.cgi?id=95319
2016-10-12modem-helpers: implement less strict APN comparisonAleksander Morgado
u-blox modems will append a string showing the MCC and MNC info to the access point name listed in AT+CGDCONT? responses. We will try to detect when that happens, and we just accept the match. The logic doesn't just look for a string prefix; it also looks for the special MCC + MNC suffix, which is much more restrictive, to try to avoid false positives.
2016-10-12modem-helpers: new helper to parse +CESQ response into MMSignal objectsAleksander Morgado
2016-10-12modem-helpers: new +CESQ response parserAleksander Morgado
2016-10-123gpp: update registration state enumeration with CSFB related statesAleksander Morgado
Introduce "sms only" and "CSFB not preferred" home/roaming states to be reported for the CS context, while already registered on LTE. Based on 3GPP TS 27.007 v13.5.0.