Commit Graph

7792 Commits

Author SHA1 Message Date
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
Aleksander Morgado
9d31113edb build: bump libmbim requirement to support DSSA operations 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
5db3e330b9 hso: query profile id from hso bearer during connecting phase
As the profile id is not really set in the base bearer object until
after connected.
2021-07-14 00:23:49 +02:00
Aleksander Morgado
cadce18865 icera: fix segfault during connection reset logic
==252789== Process terminating with default action of signal 11 (SIGSEGV): dumping core
    ==252789==  Access not within mapped region at address 0x28
    ==252789==    at 0x7D17D22: connect_reset_ready (mm-broadband-bearer-icera.c:419)
    ==252789==    by 0x4EEC242: g_simple_async_result_complete (gsimpleasyncresult.c:802)
    ==252789==    by 0x17EFC6: at_command_ready (mm-base-modem-at.c:538)
    ==252789==    by 0x4EEC242: g_simple_async_result_complete (gsimpleasyncresult.c:802)
    ==252789==    by 0x259423: serial_command_ready (mm-port-serial-at.c:393)
    ==252789==    by 0x4EEC242: g_simple_async_result_complete (gsimpleasyncresult.c:802)
    ==252789==    by 0x252B9B: command_context_complete_and_free (mm-port-serial.c:141)
    ==252789==    by 0x254542: port_serial_got_response (mm-port-serial.c:755)
    ==252789==    by 0x254A78: parse_response_buffer (mm-port-serial.c:926)
    ==252789==    by 0x254FFE: common_input_available (mm-port-serial.c:1035)
    ==252789==    by 0x2550DE: iochannel_input_available (mm-port-serial.c:1058)
    ==252789==    by 0x50D3F84: UnknownInlinedFun (gmain.c:3344)
    ==252789==    by 0x50D3F84: g_main_context_dispatch (gmain.c:4062)
2021-07-14 00:23:49 +02:00
Aleksander Morgado
f72fe9577c icera: query profile id from icera bearer during connecting phase
As the profile id is not really set in the base bearer object until
after connected.
2021-07-14 00:23:49 +02:00
Aleksander Morgado
fc512c711f simtech: disable CPOL? checks in SIM7070
The whole device breaks when the CPOL? query is sent; happening
consistently all the time:

    <debug> [1626211395.825257] [modem4/ttyUSB3/at] --> 'AT+CPOL=,2<CR>'
    <debug> [1626211395.842156] [modem4/ttyUSB3/at] <-- '<CR><LF>OK<CR><LF>'
    <debug> [1626211395.843227] [modem4/sim4] loading preferred networks...
    <debug> [1626211395.845289] [modem4/ttyUSB3/at] --> 'AT+CPOL?<CR>'
    <debug> [1626211401.110974] [modem4/ttyUSB3/at] unexpected port hangup!
    <debug> [1626211401.111586] [modem4/ttyUSB3/at] forced to close port
    <debug> [1626211401.112331] [modem4/ttyUSB3/at] closing serial port...
    <debug> [1626211401.112771] [modem4/ttyUSB3/at] serial port closed

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/401
2021-07-14 00:23:49 +02: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
3e037dc158 plugins: AT/QCDM/GPS port type hints only applicable to TTY ports
There are modems out there, that reuse the same vid:pid for multiple
USB layouts, so there may be port type hints that are not really
applicable in all layouts.

E.g. the EM7565 in MBIM layout uses interface #0 for the MBIM port,
while in QMI layout it uses interface #0 for the QCDM port (which is
what the port type hint included in MM states). With these rules, if
we don't bind the port type hint to TTY ports only, we would be
wrongly flagging the MBIM port as possible QCDM port:

    <debug> [plugin/sierra] probes required for port cdc-wdm0: 'mbim'
    <debug> [cdc-wdm0/probe] no AT/QMI/MBIM probing in possible QCDM port
    <debug> [cdc-wdm0/probe] port is not AT-capable
    <debug> [cdc-wdm0/probe] port is not QMI-capable
    <debug> [cdc-wdm0/probe] port is not MBIM-capable
    <debug> [cdc-wdm0/probe] port probing finished: no more probings needed

Avoid this, by making sure all port type hints are added exclusively
to TTY ports. It's not a perfect solution, but it's enough for the
known cases.
2021-07-13 10:56:11 +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
4102cbc700 cinterion: ignore Intel Firmware Update service completely 2021-07-11 15:30:02 +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
dc09d3350c cinterion,shared: add missing interface prerequisites 2021-07-11 15:16:41 +02:00
Aleksander Morgado
b126e84b56 cinterion: implement custom shared reset operation
Implemented for all QMI, MBIM and AT based modems. The parent reset
operation always takes priority if available.
2021-07-10 17:20:41 +02:00
Aleksander Morgado
3dd3d6faf6 cinterion: new custom MBIM modem object 2021-07-10 17:04:00 +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
Benoît Monin
dc66ee2aaa libmm-glib,common-helpers: fix build with glib 2.56
The support of autoptr for GEnumClass and GFlagsClass was introduced in
glib 2.58. To keep compatibility with glib 2.56, declare the autoptr
cleanup functions.

Fixes #397
2021-07-09 10:07:52 +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
Stephan Gerhold
681d5d29d5 qcom-soc: Add support for WWAN subsystem instead of RPMSG
Recent Linux kernel versions have introduced a generic WWAN subsystem
that provides various char devices for QMI, AT etc, similar to the
subsystem-specific char devices for USB or RPMSG.

The RPMSG char device for Qualcomm SoCs (e.g. MSM8916/MSM8974)
are particularly complicated to work with because they need to be
explicitly created from userspace with rpmsgexport and don't show up
automatically.

However, it turns out it's fairly simple to wrap the RPMSG subsystem
in a simple driver for the WWAN subsystem. This has several advantages:

  - We can drop support for the special RPMSG char devices entirely
    at some point.
  - The WWAN char devices show up automatically, without having to export
    them explicitly, making ModemManager work out of the box on these devices.

For now, just support using the WWAN subsystem alternatively for the
qcom-soc plugin. Later we can consider dropping the old RPMSG code.
2021-07-08 13:41:47 +00: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
Alexander Dahl
266e98e020 ublox: Mark ubandsel as unsupported on SARA-R4 and -N4
See log from a SARA-R410M-02B-01 before the change:

    Feb 01 05:40:01 unit ModemManager[304]: <debug> [1612158001.012330] [modem0/ttymxc4/at] --> 'AT+UBANDSEL?<CR>'
    Feb 01 05:40:01 unit ModemManager[304]: <debug> [1612158001.026831] [modem0/ttymxc4/at] <-- '<CR><LF>ERROR<CR><LF>'
    Feb 01 05:40:01 unit ModemManager[304]: <debug> [1612158001.027113] [modem0/ttymxc4/at] operation failure: 100 (Unknown error)
    Feb 01 05:40:01 unit ModemManager[304]: <warn>  [1612158001.027298] [modem0] couldn't load current bands: Unknown error

Backed by SARA-R4 series AT commands manual, no reference to +UBANDSEL
in the manual at all.

Log after the change:

    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500845] [modem0] (u-blox) support configuration found for 'SARA-R410M-02B'
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500961] [modem0] (u-blox)   band update requires explicit unregistration
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.501052] [modem0] (u-blox)   UACT based band configuration unsupported
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.501141] [modem0] (u-blox)   UBANDSEL based band configuration unsupported

Fixes: 437fb830c8 ("ublox,helpers: assume all SARA/LARA devices require COPS")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
2021-07-07 17:20:23 +02:00
Alexander Dahl
7c9d1e45be ublox: Add more values to URAT combinations
The SARA-R410M-02B-01 only supports values 7 and 8, log excerpt:

    Feb 01 05:40:00 unit ModemManager[304]: <debug> [1612158000.826046] [modem0/ttymxc4/at] --> 'AT+URAT=?<CR>'
    Feb 01 05:40:00 unit ModemManager[304]: <debug> [1612158000.833596] [modem0/ttymxc4/at] <-- '<CR><LF>+URAT: (7-8),(7-8)(7-8)<CR><LF><CR><LF>OK<CR><LF>'
    Feb 01 05:40:00 unit ModemManager[304]: <warn>  [1612158000.833992] [modem0] (u-blox) unexpected AcT value: 7
    Feb 01 05:40:00 unit ModemManager[304]: <warn>  [1612158000.834096] [modem0] (u-blox) unexpected AcT value: 8
    Feb 01 05:40:00 unit ModemManager[304]: <warn>  [1612158000.834193] [modem0] couldn't load supported modes: No combinations built from +URAT=? response

The SARA-R4 series AT commands manual (and also the SARA-R5 AT commands
manual) lists them like this:

- 7: LTE Cat M1
- 8: LTE Cat NB1

After the change, log looks like this:

    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.490627] [modem0/ttymxc4/at] --> 'AT+URAT?<CR>'
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.499994] [modem0/ttymxc4/at] <-- '<CR><LF>+URAT: 7,8<CR><LF><CR><LF>OK<CR><LF>'
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500433] [modem0] (u-blox) current allowed modes retrieved: 4g
    Feb 01 06:58:25 unit ModemManager[329]: <debug> [1612162705.500561] [modem0] (u-blox) current preferred modes retrieved: 4g

Signed-off-by: Alexander Dahl <ada@thorsis.com>
2021-07-07 17:18:56 +02:00
Nicholas Smith
052eb267c8 docs: add --output-json documentation
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-07-06 15:27: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
bf9005df07 api,location: update TAC documentation to allow 3-byte values in 5GNR 2021-07-03 22:49:01 +02:00
Aleksander Morgado
132fc268b8 libmm-glib,call: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
19b3a55230 libmm-glib,bearer: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
5012c1a3f3 libmm-glib,modem-signal: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
b8e939ceac libmm-glib,modem-location: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
6372d97e87 libmm-glib,modem-firmware: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
1ecbc5e025 libmm-glib,modem-time: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
f72a6377f3 libmm-glib,modem-oma: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
434d7be3f2 libmm-glib,modem-messaging: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
ccefbbc0c6 libmm-glib,modem-3gpp: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
d7acc276e5 libmm-glib,modem: use helper macros to manage the monitored properties 2021-07-01 23:38:04 +02:00
Aleksander Morgado
22396a7d1d libmm-glib,helpers: new helper macros to define common property management 2021-07-01 23:38:04 +02:00
Aleksander Morgado
afc7e5f902 libmm-glib: use single mutex in each type to sync access
There is truly no need for a per-property mutex, using a global one
for the whole object is equally fine.
2021-07-01 15:18:44 +02:00
Aleksander Morgado
30c9fc65da libmm-glib,common-helpers: refactor helper methods
Remove unused methods, like all the variant_to_array() ones, and
reorder some others so that both header and source file have the same
order always.
2021-07-01 15:18:44 +02:00
Aleksander Morgado
c9ca1ab97b cli,location: new '--location-monitor' action
This action allows us to monitor location updates as signaled via the
'Location' property, only available if location signaling has been
explicitly enabled (e.g. with --location-set-enable-signal)
2021-07-01 01:10:39 +02: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
Aleksander Morgado
b385fc20b0 cli,location: TAC is 3 bytes in 5GNR
TAC is 3 bytes for NG-RAN as specified in 3GPP TS 38.413 clause
9.3.3.10 and in 3GPP TS 24.501 clause 9.10.3.8.

We'll always print it as 3 bytes in the cli output, as that's also
backwards compatible with the original 2 byte TAC in LTE.
2021-07-01 01:10:39 +02:00