Commit Graph

7297 Commits

Author SHA1 Message Date
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
Aleksander Morgado
8b590721df charsets: don't allow quoting in byte_array_append()
There's no point in adding a quoting option to this method; if the
caller needs the appended string quoted, it should quote it before
passing it to this method.

It was nowhere used anyway.
2021-02-23 11:35:11 +00:00
Aleksander Morgado
38a4a9c842 charsets: remove HEX charset type
This is no real charset, it is the fake one we used to represent a
UCS2 hex-encoded string.
2021-02-23 11:35:10 +00:00
Aleksander Morgado
a025e83e5a charsets: define charset enum explicitly as flags 2021-02-23 11:35:10 +00:00
Aleksander Morgado
19e5d5f926 build: post-release version bump to 1.17.0 2021-02-23 12:20:53 +01:00
Aleksander Morgado
7a5a49b753 release: bump version to 1.16.0 2021-02-23 11:35:50 +01:00
Aleksander Morgado
7a5eae2a36 NEWS: update for 1.16.0 2021-02-23 11:22:50 +01:00
Aleksander Morgado
bbd3638d12 build: require libqmi 1.28.0 2021-02-23 11:22:50 +01:00
Aleksander Morgado
a546201470 bearer-mbim: IP type may be reported as deactivated and still have IP settings
If we were requesting for IPv4v6 and we only got IPv4 reported as
activated, we would right away ignore the IPv6 bits, even if we
received IPv6 settings later on when querying for them. Change that,
so that if an IP address of a given type is received, we assume the
corresponding context was really activated even if the modem didn't
report it in the connect set response.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/320
2021-02-23 09:29:29 +01:00
Aleksander Morgado
29d9dc7e0c api,introspection: flag as DEPRECATED the 'number' bearer setting
This setting is unused since some releases ago, and the corresponding
libmm-glib methods were already flagged as deprecated. Let's add an
explicit mention to this deprecation on the DBus API itself.
2021-02-17 23:53:51 +01:00
Aleksander Morgado
6dd5ced86d libmm-glib,simple-connect-properties: add missing APIs to get/set RM protocol
Probably not a big deal, since no one has asked for these in the past
years, but let's add them for completeness with the DBus API.
2021-02-17 23:41:24 +01:00
Aleksander Morgado
c4f215c9cb libmm-glib,bearer-properties: consume 'rm-protocol' setting 2021-02-17 23:40:59 +01:00
Yegor Yefremov
69926d9335 examples: modem-watcher: get rid of global variables
Move the code into the main() routine and pass main_loop as
a parameter to the signal handler.
2021-02-15 21:10:34 +01:00