The Netgear AC341U seems to delay reporting packet service status
indications or actually not even send them. This leaves us with modems
in connected state in ModemManager but actually disconnected. We can
detect this situation by actively polling ourselves the connection
status.
See e.g. this case where the indication is received 2.5 mins after the
first OutOfCall error detected when loading statistics.
Aug 30 22:52:50 ModemManager[574]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
Aug 30 22:52:50 ModemManager[574]: <info> Simple connect state (8/8): All done
Aug 30 22:52:50 ModemManager[574]: <warn> Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
Aug 30 22:53:20 ModemManager[574]: <warn> Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
Aug 30 22:53:50 ModemManager[574]: <warn> Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
Aug 30 22:54:20 ModemManager[574]: <warn> Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
Aug 30 22:56:21 ModemManager[574]: <info> bearer call end reason (2): 'generic-client-end'
Aug 30 22:56:21 ModemManager[574]: <info> bearer verbose call end reason (3,2000): [cm] client-end
Aug 30 22:56:21 ModemManager[574]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> registered)
This update makes it possible to request connection status polling for
QMI modems via the ID_MM_QMI_CONNECTION_STATUS_POLLING_ENABLE tag.
If not given, the connection status polling will be disabled by
default, and the QMI modem will rely on WDS indications only.
The modem object is being explicitly referenced and stored in the
Context, but then never unref-ed, completely leaking a modem reference
forever.
Fixes: 4df5458847
==24602== 288 bytes in 4 blocks are definitely lost in loss record 4,693 of 4,860
==24602== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24602== by 0x67292F9: g_malloc (in /usr/lib/libglib-2.0.so.0.5400.0)
==24602== by 0x670A706: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.5400.0)
==24602== by 0x670B849: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.5400.0)
==24602== by 0x53D3A24: __qmi_message_dms_get_stored_image_info_response_parse (qmi-dms.c:22779)
==24602== by 0x53E5C61: get_stored_image_info_ready (qmi-dms.c:32287)
==24602== by 0x6134908: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.5400.0)
==24602== by 0x613499E: ??? (in /usr/lib/libgio-2.0.so.0.5400.0)
==24602== by 0x67180BD: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.5400.0)
==24602== by 0x6719F68: ??? (in /usr/lib/libglib-2.0.so.0.5400.0)
==24602== by 0x671AF41: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.5400.0)
==24602== by 0x14477B: main (main.c:180)
This patch fixes the following compiler warning issued by clang:
mm-sms-part-cdma.c:301:46: mcomparison 'guint8' (aka 'unsigned char') <= 255 is always true
[-Werror,-Wtautological-constant-compare]
This allows us to reprobe the modem and respawn the
qmi-proxy in case it dies on us. This gets us access
to the modem and unsolicited notifications again. Do
this by connecting to the device-removed signal on
QmiDevice.
---
Rebased on top of git master by
Aleksander Morgado <aleksander@aleksander.es>
Instead of assuming that NULL is a valid return, make sure we return
an error instead.
This also makes it sure that if the GTask gets cancelled, the result
we set is always a valid GObject, so that the g_object_unref passed as
GDestroyNotify can be safely called always. Not a big deal anyway, as
the GTask cannot be currently cancelled.
When load_supported_storages() doesn't run the parent implementation,
the GTask is always successful. Make it explicit, in case the logic
changes in the future.
==15673== 240 (40 direct, 200 indirect) bytes in 1 blocks are definitely lost in loss record 4,341 of 4,535
==15673== at 0x647F014: g_type_create_instance (in /usr/lib/libgobject-2.0.so.0.5200.3)
==15673== by 0x6460027: ??? (in /usr/lib/libgobject-2.0.so.0.5200.3)
==15673== by 0x6461A54: g_object_newv (in /usr/lib/libgobject-2.0.so.0.5200.3)
==15673== by 0x6462213: g_object_new (in /usr/lib/libgobject-2.0.so.0.5200.3)
==15673== by 0x4E97C33: mm_unlock_retries_new (mm-unlock-retries.c:217)
==15673== by 0x4E97A6F: mm_unlock_retries_new_from_dictionary (mm-unlock-retries.c:171)
==15673== by 0x170B09: mm_iface_modem_get_unlock_retries (mm-iface-modem.c:2942)
==15673== by 0x1DB0A4: pin_query_unlock_retries_ready (mm-broadband-modem-mbim.c:782)
==15673== by 0x613AD52: ??? (in /usr/lib/libgio-2.0.so.0.5200.3)
==15673== by 0x613B775: ??? (in /usr/lib/libgio-2.0.so.0.5200.3)
==15673== by 0x57D525D: transaction_task_complete_and_free (mbim-device.c:246)
==15673== by 0x57D6086: process_message (mbim-device.c:666)
The mm_base_modem_find_ports() method builds a list of full
references, so we need to unref them in the peek() methods.
==10047== 14,959 (24 direct, 14,935 indirect) bytes in 1 blocks are definitely lost in loss record 5,470 of 5,473
==10047== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10047== by 0x66E3028: g_malloc (in /usr/lib/libglib-2.0.so.0.5200.3)
==10047== by 0x66FAB25: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.5200.3)
==10047== by 0x66D9A33: g_list_append (in /usr/lib/libglib-2.0.so.0.5200.3)
==10047== by 0x15F6A7: mm_base_modem_find_ports (mm-base-modem.c:845)
==10047== by 0x15E9F3: mm_base_modem_peek_port_qmi_for_data (mm-base-modem.c:579)
==10047== by 0x15E8FC: mm_base_modem_get_port_qmi_for_data (mm-base-modem.c:555)
==10047== by 0x1BB99F: _connect (mm-bearer-qmi.c:1391)
==10047== by 0x1540B4: mm_base_bearer_connect (mm-base-bearer.c:841)
==10047== by 0x181F4F: connection_step (mm-iface-modem-simple.c:597)
==10047== by 0x181321: create_bearer_ready (mm-iface-modem-simple.c:258)
==10047== by 0x612FD52: ??? (in /usr/lib/libgio-2.0.so.0.5200.3)