[PATCH 2/2] Add custom flow control settings for Telit HE910, UE910, UL865

Daniele Palmas dnlplm at gmail.com
Thu Mar 12 01:15:38 PDT 2015


Telit HE910, UE910 and UL865 do not support XON/XOFF; defaulting
to RTS/CTS
---
 plugins/telit/mm-broadband-modem-telit.c | 40 ++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c
index 5e1dbff..d7ad9f2 100644
--- a/plugins/telit/mm-broadband-modem-telit.c
+++ b/plugins/telit/mm-broadband-modem-telit.c
@@ -175,6 +175,44 @@ load_access_technologies (MMIfaceModem *self,
 }
 
 /*****************************************************************************/
+/* Flow control (Modem interface) */
+
+static gboolean
+setup_flow_control_finish (MMIfaceModem *self,
+                           GAsyncResult *res,
+                           GError **error)
+{
+    /* Completely ignore errors */
+    return TRUE;
+}
+
+static void
+setup_flow_control (MMIfaceModem *self,
+                    GAsyncReadyCallback callback,
+                    gpointer user_data)
+{
+    gchar *cmd;
+    guint flow_control = 1; /* Default flow control: XON/XOFF */
+
+    switch (mm_base_modem_get_product_id (MM_BASE_MODEM (self)) & 0xFFFF) {
+    case 0x0021:
+        flow_control = 2; /* Telit IMC modems support only RTS/CTS mode */
+        break;
+    default:
+        break;
+    }
+
+    cmd = g_strdup_printf ("+IFC=%u,%u", flow_control, flow_control);
+    mm_base_modem_at_command (MM_BASE_MODEM (self),
+                              cmd,
+                              3,
+                              FALSE,
+                              callback,
+                              user_data);
+    g_free (cmd);
+}
+
+/*****************************************************************************/
 
 MMBroadbandModemTelit *
 mm_broadband_modem_telit_new (const gchar *device,
@@ -202,6 +240,8 @@ iface_modem_init (MMIfaceModem *iface)
 {
     iface->load_access_technologies = load_access_technologies;
     iface->load_access_technologies_finish = load_access_technologies_finish;
+    iface->setup_flow_control = setup_flow_control;
+    iface->setup_flow_control_finish = setup_flow_control_finish;
 }
 
 static void
-- 
1.9.1



More information about the ModemManager-devel mailing list