ModemManager: Allow plugins to configure DTE-DCE flow control command (AT+IFC)
- From: Aleksander Morgado <aleksander lanedo com>
- To: "Network Manager (Devel)" <networkmanager-list gnome org>
- Subject: ModemManager: Allow plugins to configure DTE-DCE flow control command (AT+IFC)
- Date: Fri, 01 Apr 2011 09:55:03 +0200
Hi all,
The attached patch sets up a new property in the Generic-GSM modem to
identify the command to be used to configure the flow control between
the PC and the modem.
Once enabled, a GSM plugin may then override the new
MM_GENERIC_GSM_FLOW_CONTROL_CMD property and configure its own value,
for example:
mm_modem_whatever_gsm_class_init ()
{
g_object_class_override_property (
object_class,
MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD,
MM_GENERIC_GSM_FLOW_CONTROL_CMD);
}
get_property ()
{
...
case MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD:
/* Enable RTS/CTS flow control */
g_value_set_string (value, "+IFC=2,2");
break;
...
}
Cheers,
--
Aleksander
>From 0091d624bbe0edc5056e7b523df148acf233a6e6 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander lanedo com>
Date: Thu, 31 Mar 2011 10:39:43 +0200
Subject: [PATCH] generic-gsm: make flow control setup command a property
---
src/mm-generic-gsm.c | 21 +++++++++++++++++++--
src/mm-generic-gsm.h | 2 ++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index 98713b0..b3452b8 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -1352,6 +1352,7 @@ mm_generic_gsm_enable_complete (MMGenericGsm *self,
MMCallbackInfo *info)
{
MMGenericGsmPrivate *priv;
+ gchar *cmd = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (MM_IS_GENERIC_GSM (self));
@@ -1377,8 +1378,11 @@ mm_generic_gsm_enable_complete (MMGenericGsm *self,
}
}
- /* Try to enable XON/XOFF flow control */
- mm_at_serial_port_queue_command (priv->primary, "+IFC=1,1", 3, NULL, NULL);
+ /* Try to enable flow control */
+ g_object_get (G_OBJECT (info->modem), MM_GENERIC_GSM_FLOW_CONTROL_CMD, &cmd, NULL);
+ if (cmd && strlen (cmd))
+ mm_at_serial_port_queue_command (priv->primary, cmd, 3, NULL, NULL);
+ g_free (cmd);
mm_at_serial_port_queue_command (priv->primary, "+CIND=?", 3, cind_cb, self);
@@ -4825,6 +4829,7 @@ set_property (GObject *object, guint prop_id,
case MM_GENERIC_GSM_PROP_USSD_STATE:
case MM_GENERIC_GSM_PROP_USSD_NETWORK_REQUEST:
case MM_GENERIC_GSM_PROP_USSD_NETWORK_NOTIFICATION:
+ case MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD:
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -4932,6 +4937,10 @@ get_property (GObject *object, guint prop_id,
case MM_GENERIC_GSM_PROP_USSD_NETWORK_NOTIFICATION:
g_value_set_string (value, "");
break;
+ case MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD:
+ /* By default, try to set XOFF/XON flow control */
+ g_value_set_string (value, "+IFC=1,1");
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -5075,5 +5084,13 @@ mm_generic_gsm_class_init (MMGenericGsmClass *klass)
"Optional initialization command (errors ignored)",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property
+ (object_class, MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD,
+ g_param_spec_string (MM_GENERIC_GSM_FLOW_CONTROL_CMD,
+ "FlowControlCommand",
+ "Flow control configuration command (errors ignored)",
+ "+IFC=1,1",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
diff --git a/src/mm-generic-gsm.h b/src/mm-generic-gsm.h
index 5712660..c6cb7fb 100644
--- a/src/mm-generic-gsm.h
+++ b/src/mm-generic-gsm.h
@@ -37,6 +37,7 @@
#define MM_GENERIC_GSM_POWER_DOWN_CMD "power-down-cmd"
#define MM_GENERIC_GSM_INIT_CMD "init-cmd"
#define MM_GENERIC_GSM_INIT_CMD_OPTIONAL "init-cmd-optional"
+#define MM_GENERIC_GSM_FLOW_CONTROL_CMD "flow-control-cmd"
typedef enum {
MM_GENERIC_GSM_PROP_FIRST = 0x2000,
@@ -57,6 +58,7 @@ typedef enum {
MM_GENERIC_GSM_PROP_USSD_STATE,
MM_GENERIC_GSM_PROP_USSD_NETWORK_REQUEST,
MM_GENERIC_GSM_PROP_USSD_NETWORK_NOTIFICATION,
+ MM_GENERIC_GSM_PROP_FLOW_CONTROL_CMD
} MMGenericGsmProp;
typedef enum {
--
1.7.1
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]