Commit Graph

7259 Commits

Author SHA1 Message Date
Teijo Kinnunen
72d753ba83 base-sim: select PLMN list before reading preferred networks
Before reading preferred network list with AT+CPOL?, AT+CPLS=0 is
now invoked first to make sure that the correct PLMN list (i.e.
user-defined) is selected.
2021-03-09 08:52:55 +02:00
Aleksander Morgado
a659970634 broadband-modem-qmi: update EPS/5GS reg state when idle/searching
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/317
2021-03-05 17:36:33 +00:00
Louis-Alexis Eyraud
154455a723 zte: disable CMER/CIND support explicitly
It looks like when indicators are enabled in ZTE modems like the
MF833V, the whole connection process is very unstable. The AT
reference doesn't do any mention to +CIND/CMER/CIEV either, so we'll
just disable all and use +CSQ based signal loading.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/303

Signed-off-by: Louis-Alexis Eyraud <louis-alexis.eyraud@sigfox.com>
2021-03-05 10:19:23 +01:00
Aleksander Morgado
55d60f3c12 sms: common timeout of 180s for the send operation
On low signal quality conditions, the process of sending the SMS to
the network may take a really long time, way more than the 30s used as
default in some implementations.

We now define a common timeout value of 180s for this operation in all
protocols.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/328
2021-03-04 20:45:00 +00:00
Aleksander Morgado
5d176a1e61 base-modem: explicitly say if NET or TTY data ports are supported
A modem that creates exclusively bearer objects that work with NET
ports (e.g. all QMI or MBIM modems) must not add any TTY port in the
list of data ports.

A modem that creates exclusively bearer objects that work with TTY
ports (e.g. the generic modem) must not add any NET port in the
list of data ports.

A modem that may use both TTY and NET ports should add all in the list
of data ports.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/324
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/329
2021-03-04 18:03:28 +01:00
Aleksander Morgado
b509229d57 broadband-modem-qmi: use updated system info API 2021-03-02 14:38:35 +01:00
Aleksander Morgado
496c4e30e9 broadband-modem-qmi: enable network reject indications
We will issue warnings in the log whenever a network reject indication
is received.
2021-03-02 14:38:35 +01:00
Dylan Van Assche
8bc90b7131 broadband-modem-qmi: Enable AT URCs and QMI indications
Enable both AT URCs and QMI indications for messaging events.
This allows to receive text messages during suspend
on the PinePhone with a Quectel EG25 modem.
2021-03-01 16:18:33 +00:00
Aleksander Morgado
438ff54d03 libmm-glib,tests: include string.h explicitly
For strlen()
2021-03-01 16:02:33 +01:00
Aleksander Morgado
da0e610f5f modem-helpers-mbim: include string.h explicitly
For strstr()
2021-03-01 15:56:14 +01:00
Aleksander Morgado
a9611c6279 utils: import ptr array lookup with GEqualFunc from GLib 2.54
This fixes the build when using GLib < 2.54.
2021-03-01 15:55:22 +01:00
Pavan Holla
e1372a716e iface-modem: detect hotswap on all slots
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-27 15:26:43 +01:00
Aleksander Morgado
fbc1636001 docs: add api index for 1.18 2021-02-26 12:28:01 +01:00
Teijo Kinnunen
a4aba0a6b2 mmcli,sim: add preferred networks list to SIM properties 2021-02-26 12:28:01 +01:00
Teijo Kinnunen
816beeffcb libmm-glib,modem-helpers,mm-base-sim: implement Sim.PreferredNetworks
The ModemManager1.Sim.PreferredNetworks property contains the preferred
networks (and access technologies, if available) configured to the
SIM card.

This commit implements preferred networks reading with AT+CPOL.
2021-02-26 12:28:01 +01:00
Aleksander Morgado
c7d366671f shared-qmi: network registration cancellation logic with asserts disabled
g_assert() calls may be disabled, and if so, the network registration
task would never get completed.
2021-02-26 11:18:22 +01:00
Aleksander Morgado
f10e4af919 libmm-glib,bearer-properties: fix 'allow roaming' comparison
Fix the 'allow roaming' setting comparison, which was breaking the
whole bearer properties comparison logic, and therefore making
Simple.Connect() recreate over and over the bearer with the same
settings.

Fixes 5629f47a59
2021-02-25 15:23:36 +01:00
Yegor Yefremov
297a8c85ae examples: sms: resolve PEP8 issues
Use autopep8 utility to resolve issues like spaces before brackets
and wrong hanging indentation.

Also treat objects like boolean variables to check whether they are
None or not.
2021-02-25 14:14:55 +01:00
Aleksander Morgado
aba237df4e broadband-modem-qmi: allow lookup of QMI for data without SIO port 2021-02-25 14:13:03 +01:00
Aleksander Morgado
381e2f382b base-modem: separate method to lookup exact port by name
There's no point in returning a list of all ports with a given name,
just provide a lookup method that returns the single port with the
given name.
2021-02-25 14:13:03 +01:00
Aleksander Morgado
b8e076f9c4 kernel-device-udev: keep track of the client object
Instead of creating new clients internally whenever we need them, just
make sure each MMKernelDeviceUdev object keeps a full reference to the
GUdevClient that generated all GUdevDevices.
2021-02-25 12:13:16 +01:00
Aleksander Morgado
1b35d74c15 kernel-device: add get_interface_number() method
We already have methods to query for interface specific attributes
like class/subclass/protocol, so add a new one for the interface
number, and make sure we use ATTRS{bInterfaceNumber} to load it
always, instead of assuming the ID_USB_INTERFACE_NUM property is set.
2021-02-24 20:47:57 +01:00
Yegor Yefremov
cc07d21410 examples: network-scan: get rid of global variables
Move the code into the main() routine.
2021-02-24 14:59:48 +01:00
Aleksander Morgado
6250603496 build: improve releasing notes 2021-02-24 09:16:49 +01:00
Aleksander Morgado
4a06a02765 charsets: detect iconv() support in runtime
The only purpose of this is to log what we found, nothing else, as a
quick way to detect platform support for the charsets we need.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
8a8e00168b charsets: define common translit fallback character 2021-02-23 11:35:11 +00:00
Aleksander Morgado
c84454c1b0 charsets: remove charset_hex_to_utf8()
No longer used, replaced by the new common conversion methods.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
0ff3eb7ee0 charsets: remove take_and_convert methods
These methods worked in a very strict way for some encodings, and in a
very very loose way for others. E.g. when converting from hex-encoded
UCS-2, we would attempt to convert as much text as we could even if
the input string was truly not even close to UCS-2. This kind of "do
our best" could make sense when processing e.g. the operator name
reported by the modem, as that is some string to show to the user and
there may be no strict requirement to have it perfectly fine. But the
kind of loose comparison done for UCS-2 doesn't make sense e.g. when
converting USSD responses or SMS messages.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
ab4c31ec0b cinterion: rework mno decoding to use str_to_utf8() 2021-02-23 11:35:11 +00:00
Aleksander Morgado
6bc07b4b14 cinterion: rework band encoding to use str_to_utf8()
Also providing support to report errors when attempting to decode the
strings.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
16df1e17e6 helpers: rework normalize_operator() to use str_to_utf8()
Instead of blindly assuming that we can take whatever string given as
valid UTF-8, we'll always attempt to convert from the current modem
charset into UTF-8. Before we were doing this for hex-encoded UCS2,
but not for example for GSM-7.

And due to the now applied GSM-7 conversion, the mf627a/mf627b +COPS
parsing unit tests are updated accordingly, because when converting
from an input string that contains byte 0x40 ('@' in UTF-8) as if it
were GSM-7, the 0x40 is taken as character '¡', encoded as 0xc2,0xa1
in UTF-8).
2021-02-23 11:35:11 +00:00
Aleksander Morgado
63fa9eee46 charsets,tests: update take_and_convert tests to str_from/to 2021-02-23 11:35:11 +00:00
Aleksander Morgado
3ac248a7a6 cinterion: move sequence to set bands to private ctx
The sequence of commands is exclusively used during the set current
bands operation, so there is no point in storing it in the private
object data.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
e5363b546b charsets: use new str_from_utf8() instead of take_and_convert_to_current_charset() 2021-02-23 11:35:11 +00:00
Aleksander Morgado
395ab06c03 charsets: use new bytearray_to_utf8() instead of hex_to_utf8() 2021-02-23 11:35:11 +00:00
Aleksander Morgado
5ea4a591a4 charsets: use new bytearray_to_utf8() instead of byte_array_to_utf8() 2021-02-23 11:35:11 +00:00
Aleksander Morgado
033e174e44 charsets: make charset_gsm_unpacked_to_utf8() private
Use the generic mm_modem_charset_bytearray_to_utf8() instead.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
8bfdfb187b charsets: use new bytearray_from_utf8() instead of byte_array_append() 2021-02-23 11:35:11 +00:00
Aleksander Morgado
75b37e16b1 charsets: make charset_utf8_to_unpacked_gsm() private
Use the generic mm_modem_charset_bytearray_from_utf8() instead.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
9c613d33e1 charsets: new common APIs to convert from/to charsets and UTF-8 2021-02-23 11:35:11 +00:00
Aleksander Morgado
6f32c8d38f charsets: avoid //TRANSLIT when converting to/from charsets
The //TRANSLIT extension is not always supported by the different
iconv() implementations that we may find out there, so let's
completely avoid using it.

For some of the charsets it actually didn't make much sense anyway,
e.g. as converting to UTF-16 or UTF-8 would always be possible without
requiring //TRANSLIT to take effect.

The //TRANSLIT extension was also being used sometimes in the source
charset identification, which was also not fully correct, as we would
only expect it in the target charset identification.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
bc449cbe87 charsets: make translit optional in utf8_to_unpacked_gsm()
If the conversion is not fully compatible, the user of the method
needs to request transliteration enabled explicitly in order to avoid
returning errors in this method.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
5ce97abd73 charsets: make translit optional in gsm_unpacked_to_utf8()
Until now, this method would automatically apply transliteration;
i.e. replacing characters with '?' when no direct translation was
available.

We can attempt to do that transliteration on strings that are not
critical, e.g. the operator name reported by the network. But we
should not do that on other types of strings, e.g. on SMS contents
that may really have additional purposes than just being
human-readable.

This commit makes the transliteration option to be explicitly
requested by the caller.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
5480cb67b2 libmm-glib,tests: add ishexstr/hexstr2bin/bin2hexstr unit tests 2021-02-23 11:35:11 +00:00
Aleksander Morgado
34de613dea libmm-glib,common-helpers: make hexstr2bin() return a guint8 array
It makes much more sense than returning a gchar array, as gchar is
signed.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
6d8610d63e libmm-glib,common-helpers: ishexstr() fails on empty input string 2021-02-23 11:35:11 +00:00
Aleksander Morgado
8c30a6b6f8 libmm-glib,common-helpers: hexstr2bin fails on empty input string
Also, remove the trailing NUL byte that was appended to the output
binary stream, as it's not needed in any case.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
a211981d4a libmm-glib,common-helpers: make hexstr2bin() accept input string length
Optionally given explicitly, and -1 can be used to assume it's
NUL-terminated.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
657cabcfce libmm-glib,common-helpers: make hexstr2bin() return a GError
This util method checks whether the input string is a valid hex
string, so make sure we return a GError on failure.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
dbdf67e9f7 charsets: remove unused charset_utf8_to_hex() method 2021-02-23 11:35:11 +00:00