aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-24kernel-device: add get_interface_number() methodAleksander Morgado
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-24examples: network-scan: get rid of global variablesYegor Yefremov
Move the code into the main() routine.
2021-02-24build: improve releasing notesAleksander Morgado
2021-02-23charsets: detect iconv() support in runtimeAleksander Morgado
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-23charsets: define common translit fallback characterAleksander Morgado
2021-02-23charsets: remove charset_hex_to_utf8()Aleksander Morgado
No longer used, replaced by the new common conversion methods.
2021-02-23charsets: remove take_and_convert methodsAleksander Morgado
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-23cinterion: rework mno decoding to use str_to_utf8()Aleksander Morgado
2021-02-23cinterion: rework band encoding to use str_to_utf8()Aleksander Morgado
Also providing support to report errors when attempting to decode the strings.
2021-02-23helpers: rework normalize_operator() to use str_to_utf8()Aleksander Morgado
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-23charsets,tests: update take_and_convert tests to str_from/toAleksander Morgado
2021-02-23cinterion: move sequence to set bands to private ctxAleksander Morgado
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-23charsets: use new str_from_utf8() instead of ↵Aleksander Morgado
take_and_convert_to_current_charset()
2021-02-23charsets: use new bytearray_to_utf8() instead of hex_to_utf8()Aleksander Morgado
2021-02-23charsets: use new bytearray_to_utf8() instead of byte_array_to_utf8()Aleksander Morgado
2021-02-23charsets: make charset_gsm_unpacked_to_utf8() privateAleksander Morgado
Use the generic mm_modem_charset_bytearray_to_utf8() instead.
2021-02-23charsets: use new bytearray_from_utf8() instead of byte_array_append()Aleksander Morgado
2021-02-23charsets: make charset_utf8_to_unpacked_gsm() privateAleksander Morgado
Use the generic mm_modem_charset_bytearray_from_utf8() instead.
2021-02-23charsets: new common APIs to convert from/to charsets and UTF-8Aleksander Morgado
2021-02-23charsets: avoid //TRANSLIT when converting to/from charsetsAleksander Morgado
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-23charsets: make translit optional in utf8_to_unpacked_gsm()Aleksander Morgado
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-23charsets: make translit optional in gsm_unpacked_to_utf8()Aleksander Morgado
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-23libmm-glib,tests: add ishexstr/hexstr2bin/bin2hexstr unit testsAleksander Morgado
2021-02-23libmm-glib,common-helpers: make hexstr2bin() return a guint8 arrayAleksander Morgado
It makes much more sense than returning a gchar array, as gchar is signed.
2021-02-23libmm-glib,common-helpers: ishexstr() fails on empty input stringAleksander Morgado
2021-02-23libmm-glib,common-helpers: hexstr2bin fails on empty input stringAleksander Morgado
Also, remove the trailing NUL byte that was appended to the output binary stream, as it's not needed in any case.
2021-02-23libmm-glib,common-helpers: make hexstr2bin() accept input string lengthAleksander Morgado
Optionally given explicitly, and -1 can be used to assume it's NUL-terminated.
2021-02-23libmm-glib,common-helpers: make hexstr2bin() return a GErrorAleksander Morgado
This util method checks whether the input string is a valid hex string, so make sure we return a GError on failure.
2021-02-23charsets: remove unused charset_utf8_to_hex() methodAleksander Morgado
2021-02-23charsets: don't allow quoting in byte_array_append()Aleksander Morgado
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-23charsets: remove HEX charset typeAleksander Morgado
This is no real charset, it is the fake one we used to represent a UCS2 hex-encoded string.
2021-02-23charsets: define charset enum explicitly as flagsAleksander Morgado
2021-02-23build: post-release version bump to 1.17.0Aleksander Morgado
2021-02-23release: bump version to 1.16.0Aleksander Morgado
2021-02-23NEWS: update for 1.16.0Aleksander Morgado
2021-02-23build: require libqmi 1.28.0Aleksander Morgado
2021-02-23bearer-mbim: IP type may be reported as deactivated and still have IP settingsAleksander Morgado
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-17api,introspection: flag as DEPRECATED the 'number' bearer settingAleksander Morgado
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-17libmm-glib,simple-connect-properties: add missing APIs to get/set RM protocolAleksander Morgado
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-17libmm-glib,bearer-properties: consume 'rm-protocol' settingAleksander Morgado
2021-02-15examples: modem-watcher: get rid of global variablesYegor Yefremov
Move the code into the main() routine and pass main_loop as a parameter to the signal handler.
2021-02-15examples: ModemWatcher: convert comments in the doc stringsYegor Yefremov
Move comments under the class and method definitions. Also rework boolean handling.
2021-02-15po: add Hebrew translationYaron Shahrabani
2021-02-15broadband-modem-mbim: detect 5G support in custom data classAleksander Morgado
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/301
2021-02-14examples: network-scan: enable modem before the network scanYegor Yefremov
Otherwise we get the following exception: Traceback (most recent call last): File "/root/network-scan-python", line 57, in <module> networks = modem3gpp.scan_sync() gi.repository.GLib.Error: mm_core_error_quark: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: Cannot scan networks: not enabled yet (8)
2021-02-14examples: network-scan: resolve PEP8 issuesYegor Yefremov
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-14device: avoid trying to remove source multiple timesAleksander Morgado
ModemManager[115879]: <debug> [1613341789.760031] [modem3] completely disposed (ModemManager:115879): GLib-CRITICAL **: 23:29:49.760: Source ID 2379 was not found when attempting to remove it Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff774b343 in g_logv () from /usr/lib/libglib-2.0.so.0 (gdb) (gdb) bt #0 0x00007ffff774b343 in g_logv () at /usr/lib/libglib-2.0.so.0 #1 0x00007ffff774b5c0 in g_log () at /usr/lib/libglib-2.0.so.0 #2 0x00007ffff7741c9e in g_source_remove () at /usr/lib/libglib-2.0.so.0 #3 0x00005555555aad02 in dispose (object=0x555555831260) at mm-device.c:802 #4 0x00007ffff7843755 in g_object_unref () at /usr/lib/libgobject-2.0.so.0 #5 0x00005555555a5107 in glib_autoptr_clear_MMDevice (_ptr=0x555555831260) at mm-device.h:63 #6 0x00005555555a5125 in glib_autoptr_cleanup_MMDevice (_ptr=0x7fffffffe090) at mm-device.h:63 #7 0x00005555555a59ab in device_removed (self=0x555555769220, subsystem=0x55555577dc50 "tty", name=0x555555869a40 "ttyUSB3") at mm-base-manager.c:237 #8 0x00005555555a620d in handle_uevent (self=0x555555769220, action=0x5555558987b0 "remove", device=0x555555893840) at mm-base-manager.c:445 #9 0x00007ffff7381acd in () at /usr/lib/libffi.so.7 #10 0x00007ffff738103a in () at /usr/lib/libffi.so.7 #11 0x00007ffff783c8fe in g_cclosure_marshal_generic () at /usr/lib/libgobject-2.0.so.0 #12 0x00007ffff7837072 in g_closure_invoke () at /usr/lib/libgobject-2.0.so.0 #13 0x00007ffff785fa85 in () at /usr/lib/libgobject-2.0.so.0 #14 0x00007ffff78535dd in g_signal_emit_valist () at /usr/lib/libgobject-2.0.so.0 #15 0x00007ffff7853b40 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0 #16 0x00007ffff7e792aa in () at /usr/lib/libgudev-1.0.so.0 #17 0x00007ffff7742b84 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0 #18 0x00007ffff7796c21 in () at /usr/lib/libglib-2.0.so.0 #19 0x00007ffff77420d3 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0 #20 0x00005555555a1df4 in main (argc=2, argv=0x7fffffffea88) at main.c:213
2021-02-14context: add test-no-suspend-resume cli parameterDylan Van Assche
Disables suspend/resume support at runtime. This is useful for modems which are never turned off or suspended when the host suspends.
2021-02-13examples,python: ignore scan operation in modems without 3GPP interfaceAleksander Morgado
Traceback (most recent call last): File "/home/aleksander/Development/foss/ModemManager/examples/network-scan-python/./network-scan-python", line 46, in <module> modem3gpp.set_default_timeout(300000) AttributeError: 'NoneType' object has no attribute 'set_default_timeout'
2021-02-13examples,python: fix undefined NameError in modem watcher exampleAleksander Morgado
$ ./modem-watcher-python [ModemWatcher] ModemManager 1.15.0 service is available in bus [ModemWatcher] QUALCOMM INCORPORATED (0) modem managed by ModemManager [863974040050058]: /org/freedesktop/ModemManager1/Modem/0 [ModemWatcher] Sierra Wireless Inc. (Sierra Wireless EM7345 4G LTE) modem managed by ModemManager [013937003110648]: /org/freedesktop/ModemManager1/Modem/1 Traceback (most recent call last): File "/home/aleksander/Development/foss/ModemManager/examples/modem-watcher-python/./modem-watcher-python", line 35, in <module> watcher = ModemWatcher.ModemWatcher() File "/home/aleksander/Development/foss/ModemManager/examples/modem-watcher-python/ModemWatcher.py", line 48, in __init__ self.on_name_owner(self.manager, None) File "/home/aleksander/Development/foss/ModemManager/examples/modem-watcher-python/ModemWatcher.py", line 85, in on_name_owner self.set_available() File "/home/aleksander/Development/foss/ModemManager/examples/modem-watcher-python/ModemWatcher.py", line 64, in set_available self.on_object_added(self.manager, obj) File "/home/aleksander/Development/foss/ModemManager/examples/modem-watcher-python/ModemWatcher.py", line 101, in on_object_added modem_index(obj.get_object_path())) NameError: name 'modem_index' is not defined