[PATCH 7/7] time: Implement in icera

2012-01-20 Thread Thomas Tuttle
Signed-off-by: Thomas Tuttle 
---
 plugins/mm-modem-icera.c   |   95 
 plugins/mm-modem-icera.h   |   21 +
 plugins/mm-modem-samsung-gsm.c |   54 ++-
 3 files changed, 169 insertions(+), 1 deletions(-)

diff --git a/plugins/mm-modem-icera.c b/plugins/mm-modem-icera.c
index 8933142..c86dc49 100644
--- a/plugins/mm-modem-icera.c
+++ b/plugins/mm-modem-icera.c
@@ -729,6 +729,101 @@ mm_modem_icera_get_ip4_config (MMModemIcera *self,
 g_free (command);
 }
 
+static void
+invoke_mm_modem_icera_timestamp_fn (MMCallbackInfo *info)
+{
+MMModemIceraTimestampFn callback;
+MMModemIceraTimestamp *timestamp;
+
+callback = (MMModemIceraTimestampFn) info->callback;
+timestamp = (MMModemIceraTimestamp *) mm_callback_info_get_result (info);
+
+callback (MM_MODEM_ICERA (info->modem),
+  timestamp,
+  info->error, info->user_data);
+}
+
+static MMCallbackInfo *
+mm_callback_info_icera_timestamp_new (MMModemIcera *modem,
+  MMModemIceraTimestampFn callback,
+  gpointer user_data)
+{
+g_return_val_if_fail (modem != NULL, NULL);
+
+return mm_callback_info_new_full (MM_MODEM (modem),
+  invoke_mm_modem_icera_timestamp_fn,
+ (GCallback) callback,
+ user_data);
+}
+
+static void
+get_local_timestamp_done (MMAtSerialPort *port,
+  GString *response,
+  GError *error,
+  gpointer user_data)
+{
+MMCallbackInfo *info = (MMCallbackInfo *) user_data;
+MMModemIceraTimestamp *timestamp;
+char sign;
+int offset;
+
+/* If the modem has already been removed, return without
+ * scheduling callback */
+if (mm_callback_info_check_modem_removed (info))
+return;
+
+if (error) {
+info->error = g_error_copy (error);
+goto out;
+}
+
+timestamp = g_malloc0 (sizeof (MMModemIceraTimestamp));
+mm_callback_info_set_result (info, timestamp, g_free);
+if (!timestamp) {
+mm_warn ("failed to allocate timestamp");
+goto out;
+}
+
+if (g_str_has_prefix (response->str, "*TLTS: ") &&
+sscanf (response->str + 7,
+"\"%02d/%02d/%02d,%02d:%02d:%02d%c%02d\"",
+×tamp->year,
+×tamp->month,
+×tamp->day,
+×tamp->hour,
+×tamp->minute,
+×tamp->second,
+&sign, &offset) == 8) {
+if (sign == '-')
+timestamp->tz_offset = -offset;
+else
+timestamp->tz_offset = offset;
+} else {
+mm_warn ("Unknown *TLTS response: %s", response->str);
+mm_callback_info_set_result (info, NULL, g_free);
+g_free (timestamp);
+}
+
+ out:
+mm_callback_info_schedule (info);
+}
+
+void
+mm_modem_icera_get_local_timestamp (MMModemIcera *self,
+MMModemIceraTimestampFn callback,
+gpointer user_data)
+{
+MMCallbackInfo *info;
+MMAtSerialPort *primary;
+
+info = mm_callback_info_icera_timestamp_new (self, callback, user_data);
+
+primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM (self), 
MM_PORT_TYPE_PRIMARY);
+g_assert (primary);
+
+mm_at_serial_port_queue_command (primary, "*TLTS", 3, 
get_local_timestamp_done, info);
+}
+
 //
 
 static const char *
diff --git a/plugins/mm-modem-icera.h b/plugins/mm-modem-icera.h
index 77ff200..131580c 100644
--- a/plugins/mm-modem-icera.h
+++ b/plugins/mm-modem-icera.h
@@ -43,6 +43,23 @@ struct _MMModemIcera {
 MMModemIceraPrivate * (*get_private) (MMModemIcera *icera);
 };
 
+typedef struct _MMModemIceraTimestamp MMModemIceraTimestamp;
+
+struct _MMModemIceraTimestamp {
+int year;
+int month;
+int day;
+int hour;
+int minute;
+int second;
+int tz_offset;
+};
+
+typedef void (*MMModemIceraTimestampFn) (MMModemIcera *modem,
+ MMModemIceraTimestamp *timestamp,
+ GError *error,
+ gpointer user_data);
+
 GType mm_modem_icera_get_type (void);
 
 MMModemIceraPrivate *mm_modem_icera_init_private (void);
@@ -89,5 +106,9 @@ void mm_modem_icera_get_ip4_config (MMModemIcera *self,
 MMModemIp4Fn callback,
 gpointer user_data);
 
+void mm_modem_icera_get_local_timestamp (MMModemIcera *self,
+ MMModemIceraTimestampFn callback,
+ gpointer user_data);
+
 #endif  /* MM_MODEM_ICERA_H */
 
diff --git a/plugins/mm-modem-samsung-gsm.c b/plugins/mm-modem-sam

[PATCH 6/7] time: Poll for timezone

2012-01-20 Thread Thomas Tuttle
Signed-off-by: Thomas Tuttle 
---
 src/mm-modem-base.c |   88 +++
 src/mm-modem-base.h |3 ++
 src/mm-modem-time.c |   15 +
 src/mm-modem-time.h |8 +
 4 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/src/mm-modem-base.c b/src/mm-modem-base.c
index e50e13f..dd1420e 100644
--- a/src/mm-modem-base.c
+++ b/src/mm-modem-base.c
@@ -80,6 +80,9 @@ typedef struct {
 GHashTable *ports;
 
 GHashTable *tz_data;
+gboolean tz_poll_running;
+guint tz_poll_source;
+guint tz_poll_count;
 } MMModemBasePrivate;
 
 
@@ -503,6 +506,80 @@ value_destroy (gpointer data)
 g_slice_free (GValue, v);
 }
 
+static void
+timezone_poll_done (MMModem *modem, GError *error, gpointer user_data)
+{
+/* do nothing; modem will call mm_modem_base_set_network_timezone if
+   it has timezone data, and then we will stop nagging it. */
+}
+
+static gboolean
+timezone_poll_callback (gpointer data)
+{
+MMModemBase *self = (MMModemBase *) data;
+MMModemBasePrivate *priv = MM_MODEM_BASE_GET_PRIVATE (self);
+gboolean result;
+
+if (priv->tz_poll_count == 0)
+goto stop_polling;
+
+priv->tz_poll_count--;
+result = mm_modem_time_poll_network_timezone (MM_MODEM_TIME (self),
+  timezone_poll_done,
+  NULL);
+if (!result)
+goto stop_polling;
+
+return TRUE;
+
+stop_polling:
+mm_modem_base_set_network_timezone (self, NULL, NULL, NULL);
+return FALSE;
+}
+
+#define TIMEZONE_POLL_INTERVAL_SEC 5
+#define TIMEZONE_POLL_RETRIES 6
+
+void
+mm_modem_base_set_network_timezone_polling (MMModemBase *self,
+gboolean should_poll)
+{
+MMModemBasePrivate *priv;
+
+g_return_if_fail (self != NULL);
+g_return_if_fail (MM_IS_MODEM_BASE (self));
+
+priv = MM_MODEM_BASE_GET_PRIVATE (self);
+
+if (should_poll == priv->tz_poll_running)
+return;
+
+if (should_poll) {
+priv->tz_poll_count = TIMEZONE_POLL_RETRIES;
+priv->tz_poll_source = g_timeout_add_seconds 
(TIMEZONE_POLL_INTERVAL_SEC,
+  timezone_poll_callback,
+  self);
+} else
+g_source_remove (priv->tz_poll_source);
+
+priv->tz_poll_running = should_poll;
+}
+
+static void
+modem_state_changed (MMModemBase *self, GParamSpec *pspec, gpointer user_data)
+{
+MMModemState state;
+gboolean registered;
+
+state = mm_modem_get_state (MM_MODEM (self));
+registered = (state >= MM_MODEM_STATE_REGISTERED);
+
+mm_modem_base_set_network_timezone_polling (self, registered);
+
+if (!registered)
+mm_modem_base_set_network_timezone (self, NULL, NULL, NULL);
+}
+
 void
 mm_modem_base_set_network_timezone (MMModemBase *self, gint *offset,
 gint *dst_offset, gint *leap_seconds)
@@ -530,6 +607,8 @@ mm_modem_base_set_network_timezone (MMModemBase *self, gint 
*offset,
 g_hash_table_remove (priv->tz_data, "leap_seconds");
 
 g_object_notify (G_OBJECT (self), MM_MODEM_TIME_NETWORK_TIMEZONE);
+
+mm_modem_base_set_network_timezone_polling (self, FALSE);
 }
 
 /*/
@@ -782,6 +861,7 @@ mm_modem_base_init (MMModemBase *self)
 
 priv->ports = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
g_object_unref);
 priv->tz_data = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, 
value_destroy);
+priv->tz_poll_running = FALSE;
 
 mm_properties_changed_signal_register_property (G_OBJECT (self),
 MM_MODEM_ENABLED,
@@ -815,6 +895,11 @@ mm_modem_base_init (MMModemBase *self)
 
MM_MODEM_TIME_NETWORK_TIMEZONE,
 NULL,
 
MM_DBUS_INTERFACE_MODEM_TIME);
+
+g_signal_connect (self,
+  "notify::" MM_MODEM_STATE,
+  G_CALLBACK (modem_state_changed),
+  NULL);
 }
 
 static void
@@ -990,6 +1075,9 @@ finalize (GObject *object)
 
 mm_auth_provider_cancel_for_owner (priv->authp, object);
 
+if (priv->tz_poll_running)
+g_source_remove (priv->tz_poll_source);
+
 g_hash_table_destroy (priv->ports);
 g_hash_table_destroy (priv->tz_data);
 g_free (priv->driver);
diff --git a/src/mm-modem-base.h b/src/mm-modem-base.h
index a7b8afe..a386bd7 100644
--- a/src/mm-modem-base.h
+++ b/src/mm-modem-base.h
@@ -81,6 +81,9 @@ void mm_modem_base_set_network_timezone (MMModemBase *self,
  gint *dst_offset,
  gint *leap_seconds);
 
+void mm_modem_base_set_network_timezone_pollin

[PATCH 5/7] time: implement ModemTime in ModemBase

2012-01-20 Thread Thomas Tuttle
Signed-off-by: Thomas Tuttle 
---
 src/mm-modem-base.c |  103 ++-
 src/mm-modem-base.h |4 ++
 src/mm-modem.h  |3 +-
 3 files changed, 108 insertions(+), 2 deletions(-)

diff --git a/src/mm-modem-base.c b/src/mm-modem-base.c
index 372367a..e50e13f 100644
--- a/src/mm-modem-base.c
+++ b/src/mm-modem-base.c
@@ -29,15 +29,18 @@
 #include "mm-properties-changed-signal.h"
 #include "mm-callback-info.h"
 #include "mm-modem-helpers.h"
+#include "mm-modem-time.h"
 
 static void modem_init (MMModem *modem_class);
 static void pc_init (MMPropertiesChanged *pc_class);
+static void modem_time_init (MMModemTime *modem_time_class);
 
 G_DEFINE_TYPE_EXTENDED (MMModemBase, mm_modem_base,
 G_TYPE_OBJECT,
 G_TYPE_FLAG_VALUE_ABSTRACT,
 G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM, modem_init)
-G_IMPLEMENT_INTERFACE (MM_TYPE_PROPERTIES_CHANGED, 
pc_init))
+G_IMPLEMENT_INTERFACE (MM_TYPE_PROPERTIES_CHANGED, 
pc_init)
+G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_TIME, 
modem_time_init))
 
 #define MM_MODEM_BASE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
MM_TYPE_MODEM_BASE, MMModemBasePrivate))
 
@@ -75,6 +78,8 @@ typedef struct {
 MMAuthProvider *authp;
 
 GHashTable *ports;
+
+GHashTable *tz_data;
 } MMModemBasePrivate;
 
 
@@ -481,6 +486,52 @@ mm_modem_base_set_revision (MMModemBase *self, const char 
*revision)
 priv->revision = g_strdup (revision);
 }
 
+static GValue *
+int_to_gvalue (gint i)
+{
+GValue *v = g_slice_new0 (GValue);
+g_value_init (v, G_TYPE_INT);
+g_value_set_int (v, i);
+return v;
+}
+
+static void
+value_destroy (gpointer data)
+{
+GValue *v = (GValue *) data;
+g_value_unset (v);
+g_slice_free (GValue, v);
+}
+
+void
+mm_modem_base_set_network_timezone (MMModemBase *self, gint *offset,
+gint *dst_offset, gint *leap_seconds)
+{
+MMModemBasePrivate *priv;
+
+g_return_if_fail (self != NULL);
+g_return_if_fail (MM_IS_MODEM_BASE (self));
+
+priv = MM_MODEM_BASE_GET_PRIVATE (self);
+
+if (offset)
+g_hash_table_replace (priv->tz_data, "offset", int_to_gvalue 
(*offset));
+else
+g_hash_table_remove (priv->tz_data, "offset");
+
+if (dst_offset)
+g_hash_table_replace (priv->tz_data, "dst_offset", int_to_gvalue 
(*dst_offset));
+else
+g_hash_table_remove (priv->tz_data, "dst_offset");
+
+if (leap_seconds)
+g_hash_table_replace (priv->tz_data, "leap_seconds", int_to_gvalue 
(*leap_seconds));
+else
+g_hash_table_remove (priv->tz_data, "leap_seconds");
+
+g_object_notify (G_OBJECT (self), MM_MODEM_TIME_NETWORK_TIMEZONE);
+}
+
 /*/
 static void
 card_info_simple_invoke (MMCallbackInfo *info)
@@ -693,6 +744,36 @@ modem_auth_finish (MMModem *modem, MMAuthRequest *req, 
GError **error)
 /*/
 
 static void
+get_network_time_invoke (MMCallbackInfo *info)
+{
+MMModemTimeGetNetworkTimeFn callback = (MMModemTimeGetNetworkTimeFn) 
info->callback;
+MMModemTime *modem = MM_MODEM_TIME (info->modem);
+char *network_time = (char *) mm_callback_info_get_result (info);
+
+callback (modem, network_time, info->error, info->user_data);
+}
+
+static void
+get_network_time (MMModemTime *modem,
+  MMModemTimeGetNetworkTimeFn callback,
+  gpointer user_data)
+{
+MMModemBase *self = MM_MODEM_BASE (modem);
+MMCallbackInfo *info;
+
+char *network_time = g_strdup("");
+
+info = mm_callback_info_new_full (MM_MODEM (self),
+  get_network_time_invoke,
+  G_CALLBACK (callback),
+  user_data);
+mm_callback_info_set_result (info, network_time, g_free);
+mm_callback_info_schedule (info);
+}
+
+/*/
+
+static void
 mm_modem_base_init (MMModemBase *self)
 {
 MMModemBasePrivate *priv = MM_MODEM_BASE_GET_PRIVATE (self);
@@ -700,6 +781,7 @@ mm_modem_base_init (MMModemBase *self)
 priv->authp = mm_auth_provider_get ();
 
 priv->ports = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
g_object_unref);
+priv->tz_data = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, 
value_destroy);
 
 mm_properties_changed_signal_register_property (G_OBJECT (self),
 MM_MODEM_ENABLED,
@@ -729,6 +811,10 @@ mm_modem_base_init (MMModemBase *self)
 MM_MODEM_IP_METHOD,
 NULL,
 MM_DBUS_INTER

[PATCH 4/7] time: Implement MMModemTime boilerplate.

2012-01-20 Thread Thomas Tuttle
Signed-off-by: Thomas Tuttle 
---
 src/Makefile.am |9 ++-
 src/mm-modem-time.c |  153 +++
 src/mm-modem-time.h |   52 +
 3 files changed, 212 insertions(+), 2 deletions(-)
 create mode 100644 src/mm-modem-time.c
 create mode 100644 src/mm-modem-time.h

diff --git a/src/Makefile.am b/src/Makefile.am
index e01cec1..77e059d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -123,7 +123,9 @@ modem_manager_SOURCES = \
mm-modem-location.c \
mm-modem-location.h \
mm-modem-firmware.c \
-   mm-modem-firmware.h
+   mm-modem-firmware.h \
+   mm-modem-time.c \
+   mm-modem-time.h
 
 mm-manager-glue.h: $(top_srcdir)/introspection/org.freedesktop.ModemManager.xml
$(AM_V_GEN) dbus-binding-tool --prefix=mm_manager --mode=glib-server 
--output=$@ $<
@@ -169,8 +171,11 @@ mm-modem-location-glue.h: 
$(top_srcdir)/introspection/org.freedesktop.ModemManag
 mm-modem-firmware-glue.h: 
$(top_srcdir)/introspection/org.freedesktop.ModemManager.Modem.Firmware.xml
$(AM_V_GEN) dbus-binding-tool --prefix=mm_modem_firmware 
--mode=glib-server --output=$@ $<
 
+mm-modem-time-glue.h: 
$(top_srcdir)/introspection/org.freedesktop.ModemManager.Modem.Time.xml
+   $(AM_V_GEN) dbus-binding-tool --prefix=mm_modem_time --mode=glib-server 
--output=$@ $<
+
 modem_manager_SOURCES += $(loc_sources)
 
-BUILT_SOURCES += mm-modem-location-glue.h mm-modem-firmware-glue.h
+BUILT_SOURCES += mm-modem-location-glue.h mm-modem-firmware-glue.h 
mm-modem-time-glue.h
 
 CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/mm-modem-time.c b/src/mm-modem-time.c
new file mode 100644
index 000..a1878c8
--- /dev/null
+++ b/src/mm-modem-time.c
@@ -0,0 +1,153 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details:
+ *
+ * Copyright (C) 2011 The Chromium OS Authors
+ */
+
+#include 
+#include 
+
+#include "mm-modem-time.h"
+#include "mm-errors.h"
+#include "mm-callback-info.h"
+#include "mm-marshal.h"
+
+static void impl_modem_time_get_network_time (MMModemTime *self,
+  DBusGMethodInvocation *context);
+
+#include "mm-modem-time-glue.h"
+
+enum {
+NETWORK_TIME_CHANGED,
+LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static void
+async_get_call_done (MMModemTime *self,
+ const char *network_time,
+ GError *error,
+ gpointer user_data)
+{
+DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
+
+if (error)
+dbus_g_method_return_error (context, error);
+else
+dbus_g_method_return (context, network_time);
+}
+
+static void
+time_get_invoke (MMCallbackInfo *info)
+{
+MMModemTimeGetNetworkTimeFn callback = (MMModemTimeGetNetworkTimeFn) 
info->callback;
+
+callback ((MMModemTime *) info->modem, NULL, info->error, info->user_data);
+}
+
+static void
+async_get_call_not_supported (MMModemTime *self,
+  MMModemTimeGetNetworkTimeFn callback,
+  gpointer user_data)
+{
+MMCallbackInfo *info;
+
+info = mm_callback_info_new_full (MM_MODEM (self),
+  time_get_invoke,
+  G_CALLBACK (callback),
+  user_data);
+info->error = g_error_new_literal (MM_MODEM_ERROR,
+   MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
+   "Operation not supported");
+
+mm_callback_info_schedule (info);
+}
+
+void
+mm_modem_time_get_network_time (MMModemTime *self,
+MMModemTimeGetNetworkTimeFn callback,
+gpointer user_data)
+{
+g_return_if_fail (MM_IS_MODEM_TIME (self));
+g_return_if_fail (callback != NULL);
+
+if (MM_MODEM_TIME_GET_INTERFACE (self)->get_network_time)
+MM_MODEM_TIME_GET_INTERFACE (self)->get_network_time (self, callback, 
user_data);
+else
+async_get_call_not_supported (self, callback, user_data);
+}
+
+static void
+impl_modem_time_get_network_time (MMModemTime *self,
+  DBusGMethodInvocation *context)
+{
+mm_modem_time_get_network_time (self, async_get_call_done, context);
+}
+
+#define DBUS_TYPE_G_MAP_OF_VARIANT (dbus_g_type_get_map ("GHashTable", 
G_TYPE_STRING, G_TYPE_VALUE))
+
+static void

[PATCH 3/7] time: Add Modem.Time introspection XML

2012-01-20 Thread Thomas Tuttle
Signed-off-by: Thomas Tuttle 
---
 introspection/Makefile.am  |3 +-
 introspection/all.xml  |1 +
 .../org.freedesktop.ModemManager.Modem.Time.xml|   56 
 3 files changed, 59 insertions(+), 1 deletions(-)
 create mode 100644 introspection/org.freedesktop.ModemManager.Modem.Time.xml

diff --git a/introspection/Makefile.am b/introspection/Makefile.am
index 70143ce..4e5ad3a 100644
--- a/introspection/Makefile.am
+++ b/introspection/Makefile.am
@@ -17,4 +17,5 @@ EXTRA_DIST = \
org.freedesktop.ModemManager.Modem.Gsm.SMS.xml \
org.freedesktop.ModemManager.Modem.Gsm.Ussd.xml \
org.freedesktop.ModemManager.Modem.Location.xml \
-   org.freedesktop.ModemManager.Modem.Simple.xml
+   org.freedesktop.ModemManager.Modem.Simple.xml \
+   org.freedesktop.ModemManager.Modem.Time.xml
diff --git a/introspection/all.xml b/introspection/all.xml
index 2a85a07..8f23aac 100644
--- a/introspection/all.xml
+++ b/introspection/all.xml
@@ -37,6 +37,7 @@
   
   
   
+  
   
 
   
diff --git a/introspection/org.freedesktop.ModemManager.Modem.Time.xml 
b/introspection/org.freedesktop.ModemManager.Modem.Time.xml
new file mode 100644
index 000..cfdb9a3
--- /dev/null
+++ b/introspection/org.freedesktop.ModemManager.Modem.Time.xml
@@ -0,0 +1,56 @@
+
+
+http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0";>
+  
+
+  This interface allows clients to receive network time and timezone
+  updates broadcast by mobile networks.
+
+
+
+  
+The timezone data provided by the network.  It may include one of more
+of the following fields:
+
+'offset': offset of the timezone from UTC, in minutes (including DST,
+  if applicable).
+'dst_offset': amount of 'offset' that is due to DST, in minutes.
+'leap_seconds': number of leap seconds included in the network time.
+  
+
+
+
+  
+Gets the current network time.
+
+This method will only work if the modem tracks, or can request, the
+current network time; it will not attempt to use previously-received
+network time updates on the host to guess the current network time.
+  
+  
+  
+
+  If the network time is known, a string containing a date and time in
+  ISO 8601 format.
+
+  If the network time is unknown, the empty string.
+
+  
+
+
+
+  
+Sent when the network time is updated.
+  
+  
+
+  If the network time is known, a string containing a date and time in
+  ISO 8601 format.
+
+  If the network time is unknown, the empty string.
+
+  
+
+  
+
-- 
1.7.7.3

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH 2/7] firmware: add XML file to introspection/Makefile.am

2012-01-20 Thread Thomas Tuttle
Signed-off-by: Thomas Tuttle 
---
 introspection/Makefile.am |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/introspection/Makefile.am b/introspection/Makefile.am
index 0c67898..70143ce 100644
--- a/introspection/Makefile.am
+++ b/introspection/Makefile.am
@@ -8,6 +8,7 @@ EXTRA_DIST = \
org.freedesktop.ModemManager.xml \
org.freedesktop.ModemManager.Modem.xml \
org.freedesktop.ModemManager.Modem.Cdma.xml \
+   org.freedesktop.ModemManager.Modem.Firmware.xml \
org.freedesktop.ModemManager.Modem.Gsm.xml \
org.freedesktop.ModemManager.Modem.Gsm.Card.xml \
org.freedesktop.ModemManager.Modem.Gsm.Contacts.xml \
-- 
1.7.7.3

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH 1/7] Sort introspection/Makefile.am and all.xml

2012-01-20 Thread Thomas Tuttle
To make things neater, sort the files listed in instrospection's Makefile
alphabetically, and sort the files listed in all.xml alphabetically within
logical groups.

Signed-off-by: Thomas Tuttle 
---
 introspection/Makefile.am |   14 +++---
 introspection/all.xml |6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/introspection/Makefile.am b/introspection/Makefile.am
index 3c7a380..0c67898 100644
--- a/introspection/Makefile.am
+++ b/introspection/Makefile.am
@@ -1,19 +1,19 @@
 EXTRA_DIST = \
all.xml \
-   org.freedesktop.ModemManager.xml \
mm-mobile-error.xml \
-   org.freedesktop.ModemManager.Modem.xml \
-   org.freedesktop.ModemManager.Modem.Cdma.xml \
mm-modem-connect-error.xml \
mm-modem-error.xml \
+   mm-serial-error.xml \
+   org.freedesktop.DBus.Properties.xml \
+   org.freedesktop.ModemManager.xml \
+   org.freedesktop.ModemManager.Modem.xml \
+   org.freedesktop.ModemManager.Modem.Cdma.xml \
org.freedesktop.ModemManager.Modem.Gsm.xml \
org.freedesktop.ModemManager.Modem.Gsm.Card.xml \
org.freedesktop.ModemManager.Modem.Gsm.Contacts.xml \
org.freedesktop.ModemManager.Modem.Gsm.Hso.xml \
org.freedesktop.ModemManager.Modem.Gsm.Network.xml \
org.freedesktop.ModemManager.Modem.Gsm.SMS.xml \
-   org.freedesktop.ModemManager.Modem.Simple.xml \
-   mm-serial-error.xml \
-   org.freedesktop.ModemManager.Modem.Location.xml \
org.freedesktop.ModemManager.Modem.Gsm.Ussd.xml \
-   org.freedesktop.DBus.Properties.xml
+   org.freedesktop.ModemManager.Modem.Location.xml \
+   org.freedesktop.ModemManager.Modem.Simple.xml
diff --git a/introspection/all.xml b/introspection/all.xml
index c9c1dc5..2a85a07 100644
--- a/introspection/all.xml
+++ b/introspection/all.xml
@@ -27,16 +27,16 @@
   
   
   
-  
-  
   
   
   
   
+  
   
   
-  
   
+  
+  
   
 
   
-- 
1.7.7.3

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Force default gateway for a specific connection?

2012-01-20 Thread W. Martin Borgert

Quoting "Lamarque V. Souza" :

Em Friday 20 January 2012, Pantelis Koukousoulas escreveu:

My humble opinion is that it should be like this by default, i.e., ppp
connections
should have higher priority for getting the default route with the
rationale being
that LAN connections can be used for many things while ppp connections are
more "internet-specific" in general.

Is there any real advantage for LAN to have higher priority than PPP?


PPP is used by mobile broadband, which is more expensive (in money
sense) than the other connection types, which usually are free of charge.
Besides, LAN is usually faster.


Yes, both use cases make sense in different situations.

There should be sth. like a "big switch":
Always prefer LAN vs. always prefer mobile.

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Force default gateway for a specific connection?

2012-01-20 Thread Lamarque V. Souza
Em Friday 20 January 2012, Pantelis Koukousoulas escreveu:
> On Fri, Jan 20, 2012 at 11:13 AM, Thomas Bechtold
> 
>  wrote:
> > That's not working in my case because both conenctions should grap the
> > default route, but the modem connection should have a higher priority.
> 
> My humble opinion is that it should be like this by default, i.e., ppp
> connections
> should have higher priority for getting the default route with the
> rationale being
> that LAN connections can be used for many things while ppp connections are
> more "internet-specific" in general.
> 
> Is there any real advantage for LAN to have higher priority than PPP?

PPP is used by mobile broadband, which is more expensive (in money 
sense) than the other connection types, which usually are free of charge. 
Besides, LAN is usually faster.

-- 
Lamarque V. Souza
KDE's Network Management maintainer
http://planetkde.org/pt-br
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Force default gateway for a specific connection?

2012-01-20 Thread Pantelis Koukousoulas
On Fri, Jan 20, 2012 at 11:13 AM, Thomas Bechtold
 wrote:
> That's not working in my case because both conenctions should grap the
> default route, but the modem connection should have a higher priority.

My humble opinion is that it should be like this by default, i.e., ppp
connections
should have higher priority for getting the default route with the
rationale being
that LAN connections can be used for many things while ppp connections are
more "internet-specific" in general.

Is there any real advantage for LAN to have higher priority than PPP?
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


strange behaviour on wireless connection

2012-01-20 Thread Arend van Spriel
In my wireless test setup I use nmcli. I get a number of warnings. I am
wondering why a "Get" is done for 'Vpn' property. This is a wireless
connection so it is probably expected to fail. Any hints are welcome.

Gr. AvS

---
$ nmcli con up id smoke-net

** (process:22937): WARNING **: fetch_connections_done: error fetching
user connections: (2) The name
org.freedesktop.NetworkManagerUserSettings was not provided by any
.service files.

** (process:22937): WARNING **: Error in getting active connection 'Vpn'
property: (19) Method "Get" with signature "ss" on interface
"org.freedesktop.DBus.Properties" doesn't exist


** (process:22937): WARNING **: _nm_object_array_demarshal: couldn't
create object for /org/freedesktop/NetworkManager/ActiveConnection/9

** (process:22937): WARNING **: Error in getting active connection 'Vpn'
property: (19) Method "Get" with signature "ss" on interface
"org.freedesktop.DBus.Properties" doesn't exist


** (process:22937): WARNING **: _nm_object_array_demarshal: couldn't
create object for /org/freedesktop/NetworkManager/ActiveConnection/9

** (process:22937): WARNING **: Error in getting active connection 'Vpn'
property: (19) Method "Get" with signature "ss" on interface
"org.freedesktop.DBus.Properties" doesn't exist


** (process:22937): WARNING **: _nm_object_array_demarshal: couldn't
create object for /org/freedesktop/NetworkManager/ActiveConnection/9
Error: Obtaining active connection for
'/org/freedesktop/NetworkManager/ActiveConnection/9' failed.

--
$ nmcli con
smoke-net 82f56905-c5c3-4302-90c5-5b8851e0f797 802-11-wireless system never

--
udev events

KERNEL[1327059014.034431] add  /module/brcmfmac (module)
UDEV  [1327059014.034751] add  /module/brcmfmac (module)
KERNEL[1327059014.696434] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
KERNEL[1327059014.698181] remove
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
UDEV  [1327059014.698292] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
KERNEL[1327059014.698375] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211/phy0
(ieee80211)
UDEV  [1327059014.698890] remove
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
KERNEL[1327059014.699039] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211/phy0/rfkill13
(rfkill)
UDEV  [1327059014.699085] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211/phy0
(ieee80211)
KERNEL[1327059014.699178] change
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211/phy0/rfkill13
(rfkill)
KERNEL[1327059014.699395] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan0
(net)
KERNEL[1327059014.699564] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan0/queues/rx-0
(queues)
KERNEL[1327059014.699700] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan0/queues/tx-0
(queues)
UDEV  [1327059014.700011] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211/phy0/rfkill13
(rfkill)
UDEV  [1327059014.700760] change
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211/phy0/rfkill13
(rfkill)
KERNEL[1327059014.701852] add  /bus/sdio/drivers/brcmfmac (drivers)
UDEV  [1327059014.702297] add  /bus/sdio/drivers/brcmfmac (drivers)
KERNEL[1327059014.709310] move
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan1
(net)
UDEV  [1327059014.770649] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan1
(net)
UDEV  [1327059014.771403] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan0/queues/tx-0
(queues)
UDEV  [1327059014.772254] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/net/wlan0/queues/rx-0
(queues)
KERNEL[1327059014.773586] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
KERNEL[1327059014.776338] remove
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
UDEV  [1327059014.776806] remove
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
UDEV  [1327059014.778940] add
/devices/pci:00/:00:1c.2/:04:00.1/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/firmware/mmc0:0001:2
(firmware)
KERNEL[1327059014.779755] add
/devices/

Re: Force default gateway for a specific connection?

2012-01-20 Thread Thomas Bechtold

Hi Dan,

On 19/01/12 18:32, Dan Williams wrote:

On Wed, 2012-01-18 at 12:23 +0100, Thomas Bechtold wrote:

Hi,

is it possible to tell NM to use a specific connection always as default
gateway?
in my case, i use a modem and a lan cable and i want to use always the
modem as default gateway. the reason is, that sometimes a firewall
blocks some LAN traffic so i always want to use the modem connection as
default gw.


Yes it's quite possible, though the terminology is opposite than what
you're talking about.  Every connection in NM by can grab the default
route and will do so by default since that's the most common case.

What you want to do here is to mark the connections you *don't* want to
have the default route as "never-default" (in keyfile config files) or,
in the UI, "Use this connection only for resources on its network" (in
the Routes dialog of nm-connection-editor).


That's not working in my case because both conenctions should grap the 
default route, but the modem connection should have a higher priority.

i want to do the following (modem=ppp0 and ethernet=eth0) steps:

1) both devices are detached
2) attach eth0: now eth0 should have the default route
3) attach ppp0: now ppp0 should have the default route
4) detach ppp0: now eth0 should have the default route
5) detach eth0: no route (no devices attached)
6) attach ppp0: ppp0 should have the default route
7) attach eth0: ppp0 should have the default route

Is this usecase possible?

With "never-default=true" for the ethernet conenction, after step 4) 
there's no default route available with nm 0.8.6.



Tom
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list