Commit Graph
4168 Commits
Author SHA1 Message Date
Aleksander Morgado b77c15f8b5 broadband-modem-mbim: minor rework in SIM event related comments 2021-08-04 14:21:44 +02:00
Aleksander Morgado bcf5f2bc8b broadband-modem-mbim: also report as available not fully ready SIMs
If a SIM card is not fully ready or in a failed state in the
non-active slot, we should still report them as available.
2021-08-04 14:21:39 +02:00
ZhangMingjie 3004e99fcb broadband-modem-mbim: deal with the slot info status notification event for DSSA 2021-08-04 11:02:43 +02:00
Loic Poulain 9e5e699227 kernel-device-generic: Fix ptr_array_add_sysfs_attribute_link_basename
A pointer can not be used anymore after its ownership has been transfered
using the g_steal_pointer function (pointer is nullified).

In this function, g_steal_pointer() is used when inserting 'value' inside
the array but can also be subsequently used when dumping 'value' to
'out_value' via g_strdup().

Fix that with simple reordering.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-08-04 07:40:09 +00:00
Joel Selvaraj b91bf1e3a6 modem-qmi: implement multiparty functionalities
The following functionalities are implemented:
1. Hold all and accept
2. Hangup all and accept
3. Hangup all
4. Join multiparty
5. Leave multiparty
6. Call transfer
2021-08-02 13:11:29 +00:00
Joel Selvaraj 691cb9b694 modem-qmi: implement call waiting setup and query 2021-08-02 13:11:29 +00:00
Joel Selvaraj 1894dd7767 modem-qmi: implement setup in call unsolicited events
Handle supplementary service notification indication.
Useful to know when existing call is on hold, unheld and waiting.
2021-08-02 13:11:29 +00:00
Joel Selvaraj 82054410e2 call-list: allow getting call object by index 2021-08-02 13:11:29 +00:00
Teijo Kinnunen 0610267fa8 test,modem-helpers: add test case of AT+CPOL? response parsing 2021-08-02 12:42:13 +03:00
Teijo Kinnunen 948099bff0 modem-helpers: allow unquoted operator code in AT+CPOL? response
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/409
2021-08-02 12:39:38 +03:00
Loic Poulain b0248e471c kernel-device: generic: Support ATTR condition
Only the plural ATTRS form was checked but we also need to support
the single ATTR for matching device's attribute only.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-07-30 14:03:40 +00:00
Iñigo Martínez 7c4db66eb3 build: Rename template files
The template files in the `build-aux` directory used in enums sources
and headers generation use the `{$name}-template.[ch]` pattern.
However, the examples in the official guide[0] and usually GNOME and
Freedesktop packages use the `{$name}.[ch].template` pattern.

Due to this, the name of the template files and build commands have
been changed.

[0] https://developer.gnome.org/gobject/stable/glib-mkenums.html
2021-07-30 10:14:52 +00:00
Aleksander Morgado 15f53851c8 port-mbim: increase timeout of first command after port open
The port open operation may be happening very early after the device
has booted, so let's give the module some more time to reply the very
first MBIM query we do. The original 10s seems to be a bit tight in
some cases.

See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/405#note_1006746
2021-07-27 16:00:58 +02:00
Aleksander Morgado bcf11c0e50 port-qmi: open without data format explicitly if requested by user
Regardless of whether WDA is supported or not.
2021-07-27 00:39:29 +02:00
Aleksander Morgado ee0f473233 port-qmi: early check if WDA is supported
We should check if WDA is supported before running any other logic
that may change the state of the kernel or the modem. E.g. if we don't
do this as the first step, the loading of the supported kernel data
modes may end up changing the expected kernel data mode to raw-ip.
2021-07-27 00:39:29 +02:00
Aleksander Morgado ae09baf61b port-qmi: cleanly close device if an open operation failed
ModemManager[703345]: <debug> [1626962477.971869] [modem0] couldn't open QMI port with data format update: Unexpected kernel data mode: cannot setup using CTL
   ModemManager[703345]: <debug> [1626962477.972197] [cdc-wdm0/qmi] Opening QMI device...
   ModemManager[703345]: <debug> [1626962477.972310] [cdc-wdm0/qmi] Checking if QMI device already opening...
   ModemManager[703345]: <warn>  [1626962477.975182] [modem0] couldn't start initialization: QMI device open/close operation in progress
2021-07-27 00:39:29 +02:00
Aleksander Morgado 9be34affe2 port-qmi: support devices that only run in 802.3 mode
E.g. the ZTE MF190 has a very old QMI firmware that is not able to run
CTL Set Data Format (raw-ip).

   ModemManager[666366]: [/dev/cdc-wdm0] QMI Device supports 4 services:
   ModemManager[666366]: [/dev/cdc-wdm0]    ctl (1.2)
   ModemManager[666366]: [/dev/cdc-wdm0]    wds (1.3)
   ModemManager[666366]: [/dev/cdc-wdm0]    dms (1.2)
   ModemManager[666366]: [/dev/cdc-wdm0]    nas (1.0)
   ModemManager[666366]: [/dev/cdc-wdm0] Setting network port data format...
   ModemManager[666366]: [/dev/cdc-wdm0] Sent message...
   <<<<<< RAW:
   <<<<<<   length = 21
   <<<<<<   data   = 01:14:00:00:00:00:00:03:26:00:09:00:10:02:00:02:00:01:01:00:00
   ModemManager[666366]: [/dev/cdc-wdm0] Sent generic request (translated)...
   <<<<<< QMUX:
   <<<<<<   length  = 20
   <<<<<<   flags   = 0x00
   <<<<<<   service = "ctl"
   <<<<<<   client  = 0
   <<<<<< QMI:
   <<<<<<   flags       = "none"
   <<<<<<   transaction = 3
   <<<<<<   tlv_length  = 9
   <<<<<<   message     = "Set Data Format" (0x0026)
   <<<<<< TLV:
   <<<<<<   type       = "Protocol" (0x10)
   <<<<<<   length     = 2
   <<<<<<   value      = 02:00
   <<<<<<   translated = raw-ip
   <<<<<< TLV:
   <<<<<<   type       = "Format" (0x01)
   <<<<<<   length     = 1
   <<<<<<   value      = 00
   <<<<<<   translated = absent
   ModemManager[666366]: [/dev/cdc-wdm0] Received message...
   <<<<<< RAW:
   <<<<<<   length = 19
   <<<<<<   data   = 01:12:00:80:00:00:01:03:26:00:07:00:02:04:00:01:00:2D:00
   ModemManager[666366]: [/dev/cdc-wdm0] Received generic response (translated)...
   <<<<<< QMUX:
   <<<<<<   length  = 18
   <<<<<<   flags   = 0x80
   <<<<<<   service = "ctl"
   <<<<<<   client  = 0
   <<<<<< QMI:
   <<<<<<   flags       = "response"
   <<<<<<   transaction = 3
   <<<<<<   tlv_length  = 7
   <<<<<<   message     = "Set Data Format" (0x0026)
   <<<<<< TLV:
   <<<<<<   type       = "Result" (0x02)
   <<<<<<   length     = 4
   <<<<<<   value      = 01:00:2D:00
   <<<<<<   translated = FAILURE: InvalidDataFormat
   ModemManager[666366]: <debug> [1626961628.001354] [cdc-wdm0/qmi] QMI port open operation failed: QMI protocol error (45): 'InvalidDataFormat'
   ModemManager[666366]: <warn>  [1626961628.002563] [modem0] couldn't start initialization: QMI protocol error (45): 'InvalidDataFormat'
   ModemManager[666366]: <warn>  [1626961628.004181] [modem0] couldn't initialize: 'Modem is unusable, cannot fully initialize'
2021-07-27 00:39:29 +02:00
Aleksander Morgado 939cf166dd broadband-modem-qmi: remove trailing whitespaces 2021-07-27 00:37:53 +02:00
Loic Poulain 064624c69d bearer-mbim: Disable multiplex support for wwan devices
WWAN network devices expose link management over netlink (wwan type),
but it is not yet supported by libmbim.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-07-26 20:43:24 +00:00
Loic Poulain 2f38ea0155 kernel-device: Add get_wwandev_sysfs_path
The wwan subsystem is a new bus agnostic framework exposing wwan
device and its components (ports, netdev...). It can be useful to
get the wwan device a device belongs to

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-07-26 20:43:24 +00:00
Pavan Holla 97ab517348 mm-sim-mbim: Remove trailing F in ICCID
QMI modems remove trailing F in 19 digit ICCID. Do the same on
MBIM modems for consistency.
2021-07-26 09:25:09 +00:00
Joel Selvaraj 95f4a232ce port-qmi: open dpm port automatically in case of IPA net driver
Requires IPA kernel driver to expose the TX and RX endpoint IDs through sysfs.
Available from linux 5.14 onwards.
2021-07-21 20:40:42 +05:30
Joel Selvaraj 3b79f7379f base-modem: set net sysfs path
Required by MMPortQmi for fetching the TX and RX endpoint IDs
through sysfs from linux 5.14 onwards
2021-07-21 20:36:07 +05:30
Joel Selvaraj 43c9c47b04 port-qmi: allow MMPortQmi to get the net sysfs path
Will be set by base modem when organizing ports, similar to
net driver name. Required for fetching the TX and RX endpoint IDs
through sysfs from linux 5.14 onwards.
2021-07-21 20:35:33 +05:30
Aleksander Morgado 1d4caa929f broadband-modem-mbim: fix passing new slots array in the set operation 2021-07-14 15:14:18 +02:00
Aleksander Morgado 1830801f0f broadband-modem-mbim: slot index in MM starts at 1
When querying the slots using "Slot info status", the modem expects
the slot index passed in the [0,number_slots-1] range.

But for the ModemManager API, the slot indices start at 1; i.e. they
are in the [1,number_of_slots] range.

Consider that wen reporting the current slot index using MBIM.
2021-07-14 15:14:18 +02:00
ZhangMingjie 48261375d3 mm-broadband-modem-mbim: implement the set_primary_sim_slot() method for DSSA 2021-07-14 15:14:18 +02:00
ZhangMingjie b151740d15 mm-broadband-modem-mbim: implement the load_sim_slots() method for DSSA 2021-07-14 15:14:18 +02:00
Joel Selvaraj c750339d50 modem-qmi: disable call list check in case of QMI
Fixes AT load call list function messing up with the call list
in case of both AT+QMI is available for a given modem.
2021-07-14 08:42:29 +00:00
Aleksander Morgado 06682e2806 bearer-mbim: never update bearer properties sent by the user
We should never run any mm_bearer_properties_set_X() operations
ourselves for the properties received by the user, or otherwise the
logic comparing the bearers will fail and we may end up creating one
bearer per connection attempt.
2021-07-13 16:48:50 +02:00
Aleksander Morgado daf72fe169 base-bearer: setup common default for unknown multiplex fallback
If the user doesn't provide a specific multiplex setting, we'll
fallback to a predefined default.

For now, the default is REQUESTED.
2021-07-13 15:47:38 +02:00
Aleksander Morgado c4b5879e45 broadband-bearer: multiplexing is not supported in generic AT based bearer 2021-07-13 15:46:28 +02:00
Aleksander Morgado 3ffa6b8960 shared-qmi: fix use of uninitialized memory
==636642== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
    ==636642==    at 0x5282BAC: send (in /usr/lib/libpthread-2.33.so)
    ==636642==    by 0x4EF20AF: UnknownInlinedFun (gsocket.c:3426)
    ==636642==    by 0x4EF20AF: g_socket_send_with_blocking (gsocket.c:3529)
    ==636642==    by 0x4EDF176: g_output_stream_write (goutputstream.c:242)
    ==636642==    by 0x4EDF2D4: g_output_stream_write_all (goutputstream.c:301)
    ==636642==    by 0x4A5CDAC: endpoint_send (qmi-endpoint-qmux.c:409)
    ==636642==    by 0x4A5B963: qmi_endpoint_send (qmi-endpoint.c:225)
    ==636642==    by 0x4A55408: qmi_device_command_abortable (qmi-device.c:2897)
    ==636642==    by 0x4A554C3: qmi_device_command_full (qmi-device.c:2923)
    ==636642==    by 0x4B52664: qmi_client_nas_set_system_selection_preference (qmi-nas.c:61099)
    ==636642==    by 0x1F6FDC: register_in_network_sssp (mm-shared-qmi.c:455)
    ==636642==    by 0x1F71E6: mm_shared_qmi_3gpp_register_in_network (mm-shared-qmi.c:505)
    ==636642==    by 0x19FCF0: mm_iface_modem_3gpp_register_in_network (mm-iface-modem-3gpp.c:484)
    ==636642==  Address 0x880a3b3 is 19 bytes inside a block of size 32 alloc'd
    ==636642==    at 0x484383F: realloc (vg_replace_malloc.c:1192)
    ==636642==    by 0x50DC130: g_realloc (gmem.c:171)
    ==636642==    by 0x50A067C: g_array_maybe_expand (garray.c:1009)
    ==636642==    by 0x50A0A0C: UnknownInlinedFun (garray.c:520)
    ==636642==    by 0x50A0A0C: g_array_append_vals (garray.c:509)
    ==636642==    by 0x50A0A9E: g_byte_array_append (garray.c:2430)
    ==636642==    by 0x4A4B70D: qmi_message_tlv_write_guint8 (qmi-message.c:686)
    ==636642==    by 0x4B14CA8: __qmi_message_nas_set_system_selection_preference_request_create (qmi-nas.c:33477)
    ==636642==    by 0x4B525B6: qmi_client_nas_set_system_selection_preference (qmi-nas.c:61087)
    ==636642==    by 0x1F6FDC: register_in_network_sssp (mm-shared-qmi.c:455)
    ==636642==    by 0x1F71E6: mm_shared_qmi_3gpp_register_in_network (mm-shared-qmi.c:505)
    ==636642==    by 0x19FCF0: mm_iface_modem_3gpp_register_in_network (mm-iface-modem-3gpp.c:484)
    ==636642==    by 0x1B0BD4: check_next_registration (mm-iface-modem-simple.c:154)
2021-07-12 22:10:41 +02:00
Aleksander Morgado a61422761f iface-modem: ignore warning when trying to disconnect signal handler
The signal handler may have been already removed during dispose of the
modem object, which is run manually through g_object_run_dispose().

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/399
2021-07-12 21:51:24 +02:00
Aleksander Morgado b983deaa40 iface-modem: refactor new SIM slots array creation 2021-07-12 15:57:43 +02:00
Pavan Holla 503e886c02 shared-qmi,iface-modem : Do not reprobe on hotswap in inactive slot
Prior to this change, a hotswap on the inactive slot would result
in reprobe of the modem. With this change, the sim object would be
updated, but no reprobe will be performed. The advantage is
1) we do not drop connections on the active slot
2) Slot status on the inactive slot is susceptible to firmware bugs.
   We have seen scenarios where the inactive slot is reported as
   absent/ iccid={0}, followed by a correction. We should not
   reprobe the modem if our active slot hasn't changed.
2021-07-12 14:47:52 +02:00
Aleksander Morgado 5cc5bfbb97 broadband-modem-mbim: allow disabling the use of the Intel Firmware Update service
Not all manufacturers expect this service to be used for the simple
purpose of reseting the modem.

It works with Sierra Wireless devices (e.g. EM7345,
XMM7160_V1.1_MODEM_01.1349.12), but it doesn't work with Cinterion
devices (e.g. mPLS62-w, XMM7160_V1.1_MBIM_NAND_ADAPT_R).

So allow plugins to disable its use entirely.
2021-07-11 15:24:33 +02:00
Aleksander Morgado 17876994c4 utils: remove custom g_ptr_array_find_with_equal_func()
This was required when building with GLib < 2.54, but we now require
2.56 as minimum, so it is no longer needed.
2021-07-09 12:15:32 +00:00
Aleksander Morgado 63f3dcb2fe iface-modem: don't fail enabling if modem_power_up() isn't implemented
There are modems (e.g. Nokia, Thuraya, Iridium) which don't require or
don't support power management, and therefore there is no way to
either load or update the power status.

In those modems we just assume ON is the current and only value (set
in the skeleton during initialization) and so when we attempt to
update the power state to ON during enabling, the logic should not
break.

Fix the logic by making sure the requested_power_setup() function
pointers are only checked for validity after ensuring we're not
already in the desired power state.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/398
2021-07-09 10:45:09 +02:00
Joel Selvaraj ea645522fa modem-qmi: implement voice unsolicited events and process all_call_status indication 2021-07-08 12:48:59 +00:00
Joel Selvaraj a0ef2f403f modem-qmi: implement voice check support and create call functionality 2021-07-08 12:48:59 +00:00
Joel Selvaraj 630f96f4a4 call-qmi: implement call start, hangup and accept 2021-07-08 12:48:59 +00:00
Joel Selvaraj 788442c6d5 call-qmi: new `MMCallQmi' object 2021-07-08 12:48:59 +00:00
Michal Mazur 46c5cd8b72 mm-sim-mbim: Remove update of remaining attempts
Calling the mm_iface_modem_update_unlock_retries function directly from
pin_set_enter_ready caused a notification to be send too early with
invalid number of attempts to unlock on MBIM modems.
The mm_iface_modem_update_unlock_retries is already called for all
modems from send_pin_ready (mm-base-sim.c).
2021-07-06 08:49:10 +00:00
Aleksander Morgado 6364c9818c iface-modem-location: print 0-prefixed LAC/TAC/CID values in log
Each with its expected corresponding length.
2021-07-01 01:10:39 +02:00
Andrew Lassalle b0f40cf966 port-qmi: Increase the reference counter of the QrtrNode
Currently, we are not increasing the reference counter of the QrtrNode
when creating a PortQmi for a QRTR port, and we are clearing the object
when disposing the port.
2021-06-22 14:56:42 -07:00
Aleksander Morgado a357777d39 port-qmi: apply master MTU handling to all multiplexing types in qmi_wwan
If using rmnet and IP passthrough setting in qmi_wwan, also configure
the master interface with an MTU equal to the maximum data aggregation
size.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/367
2021-06-21 08:26:44 +00:00
Aleksander Morgado b100189f49 broadband-modem: plug memleak when listing profiles
==4263== 747 (72 direct, 675 indirect) bytes in 3 blocks are definitely lost in loss record 5,739 of 5,787
  ==4263==    at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==4263==    by 0x50C6DE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==4263==    by 0x50DDFF1: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==4263==    by 0x50B8EB9: g_list_prepend (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==4263==    by 0x27CE4C: mm_3gpp_parse_cgdcont_read_response (mm-modem-helpers.c:1845)
  ==4263==    by 0x1E5485: profile_manager_cgdcont_query_ready (mm-broadband-modem.c:10200)
  ==4263==    by 0x4ED54A1: g_simple_async_result_complete (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==4263==    by 0x18605E: at_command_ready (mm-base-modem-at.c:538)
  ==4263==    by 0x4ED54A1: g_simple_async_result_complete (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==4263==    by 0x25ADFA: serial_command_ready (mm-port-serial-at.c:393)
  ==4263==    by 0x4ED54A1: g_simple_async_result_complete (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==4263==    by 0x254752: command_context_complete_and_free (mm-port-serial.c:141)
2021-06-17 15:58:57 +02:00
Aleksander Morgado f9231bad34 base-manager: skip using g_warning() in process_initial_kernel_events()
Use mm_obj_warn() instead.
2021-06-16 11:59:51 +02:00
Aleksander Morgado 4cf12bb8bc helpers: skip g_warning() in mm_3gpp_parse_ws46_test_response()
Use mm_obj_warn() instead.
2021-06-16 11:59:51 +02:00