From 47f39c9e1a9f37758027dd5072caafe224351089 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 1 Dec 2020 22:55:56 +0100 Subject: [PATCH] broadband-modem-qmi: fix disabling of signal strength events Attempting to disable the signal strength events was failing because the protocol handler expects a valid set of thresholds also during the disabling. So, just pass always the thresholds. ModemManager[274522]: [/dev/cdc-wdm1] sent generic request (translated)... <<<<<< QMUX: <<<<<< length = 17 <<<<<< flags = 0x00 <<<<<< service = "nas" <<<<<< client = 3 <<<<<< QMI: <<<<<< flags = "none" <<<<<< transaction = 7 <<<<<< tlv_length = 5 <<<<<< message = "Set Event Report" (0x0002) <<<<<< TLV: <<<<<< type = "Signal Strength Indicator" (0x10) <<<<<< length = 2 <<<<<< value = 00:00 <<<<<< translated = [ report = 'no' thresholds = '{}' ] ModemManager[274522]: [/dev/cdc-wdm1] received generic response (translated)... <<<<<< QMUX: <<<<<< length = 19 <<<<<< flags = 0x80 <<<<<< service = "nas" <<<<<< client = 3 <<<<<< QMI: <<<<<< flags = "response" <<<<<< transaction = 7 <<<<<< tlv_length = 7 <<<<<< message = "Set Event Report" (0x0002) <<<<<< TLV: <<<<<< type = "Result" (0x02) <<<<<< length = 4 <<<<<< value = 01:00:08:00 <<<<<< translated = FAILURE: NoThresholdsProvided --- src/mm-broadband-modem-qmi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index cabbb5ae..a6442a99 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -4805,11 +4805,10 @@ common_enable_disable_unsolicited_events_signal_strength (GTask *task) ctx = g_task_get_task_data (task); - /* Only set thresholds during enable, but always create the array anyway, - * as the TLV setter expects it */ + /* Always set thresholds, both in enable and disable, or otherwise the protocol will + * complain with FAILURE: NoThresholdsProvided */ thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data)); - if (ctx->enable) - g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data)); + g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data)); input = qmi_message_nas_set_event_report_input_new (); qmi_message_nas_set_event_report_input_set_signal_strength_indicator (