modem: new property to allow specifying longer timeouts when configuring IP

This IpTimeout property will be read by NetworkManager, and used as the time to
wait for pppd to establish the IP configuration.
This commit is contained in:
Aleksander Morgado
2011-06-09 17:45:33 +02:00
parent e6d085246f
commit 920fefa8e2
4 changed files with 30 additions and 1 deletions

View File

@@ -195,6 +195,12 @@
</tp:docstring> </tp:docstring>
</property> </property>
<property name="IpTimeout" type="u" access="read">
<tp:docstring>
Maximum time to wait for a successful IP establishment, when PPP is used.
</tp:docstring>
</property>
<!-- Enabled should be folded into this. --> <!-- Enabled should be folded into this. -->
<property name="State" type="u" access="read" tp:type="MM_MODEM_STATE"> <property name="State" type="u" access="read" tp:type="MM_MODEM_STATE">
<tp:docstring> <tp:docstring>

View File

@@ -60,6 +60,7 @@ typedef struct {
guint32 unlock_retries; guint32 unlock_retries;
GArray *pin_retry_counts; GArray *pin_retry_counts;
guint32 ip_method; guint32 ip_method;
guint32 ip_timeout;
gboolean valid; gboolean valid;
MMModemState state; MMModemState state;
@@ -925,6 +926,9 @@ set_property (GObject *object, guint prop_id,
case MM_MODEM_PROP_IP_METHOD: case MM_MODEM_PROP_IP_METHOD:
priv->ip_method = g_value_get_uint (value); priv->ip_method = g_value_get_uint (value);
break; break;
case MM_MODEM_PROP_IP_TIMEOUT:
priv->ip_timeout = g_value_get_uint (value);
break;
case MM_MODEM_PROP_VALID: case MM_MODEM_PROP_VALID:
case MM_MODEM_PROP_TYPE: case MM_MODEM_PROP_TYPE:
case MM_MODEM_PROP_ENABLED: case MM_MODEM_PROP_ENABLED:
@@ -997,6 +1001,9 @@ get_property (GObject *object, guint prop_id,
case MM_MODEM_PROP_IP_METHOD: case MM_MODEM_PROP_IP_METHOD:
g_value_set_uint (value, priv->ip_method); g_value_set_uint (value, priv->ip_method);
break; break;
case MM_MODEM_PROP_IP_TIMEOUT:
g_value_set_uint (value, priv->ip_timeout);
break;
case MM_MODEM_PROP_VALID: case MM_MODEM_PROP_VALID:
g_value_set_boolean (value, priv->valid); g_value_set_boolean (value, priv->valid);
break; break;
@@ -1105,6 +1112,10 @@ mm_modem_base_class_init (MMModemBaseClass *klass)
MM_MODEM_PROP_IP_METHOD, MM_MODEM_PROP_IP_METHOD,
MM_MODEM_IP_METHOD); MM_MODEM_IP_METHOD);
g_object_class_override_property (object_class,
MM_MODEM_PROP_IP_TIMEOUT,
MM_MODEM_IP_TIMEOUT);
g_object_class_override_property (object_class, g_object_class_override_property (object_class,
MM_MODEM_PROP_VALID, MM_MODEM_PROP_VALID,
MM_MODEM_VALID); MM_MODEM_VALID);

View File

@@ -860,6 +860,16 @@ mm_modem_init (gpointer g_iface)
MM_MODEM_IP_METHOD_PPP, MM_MODEM_IP_METHOD_PPP,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_uint (MM_MODEM_IP_TIMEOUT,
"IP timeout",
"Maximum time to wait for a successful IP establishment, "
"when PPP is used. Modems with special needs will set this "
"property to a value greater than 0",
0, G_MAXUINT32, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_interface_install_property g_object_interface_install_property
(g_iface, (g_iface,
g_param_spec_boolean (MM_MODEM_VALID, g_param_spec_boolean (MM_MODEM_VALID,

View File

@@ -38,6 +38,7 @@
#define MM_MODEM_DRIVER "driver" #define MM_MODEM_DRIVER "driver"
#define MM_MODEM_TYPE "type" #define MM_MODEM_TYPE "type"
#define MM_MODEM_IP_METHOD "ip-method" #define MM_MODEM_IP_METHOD "ip-method"
#define MM_MODEM_IP_TIMEOUT "ip-timeout"
#define MM_MODEM_ENABLED "enabled" #define MM_MODEM_ENABLED "enabled"
#define MM_MODEM_EQUIPMENT_IDENTIFIER "equipment-identifier" #define MM_MODEM_EQUIPMENT_IDENTIFIER "equipment-identifier"
#define MM_MODEM_DEVICE_IDENTIFIER "device-identifier" #define MM_MODEM_DEVICE_IDENTIFIER "device-identifier"
@@ -71,7 +72,8 @@ typedef enum {
MM_MODEM_PROP_DEVICE_IDENTIFIER, MM_MODEM_PROP_DEVICE_IDENTIFIER,
MM_MODEM_PROP_HW_VID, /* Not exported */ MM_MODEM_PROP_HW_VID, /* Not exported */
MM_MODEM_PROP_HW_PID, /* Not exported */ MM_MODEM_PROP_HW_PID, /* Not exported */
MM_MODEM_PROP_NETWORK_TIMEZONE MM_MODEM_PROP_NETWORK_TIMEZONE,
MM_MODEM_PROP_IP_TIMEOUT
} MMModemProp; } MMModemProp;
typedef struct _MMModem MMModem; typedef struct _MMModem MMModem;