[PATCH] telit plugin: add modem_power_down

Carlo Lobrano c.lobrano at gmail.com
Thu Dec 3 08:39:24 PST 2015


Hi,

this patch add modem_power_down feature for telit plugin.

The change is quite simple, it sends +CFUN=4 to the modem in order to let
it go to low power state.

Best regards,
Carlo Lobrano

diff --git a/plugins/telit/mm-broadband-modem-telit.c
b/plugins/telit/mm-broadband-modem-telit.c
index 971e85e..f4fe03c 100644
--- a/plugins/telit/mm-broadband-modem-telit.c
+++ b/plugins/telit/mm-broadband-modem-telit.c
@@ -40,6 +40,30 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemTelit,
mm_broadband_modem_telit, MM_TYPE
                         G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP,
iface_modem_3gpp_init));

 /*****************************************************************************/
+/* Modem power down (Modem interface) */
+
+static gboolean
+modem_power_down_finish (MMIfaceModem *self,
+                         GAsyncResult *res,
+                         GError **error)
+{
+    return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res,
error);
+}
+
+static void
+modem_power_down (MMIfaceModem *self,
+                  GAsyncReadyCallback callback,
+                  gpointer user_data)
+{
+    mm_base_modem_at_command (MM_BASE_MODEM (self),
+                              "+CFUN=4",
+                              20,
+                              FALSE,
+                              callback,
+                              user_data);
+}
+
+/*****************************************************************************/
 /* Load access technologies (Modem interface) */

 static gboolean
@@ -289,6 +313,8 @@ mm_broadband_modem_telit_init (MMBroadbandModemTelit
*self)
 static void
 iface_modem_init (MMIfaceModem *iface)
 {
+    iface->modem_power_down = modem_power_down;
+    iface->modem_power_down_finish = modem_power_down_finish;
     iface->load_access_technologies = load_access_technologies;
     iface->load_access_technologies_finish =
load_access_technologies_finish;
     iface->setup_flow_control = setup_flow_control;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20151203/d5b3588e/attachment.html>


More information about the ModemManager-devel mailing list