Merge ~kzapalowicz/snappy-hwe-snaps/+git/modem-manager:feature/add-reset into ~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager:modem-manager/1.8.0

Proposed by Konrad Zapałowicz
Status: Merged
Approved by: Alfonso Sanchez-Beato
Approved revision: 58a78b4bfa40b52245d62661c46cc706e6b1ee33
Merged at revision: d5d2895c7eab7d4bf64d49187cde0032ebdd078c
Proposed branch: ~kzapalowicz/snappy-hwe-snaps/+git/modem-manager:feature/add-reset
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager:modem-manager/1.8.0
Diff against target: 44 lines (+26/-0)
1 file modified
plugins/cinterion/mm-broadband-modem-cinterion.c (+26/-0)
Reviewer Review Type Date Requested Status
Alfonso Sanchez-Beato continuous-integration Approve
Review via email: mp+438423@code.launchpad.net

Commit message

cinterion: implement reset

Description of the change

This is a cherry-pick of a modem reset functionality implemented in the upstream Modem Manager project.

The reason I am proposing it is that we need to reset the modem and currently there is no other way than sending the AT command manually.

We had been doing this by:
) opening a separate AT port and using it to send modem reset AT command, however the modem is not reacting very well to the AT commands sent behind modem-manager's back.

The alternative solutions exist but are either not suitable in most of the cases, o overly complex:
) rebooting the gateway - it is not a suitable solution in majority of the cases.
) powering the modem off completely - afterwards it is a non-trivial to get it back online because when it is powered-off it disappears from DBus and must be booted via low-level GPIO.

In order to improve the experience here is the very small yet substantial change - implementation of the modem reset over DBus.

To post a comment you must log in.
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

LGTM, thanks

review: Approve
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) :
review: Approve (continuous-integration)
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

Thank you for a quick review

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plugins/cinterion/mm-broadband-modem-cinterion.c b/plugins/cinterion/mm-broadband-modem-cinterion.c
2index fe4cdb1..58cfbb7 100644
3--- a/plugins/cinterion/mm-broadband-modem-cinterion.c
4+++ b/plugins/cinterion/mm-broadband-modem-cinterion.c
5@@ -289,6 +289,30 @@ messaging_check_support (MMIfaceModemMessaging *self,
6 }
7
8 /*****************************************************************************/
9+/* Reset (Modem interface) */
10+
11+static gboolean
12+modem_reset_finish (MMIfaceModem *self,
13+ GAsyncResult *res,
14+ GError **error)
15+{
16+ return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
17+}
18+
19+static void
20+modem_reset (MMIfaceModem *self,
21+ GAsyncReadyCallback callback,
22+ gpointer user_data)
23+{
24+ mm_base_modem_at_command (MM_BASE_MODEM (self),
25+ "+CFUN=1,1",
26+ 3,
27+ FALSE,
28+ callback,
29+ user_data);
30+}
31+
32+/*****************************************************************************/
33 /* Power down */
34
35 static gboolean
36@@ -1921,6 +1945,8 @@ iface_modem_init (MMIfaceModem *iface)
37 iface->modem_after_sim_unlock_finish = after_sim_unlock_finish;
38 iface->load_unlock_retries = load_unlock_retries;
39 iface->load_unlock_retries_finish = load_unlock_retries_finish;
40+ iface->reset = modem_reset;
41+ iface->reset_finish = modem_reset_finish;
42 iface->modem_power_down = modem_power_down;
43 iface->modem_power_down_finish = modem_power_down_finish;
44 iface->modem_power_off = modem_power_off;

Subscribers

People subscribed via source and target branches