Supported CDMA modems

2013-05-07 Thread Thomas Bechtold
Hi,

is there a list of supported CDMA-Modems for MM05? I need a modem for
Korea. Any tipps are very welcome!

TIA,

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


[PATCH] Show simple connect state as string for debugging

2013-03-26 Thread Thomas Bechtold
Hi,

the patch is for MM 06 and is useful for debugging only. I don't know if
the patch is relevant for master, too.

Cheers,

Tom

---
 src/mm-generic-gsm.c | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index 0e7c30b..e728a03 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -6031,6 +6031,29 @@ typedef enum {
 SIMPLE_STATE_DONE
 } SimpleState;
 
+static const gchar*
+simple_state_to_str (SimpleState state)
+{
+switch (state) {
+case SIMPLE_STATE_CHECK_PIN:
+return "Check PIN";
+case SIMPLE_STATE_ENABLE:
+return "Enable";
+case SIMPLE_STATE_ALLOWED_MODE:
+return "Allowed Mode";
+case SIMPLE_STATE_REGISTER:
+return "Register";
+case SIMPLE_STATE_SET_APN:
+return "Set APN";
+case SIMPLE_STATE_CONNECT:
+return "Connect";
+case SIMPLE_STATE_DONE:
+return "Done";
+default:
+return "Unknown state";
+}
+}
+
 /* Looks a value up in the simple connect properties dictionary.  If the
  * requested key is not present in the dict, NULL is returned.  If the
  * requested key is present but is not a string, an error is returned.
@@ -6166,7 +6189,7 @@ simple_state_machine (MMModem *modem, GError *error, 
gpointer user_data)
 priv = MM_GENERIC_GSM_GET_PRIVATE (modem);
 
 g_object_get (G_OBJECT (modem), MM_MODEM_DATA_DEVICE, &data_device, NULL);
-mm_dbg ("(%s): simple connect state %d", data_device, state);
+mm_dbg ("(%s): simple connect state %d (%s)", data_device, state, 
simple_state_to_str (state));
 g_free (data_device);
 
 switch (state) {
-- 
1.8.2.rc3

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


[PATCH] Use correct printf modifier for gsize

2013-03-25 Thread Thomas Bechtold
Hi,

this patch is for MM06. But I guess master is also affected.

Cheers,

Tom

---
 src/mm-sms-utils.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mm-sms-utils.c b/src/mm-sms-utils.c
index f04cbe2..cda9337 100644
--- a/src/mm-sms-utils.c
+++ b/src/mm-sms-utils.c
@@ -362,7 +362,7 @@ sms_parse_pdu (const char *hexpdu, GError **error)
 variable_length_items = smsc_addr_num_octets;
 if (pdu_len < variable_length_items + SMS_MIN_PDU_LEN) {
 g_set_error (error, MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
- "PDU too short (1): %zd vs %d",
+ "PDU too short (1): %" G_GSIZE_FORMAT "  vs %d",
  pdu_len,
  variable_length_items + SMS_MIN_PDU_LEN);
 g_free (pdu);
@@ -380,7 +380,7 @@ sms_parse_pdu (const char *hexpdu, GError **error)
 variable_length_items += sender_addr_num_octets;
 if (pdu_len < variable_length_items + SMS_MIN_PDU_LEN) {
 g_set_error (error, MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
- "PDU too short (2): %zd vs %d",
+ "PDU too short (2): %" G_GSIZE_FORMAT " vs %d",
  pdu_len,
  variable_length_items + SMS_MIN_PDU_LEN);
 g_free (pdu);
@@ -400,7 +400,7 @@ sms_parse_pdu (const char *hexpdu, GError **error)
 variable_length_items += user_data_len;
 if (pdu_len < variable_length_items + SMS_MIN_PDU_LEN) {
 g_set_error (error, MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
- "PDU too short (3): %zd vs %d",
+ "PDU too short (3): %" G_GSIZE_FORMAT " vs %d",
  pdu_len,
  variable_length_items + SMS_MIN_PDU_LEN);
 g_free (pdu);
-- 
1.7.2.5

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


Re: [PATCH] config: convert NMConfig to object

2013-02-26 Thread Thomas Bechtold

On 02/01/2013 12:36 AM, Dan Williams wrote:

On Tue, 2013-01-15 at 18:48 +0100, Thomas Bechtold wrote:

---
  src/main.c  |   2 +-
  src/nm-config.c | 209 ++--
  src/nm-config.h |  38 ---
  3 files changed, 172 insertions(+), 77 deletions(-)


Looks good except for some whitespace stuff that I cleaned up.  It's now
pushed to the dcbw/config branch awaiting further review.


0.9.8 is released so I guess this patch can be merged into master now.


Cheers,

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


[PATCH] config: convert NMConfig to object

2013-01-15 Thread Thomas Bechtold
---
 src/main.c  |   2 +-
 src/nm-config.c | 209 ++--
 src/nm-config.h |  38 ---
 3 files changed, 172 insertions(+), 77 deletions(-)

diff --git a/src/main.c b/src/main.c
index b074bd8..98aae4f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -693,7 +693,7 @@ done:
if (pidfile && wrote_pidfile)
unlink (pidfile);
 
-   nm_config_free (config);
+   g_object_unref (config);
 
/* Free options */
g_free (pidfile);
diff --git a/src/nm-config.c b/src/nm-config.c
index 6e801d3..9e682d1 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -16,6 +16,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2013 Thomas Bechtold 
  */
 
 #include 
@@ -27,7 +28,7 @@
 #define NM_DEFAULT_SYSTEM_CONF_FILE  NMCONFDIR "/NetworkManager.conf"
 #define NM_OLD_SYSTEM_CONF_FILE  NMCONFDIR "/nm-system-settings.conf"
 
-struct NMConfig {
+typedef struct {
char *path;
char **plugins;
char *dhcp_client;
@@ -37,7 +38,13 @@ struct NMConfig {
char *connectivity_uri;
guint connectivity_interval;
char *connectivity_response;
-};
+} NMConfigPrivate;
+
+static NMConfig *singleton = NULL;
+
+G_DEFINE_TYPE (NMConfig, nm_config, G_TYPE_OBJECT)
+
+#define NM_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
NM_TYPE_CONFIG, NMConfigPrivate))
 
 //
 
@@ -52,12 +59,95 @@ nm_config_error_quark (void)
 
 //
 
+static void
+nm_config_init (NMConfig *config)
+{
+   NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (config);
+   priv->path = NULL;
+   priv->plugins = NULL;
+   priv->dhcp_client = NULL;
+   priv->dns_plugins = NULL;
+   priv->log_level = NULL;
+   priv->log_domains = NULL;
+   priv->connectivity_uri = NULL;
+   priv->connectivity_interval = 0;
+   priv->connectivity_response = NULL;
+}
+
+static void
+dispose (GObject *object)
+{
+   NMConfig *config = NM_CONFIG (object);
+   NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (config);
+
+   if (priv->path) {
+   g_free (priv->path);
+   priv->path = NULL;
+   }
+   if (priv->plugins) {
+   g_strfreev (priv->plugins);
+   priv->plugins = NULL;
+   }
+   if (priv->dhcp_client) {
+   g_free (priv->dhcp_client);
+   priv->dhcp_client = NULL;
+   }
+   if (priv->dns_plugins) {
+   g_strfreev (priv->dns_plugins);
+   priv->dns_plugins = NULL;
+   }
+   if (priv->log_level) {
+   g_free (priv->log_level);
+   priv->log_level = NULL;
+   }
+   if (priv->log_domains) {
+   g_free (priv->log_domains);
+   priv->log_domains = NULL;
+   }
+   if (priv->connectivity_uri) {
+   g_free (priv->connectivity_uri);
+   priv->connectivity_uri = NULL;
+   }
+   if (priv->connectivity_response) {
+   g_free (priv->connectivity_response);
+   priv->connectivity_response = NULL;
+   }
+
+   G_OBJECT_CLASS (nm_config_parent_class)->dispose (object);
+}
+
+static void
+finalize (GObject *gobject)
+{
+   singleton = NULL;
+   G_OBJECT_CLASS (nm_config_parent_class)->finalize (gobject);
+}
+
+
+static void
+nm_config_class_init (NMConfigClass *config_class)
+{
+   GObjectClass *object_class = G_OBJECT_CLASS (config_class);
+
+   g_type_class_add_private (config_class, sizeof (NMConfigPrivate));
+   object_class->dispose = dispose;
+   object_class->finalize = finalize;
+}
+
+NMConfig *
+nm_config_get (void)
+{
+   g_assert (singleton);
+   g_object_ref (singleton);
+   return singleton;
+}
+
 const char *
 nm_config_get_path (NMConfig *config)
 {
g_return_val_if_fail (config != NULL, NULL);
 
-   return config->path;
+   return NM_CONFIG_GET_PRIVATE (config)->path;
 }
 
 const char **
@@ -65,7 +155,7 @@ nm_config_get_plugins (NMConfig *config)
 {
g_return_val_if_fail (config != NULL, NULL);
 
-   return (const char **) config->plugins;
+   return (const char **) NM_CONFIG_GET_PRIVATE (config)->plugins;
 }
 
 const char *
@@ -73,7 +163,7 @@ nm_config_get_dhcp_client (NMConfig *config)
 {
g_return_val_if_fail (config != NULL, NULL);
 
-   return config->dhcp_client;
+   return NM_CONFIG_GET_PRIVATE (config)->dhcp_client;;
 }
 
 const char **
@@ -81,7 +171,7 @@ nm_config_get_dns_plugins (NMConfig *config)
 {
g_return_val_if_fail (config != NULL, NULL);
 
-   return (const char **) config->

Re: Internet Connection Status

2012-12-18 Thread Thomas Bechtold
On 12/18/2012 04:10 AM, Saran Kumar Krishnan wrote:
> Hi,
> 
> Is there any way to know, the Internet connection is ACTIVE using Network
> Manager.
> 
> I have a WiFi modem, which doesn't get the Internet Connection due to some
> cable issue. But, it sets up the Local LAN
> and Network Manager shows the connection as active.
> 
> It's only through the ping www.google.com i come to know, there is problem
> with the Internet Line.

There's a connectivity check feature. See man NetworkManager.conf


Cheers,

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


Re: NM Without UI

2012-09-16 Thread Thomas Bechtold
On So, 2012-09-16 at 23:00 +0530, Sanjay Pallikera wrote:
> Actually I want to integrate NM with embedded systems without UI, so I want
> only a command line tool or a daemon.
> 
> Kindly pls provide some info on this.

You have different options to control NetworkManager.
1) over DBus [1]
2) with libnm-glib [2] (recommended)
3) command line tool nmcli (see man nmcli)

There are some examples in different languages available [3].


[1] http://projects.gnome.org/NetworkManager/developers/api/09/
[2] http://projects.gnome.org/NetworkManager/developers/libnm-glib/09/
[3]
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples


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


Re: Programmatically adding a wireless connection to network manager configuration?

2012-06-18 Thread Thomas Bechtold
On 18/06/12 12:33, Daniel McCue wrote:
> Thanks Pavel.  If I create a new configuration keyfile in
> /etc/NetworkManager/system-connections, any idea how long it will take
> NetworkManager to notice or is there something I can do to notify it to
> attempt a connection to the new AP?

the new file is detected immediately by NetworkManager. ensure that the
file permissions are 400.

Cheers,

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


Re: Programmatically adding a wireless connection to network manager configuration?

2012-06-18 Thread Thomas Bechtold
On 17/06/12 16:30, Daniel McCue wrote:
> I have an application that acquires wifi connection information from a user
> including SSID, encryption type (e.g., WPA2 Personal or WPA Enterprise) and
> password.  Is there a way I can programmatically inform Network Manager
> about this new connection rather than require the user to access the applet
> from the desktop?

See the examples in the git repository[1]. There's a python example how
to add a system-connection[2].

Cheers,

Tom


[1]http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples
[2]
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-system-connection.py
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH 1/1] configure: fix libsoup check

2012-05-13 Thread Thomas Bechtold
---
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index fe54b40..1330572 100644
--- a/configure.ac
+++ b/configure.ac
@@ -692,7 +692,7 @@ PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26], 
[have_libsoup=yes],[have_libso
 AC_ARG_ENABLE(concheck, AS_HELP_STRING([--enable-concheck], [enable 
connectivity checking support]),
  [enable_concheck=${enableval}], 
[enable_concheck=${have_libsoup}])
 if (test "${enable_concheck}" = "yes"); then
-   if test x"$have_concheck" = x"no"; then
+   if test x"$have_libsoup" = x"no"; then
AC_MSG_ERROR(Connectivity checking requires libsoup development 
headers)
fi
AC_SUBST(LIBSOUP_CFLAGS)
-- 
1.7.9.5

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


Re: iridium: Not getting signal quality, not registered yet

2012-03-29 Thread Thomas Bechtold


On 29/03/12 12:55, Aleksander Morgado wrote:
> Hey,
> 
>>
>> tried again to setup a iridium connection but now i get a lot of "Not
>> getting signal quality, not registered yet" messages and the connection
>> doesn't seem to work at the beginning. after some tries (i think 3x),
>> the connection worked. here are the logs:
>>
>> Are there any problems with this message? and why does the connection
>> doesn't work at the beginning? i changed nothing in the setup (anetnna
>> position, MM restart,...).
>>
> 
> There's no big issue with that message, it just says that until being
> registered you're not able to get signal quality. The "004" in the
> "+CREG:002,004" reply below actually means unknown registration status.

ok.

> 
> The connection doesn't work right away because possibly you don't have a
> satellite in direct LOS. Specially if you only see part of the sky,
> you'll get either no connection or bad connection. Iridium satellites
> are low-earth-orbiting, so they move quite fast w.r.t ground, and
> handoff between satellites may cause that you lose the connection if the
> new satellite coming to give you coverage is blocked by e.g. a wall or a
> building.

yes. that could be the problem. we have only less than half of the sky
available.

Thanks!

Tom

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


Serial device detection not working

2012-03-29 Thread Thomas Bechtold

Hi,

i had an active connection (latest MM_06 from git) with the iridium 
modem but after a while, the modem disconnected. After that, the modem 
was no longer detected by MM.

Then i tried to redetect serial modems but without success.

dbus-send --system --type=method_call --print-reply 
--dest=org.freedesktop.ModemManager /org/freedesktop/ModemManager 
org.freedesktop.ModemManager.ScanDevices


modem-manager[4232]:  [mm-manager.c:1057] mm_manager_start(): 
Starting device scan...
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(tty/ttyS0): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(tty/ttyS2): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(tty/ttyS4): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(net/usb0): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:1075] mm_manager_start(): 
Finished device scan...



root@D110012:~# nmcli dev
DEVICE TYPE  STATE
usb0   802-3-ethernetunavailable



I also powered off/on the iridium modem, executed the dbus-command to 
rescan but the modem is still not detected.


A MM restart worked for that:

~# kill `pidof modem-manager` && modem-manager --log-level=DEBUG  
everse-i-search)`kill': kill `pidof modem-manager` && modem-manager 
--log-level=
modem-manager[4232]:   [main.c:41] mm_signal_handler(): Caught 
signal 15, shutting down...
modem-manager[4232]:   [mm-modem.c:759] mm_modem_set_state(): 
Modem /org/freedesktop/ModemManager/Modems/1: state changed (registered 
-> disabling)
modem-manager[4232]: mm_serial_port_close_force: assertion 
`priv->open_count > 0' failed
modem-manager[4232]:   [mm-modem.c:759] mm_modem_set_state(): 
Modem /org/freedesktop/ModemManager/Modems/1: state changed (disabling 
-> disabled)
modem-manager[4232]:  [mm-manager.c:243] remove_modem(): Removed 
modem /sys/devices/platform/atmel_usart.1
modem-manager[5613]:   [main.c:167] main(): ModemManager (version 
0.5.999) starting...
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Option'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'X22X'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Ericsson MBM'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Sierra'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Linktop'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'AnyData'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Longcheer'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Wavecom'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Novatel'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'SimTech'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Nokia'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Samsung'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Gobi'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Huawei'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'MotoC'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'ZTE'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Option High-Speed'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Cinterion'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Iridium'
modem-manager[5613]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Generic'
modem-manager[5613]:   [mm-manager.c:210] load_plugins(): 
Successfully loaded 20 plugins
modem-manager[5613]:  [mm-manager.c:1057] mm_manager_start(): 
Starting device scan...
modem-manager[5613]:  [mm-manager.c:875] device_added(): 
(tty/ttyS0): port's parent platform driver is not whitelisted
modem-manager[5613]:  [mm-manager.c:875] device_added(): 
(tty/ttyS2): port's parent platform driver is not whitelisted
modem-manager[5613]:  [mm-manager.c:875] device_added(): 
(tty/ttyS4): port's parent platform driver is not whitelisted
modem-manager[5613]:  [mm-manager.c:875] device_added(): 
(net/usb0): port's parent platform driver is not whitelisted
modem-manager[5613]:  [mm-manager.c:1075] mm_manager_start(): 
Finished device scan...
modem-manager[5613]:   [mm-serial-port.c:805] 
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[5613]:  [mm-serial-port.c:874] 
mm_serial_port_open(): (ttyS1) device open count is 1 (open)
modem-manager[5613]:  [mm-plugin-base.c:1050] try_open(): 
(ttyS1): probe requested by plugin 'Cinterion'
modem-manager[5613]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+GCAP'
modem-manager[5613]:  [mm-at-serial-port.c:334] debug_log()

iridium: Not getting signal quality, not registered yet

2012-03-29 Thread Thomas Bechtold

Hi,

tried again to setup a iridium connection but now i get a lot of "Not 
getting signal quality, not registered yet" messages and the connection 
doesn't seem to work at the beginning. after some tries (i think 3x), 
the connection worked. here are the logs:


Are there any problems with this message? and why does the connection 
doesn't work at the beginning? i changed nothing in the setup (anetnna 
position, MM restart,...).


root@D110012:~# kill `pidof modem-manager` && modem-manager 
--log-level=DEBUG
modem-manager[4232]:   [main.c:167] main(): ModemManager (version 
0.5.999) starting...
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Option'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'X22X'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Ericsson MBM'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Sierra'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Linktop'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'AnyData'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Longcheer'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Wavecom'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Novatel'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'SimTech'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Nokia'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Samsung'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Gobi'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Huawei'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'MotoC'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'ZTE'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Option High-Speed'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Cinterion'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Iridium'
modem-manager[4232]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Generic'
modem-manager[4232]:   [mm-manager.c:210] load_plugins(): 
Successfully loaded 20 plugins
modem-manager[4232]:  [mm-manager.c:1057] mm_manager_start(): 
Starting device scan...
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(tty/ttyS0): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(tty/ttyS2): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(tty/ttyS4): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:875] device_added(): 
(net/usb0): port's parent platform driver is not whitelisted
modem-manager[4232]:  [mm-manager.c:1075] mm_manager_start(): 
Finished device scan...
modem-manager[4232]:   [mm-serial-port.c:805] 
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[4232]:  [mm-serial-port.c:874] 
mm_serial_port_open(): (ttyS1) device open count is 1 (open)
modem-manager[4232]:  [mm-plugin-base.c:1050] try_open(): 
(ttyS1): probe requested by plugin 'Cinterion'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+GCAP'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+GCAP'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'ERROR'
modem-manager[4232]:  [mm-serial-parsers.c:438] 
mm_serial_parser_v1_parse(): Got failure code 100: Unknown error
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+GCAP'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+GCAP'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 
'+GCAP:+CGSM,+DS,+WIRIDIUMOK'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+CGMI'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+CGMI'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'Iridium'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'OK'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+CGMM'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+CGMM'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- '9522B'
modem-manager[4232]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'OK'
modem-manager[4232]:  [mm-serial-port.c:908] 
mm_seri

iridium modem disabled after connection failure

2012-03-29 Thread Thomas Bechtold

Hi,

i tried to setup a connection with the iridium modem but the connection 
couldn't be enabled. after that, the modem was disabled and no longer 
detected by MM. I restarted MM then and the modem was detected again.


Here are the logs (latest 06 git branch):

root@D110012:~# kill `pidof modem-manager` && modem-manager 
--log-level=DEBUG
modem-manager[3688]:   [main.c:167] main(): ModemManager (version 
0.5.999) starting...
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Option'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'X22X'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Ericsson MBM'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Sierra'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Linktop'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'AnyData'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Longcheer'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Wavecom'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Novatel'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'SimTech'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Nokia'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Samsung'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Gobi'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Huawei'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'MotoC'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'ZTE'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Option High-Speed'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Cinterion'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Iridium'
modem-manager[3688]:   [mm-manager.c:158] found_plugin(): Loaded 
plugin 'Generic'
modem-manager[3688]:   [mm-manager.c:210] load_plugins(): 
Successfully loaded 20 plugins
modem-manager[3688]:  [mm-manager.c:1057] mm_manager_start(): 
Starting device scan...
modem-manager[3688]:  [mm-manager.c:875] device_added(): 
(tty/ttyS0): port's parent platform driver is not whitelisted
modem-manager[3688]:  [mm-manager.c:875] device_added(): 
(tty/ttyS2): port's parent platform driver is not whitelisted
modem-manager[3688]:  [mm-manager.c:875] device_added(): 
(tty/ttyS4): port's parent platform driver is not whitelisted
modem-manager[3688]:  [mm-manager.c:875] device_added(): 
(net/usb0): port's parent platform driver is not whitelisted
modem-manager[3688]:  [mm-manager.c:1075] mm_manager_start(): 
Finished device scan...
modem-manager[3688]:   [mm-serial-port.c:805] 
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[3688]:  [mm-serial-port.c:874] 
mm_serial_port_open(): (ttyS1) device open count is 1 (open)
modem-manager[3688]:  [mm-plugin-base.c:1050] try_open(): 
(ttyS1): probe requested by plugin 'Cinterion'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+GCAP'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+GCAP'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 
'+GCAP:+CGSM,+DS,+WIRIDIUMOK'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+CGMI'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+CGMI'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'Iridium'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'OK'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): --> 'AT+CGMM'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'AT+CGMM'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- ''
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- '9522B'
modem-manager[3688]:  [mm-at-serial-port.c:334] debug_log(): 
(ttyS1): <-- 'OK'
modem-manager[3688]:  [mm-serial-port.c:908] 
mm_serial_port_close(): (ttyS1) device open count is 0 (close)
modem-manager[3688]:   [mm-serial-port.c:923] 
mm_serial_port_close(): (ttyS1) closing serial port...
modem-manager[3688]:   [mm-serial-port.c:944] 
mm_serial_port_close(): (ttyS1) serial port closed
modem-manager[3688]:  [mm-plugin-iridium.c:90] 
check_vendor_iridium(): Iridium RS232 modem detected
modem-manager[3688]:  [mm-modem-base.c:927] grab_port(): (ttyS1) 
type AT claimed by /sys/devices/platform/atmel_usart.1
modem-manager[3688]:   [mm-manager.c:630] do_grab_port(): 
(Iridium): GSM modem /sys/devices/platform/atmel_usart.1 claimed port 
ttyS1
mod

Iridium modem not detected when already connected and MM starts

2012-03-23 Thread Thomas Bechtold
Hi,

the Iridium Modem is not detected (latest git version from 06 branch)
when the modem is already connected and MM starts. This can happen
because the modem has an external power supply so the OS can restart but
the modem is still connected.
Is it possible to detect the state and disconnect the modem before we do
anything else?

Cheers,

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


Re: DBUS specifications for NetworkManager 0.9

2012-03-09 Thread Thomas Bechtold
Hi Ajay,

you find all useful information for developers at [1].
The dbus interface spec is at [2].

Cheers,

Tom

[1] https://live.gnome.org/NetworkManager/
[2] http://projects.gnome.org/NetworkManager/developers/api/09/spec.html



On Sat, 2012-03-10 at 09:47 +0530, Ajay Garg wrote:
> Hi all.
> 
> Are the dbus-specifications for NetworkManager 0.9 out (on similar lines as
> http://projects.gnome.org/NetworkManager/developers/spec-08.html) ?
> 
> Will be grateful for a reply.
> 
> Thanks and Regards,
> Ajay
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list


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


add missing includes in src/nm-manager.c

2012-02-22 Thread Thomas Bechtold
Hi,

attached is a patch to add missing includes.

Cheers,

Tom
>From c816fc81e50dd57e9ec3a4c74a66a877f0e1fb97 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold 
Date: Wed, 22 Feb 2012 16:52:41 +0100
Subject: [PATCH] core: add missing includes

---
 src/nm-manager.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index 010e30c..b073e58 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -26,6 +26,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
1.7.2.5

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


Re: [PATCH] core: fix singleton handling in NULL/systemd session monitor

2012-02-07 Thread Thomas Bechtold
On Mon, 2012-02-06 at 17:31 -0600, Dan Williams wrote:
> On Sat, 2012-02-04 at 21:08 +0100, Thomas Bechtold wrote:
> > ---
> >  src/nm-session-monitor-null.c|4 +++-
> >  src/nm-session-monitor-systemd.c |4 +++-
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> Pushed, thanks,

Sure? I don't see the commit.

Tom

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


Re: libnm-glib 0.9 depends on glib 2.28 now

2012-02-07 Thread Thomas Bechtold
On Mon, 2012-02-06 at 15:14 -0500, Dan Winship wrote:
> On 02/06/2012 11:45 AM, Dan Williams wrote:
> >> 'g_simple_async_result_take_error' was introduced with commit 9fd98ef9
> >> 'g_clear_object' was introduced with commit cc90f101
> >>
> >>
> >> Was this intended?
> > 
> > I think so
> 
> Actually, I meant to stick with the current glib requirements, I just
> forgot that take_error() was new-ish, and then the g_clear_object()
> slipped by without me noticing.
> 
> Patch attached. I made a compat macro for take_error, since it's useful,
> and just rewrote the one use of g_clear_object().
> 
> Oh, this is untested since I don't have a machine with old enough
> glib... Thomas, can you try it?

there was one piece missing - G_VALUE_INIT. Patch attached. Now NM
compiles with glib 2.24 (expect the gdbus example in examples/C/glib/
but i just comment that.)

Tom
>From 67a4580e1a28af309dce511ddebc1fca3082 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold 
Date: Tue, 7 Feb 2012 11:20:57 +0100
Subject: [PATCH] libnm-glib: fix missing G_VALUE_INIT to not depend on newer
 glib

---
 include/nm-glib-compat.h  |5 +
 libnm-glib/nm-active-connection.c |1 +
 libnm-glib/nm-device.c|1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h
index c404ca6..30b83e0 100644
--- a/include/nm-glib-compat.h
+++ b/include/nm-glib-compat.h
@@ -23,6 +23,7 @@
 #ifndef NM_GLIB_COMPAT_H
 #define NM_GLIB_COMPAT_H
 
+
 #include 
 
 #if !GLIB_CHECK_VERSION(2,31,0)
@@ -30,6 +31,10 @@
 #define g_value_get_schar g_value_get_char
 #endif
 
+#if !GLIB_CHECK_VERSION(2,30,0)
+#define G_VALUE_INIT  { 0, { { 0 } } }
+#endif
+
 #if !GLIB_CHECK_VERSION(2,28,0)
 #define g_simple_async_result_take_error(result, error) \
 	G_STMT_START { \
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index 9c5be58..9002d84 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -31,6 +31,7 @@
 #include "nm-device-private.h"
 #include "nm-connection.h"
 #include "nm-vpn-connection.h"
+#include "nm-glib-compat.h"
 
 static GType nm_active_connection_type_for_path (DBusGConnection *connection,
  const char *path);
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index 2a1e58f..408e912 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -38,6 +38,7 @@
 #include "nm-object-cache.h"
 #include "nm-marshal.h"
 #include "nm-dbus-glib-types.h"
+#include "nm-glib-compat.h"
 
 static GType nm_device_type_for_path (DBusGConnection *connection,
   const char *path);
-- 
1.7.8.3

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


[PATCH] core: fix singleton handling in NULL/systemd session monitor

2012-02-04 Thread Thomas Bechtold
---
 src/nm-session-monitor-null.c|4 +++-
 src/nm-session-monitor-systemd.c |4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/nm-session-monitor-null.c b/src/nm-session-monitor-null.c
index ec33bef..14d756f 100644
--- a/src/nm-session-monitor-null.c
+++ b/src/nm-session-monitor-null.c
@@ -84,7 +84,9 @@ nm_session_monitor_get (void)
if (singleton)
return g_object_ref (singleton);
 
-   return NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, 
NULL));
+   singleton = NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, 
NULL));
+   assert (singleton);
+   return singleton;
 }
 
 /* 

 */
diff --git a/src/nm-session-monitor-systemd.c b/src/nm-session-monitor-systemd.c
index ae09494..8fe73ae 100644
--- a/src/nm-session-monitor-systemd.c
+++ b/src/nm-session-monitor-systemd.c
@@ -195,7 +195,9 @@ nm_session_monitor_get (void)
if (singleton)
return g_object_ref (singleton);
 
-   return NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, 
NULL));
+   singleton = NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, 
NULL));
+   assert (singleton);
+   return singleton;
 }
 
 gboolean
-- 
1.7.8.3

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


libnm-glib 0.9 depends on glib 2.28 now

2012-02-04 Thread Thomas Bechtold
Hi,

i tried to build NM 0.9 with glib 2.24 but got the following errors:

nm-object.c: In function 'init_async_got_properties':
nm-object.c:160: error: implicit declaration of function
'g_simple_async_result_take_error'
nm-object.c: In function 'object_created':
nm-object.c:605: error: implicit declaration of function
'g_clear_object'


'g_simple_async_result_take_error' was introduced with commit 9fd98ef9
'g_clear_object' was introduced with commit cc90f101


Was this intended?


Cheers,

Tom







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


[PATCH] libnm-util: allow empty number for gsm settings

2012-02-02 Thread Thomas Bechtold
---
 libnm-util/nm-setting-gsm.c |   14 --
 libnm-util/tests/test-general.c |   23 +++
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c
index 80d3fd3..19c59f2 100644
--- a/libnm-util/nm-setting-gsm.c
+++ b/libnm-util/nm-setting-gsm.c
@@ -292,20 +292,6 @@ verify (NMSetting *setting, GSList *all_settings, GError 
**error)
 {
NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (setting);
 
-   if (!priv->number) {
-   g_set_error (error,
-NM_SETTING_GSM_ERROR,
-NM_SETTING_GSM_ERROR_MISSING_PROPERTY,
-NM_SETTING_GSM_NUMBER);
-   return FALSE;
-   } else if (!strlen (priv->number)) {
-   g_set_error (error,
-NM_SETTING_GSM_ERROR,
-NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
-NM_SETTING_GSM_NUMBER);
-   return FALSE;
-   }
-
if (priv->apn) {
guint32 apn_len = strlen (priv->apn);
guint32 i;
diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c
index c4c696f..c8d392c 100644
--- a/libnm-util/tests/test-general.c
+++ b/libnm-util/tests/test-general.c
@@ -444,6 +444,28 @@ test_setting_gsm_apn_underscore (void)
g_assert (success == TRUE);
 }
 
+static void
+test_setting_gsm_without_number (void)
+{
+   NMSettingGsm *s_gsm;
+   GError *error = NULL;
+   gboolean success;
+
+   s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
+   g_assert (s_gsm);
+
+   g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, NULL, NULL);
+   success = nm_setting_verify (NM_SETTING (s_gsm), NULL, &error);
+   g_assert_no_error (error);
+   g_assert (success == TRUE);
+
+   g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "", NULL);
+   success = nm_setting_verify (NM_SETTING (s_gsm), NULL, &error);
+   g_assert_no_error (error);
+   g_assert (success == TRUE);
+
+}
+
 static NMSettingWirelessSecurity *
 make_test_wsec_setting (const char *detail)
 {
@@ -1359,6 +1381,7 @@ int main (int argc, char **argv)
test_setting_gsm_apn_spaces ();
test_setting_gsm_apn_bad_chars ();
test_setting_gsm_apn_underscore ();
+   test_setting_gsm_without_number ();
test_setting_to_hash_all ();
test_setting_to_hash_no_secrets ();
test_setting_to_hash_only_secrets ();
-- 
1.7.8.3

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


GSM Settings verification doc or code wrong

2012-01-31 Thread Thomas Bechtold

Hi,

i use NM 0.8.6 and try to set a blank gsm number in NM settings.

on [1] and [2] is written for GSM setting:
"""... Many modems do not require PPP for connections to the mobile 
network and thus this property should be left blank, which allows 
NetworkManager to select the appropriate settings automatically."""


So i tried to leave the number blank but then nm_connection_verify failed.
The reason is in nm-util/nm-setting-gsm.c:verify() (the code is in 0.8.6 
and 0.9 equal):


if (!priv->number) {
g_set_error (error,
 NM_SETTING_GSM_ERROR,
 NM_SETTING_GSM_ERROR_MISSING_PROPERTY,
 NM_SETTING_GSM_NUMBER);
return FALSE;
} else if (!strlen (priv->number)) {
g_set_error (error,
 NM_SETTING_GSM_ERROR,
 NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
 NM_SETTING_GSM_NUMBER);
return FALSE;
}



So what is right? Is a blank number allowed or not? I'm willing to 
prepare a patch to fix this but i first need to know what the correct 
behavior should be.



Cheers,

Tom


[1] 
http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html
[2] 
http://projects.gnome.org/NetworkManager/developers/api/09/ref-settings.html


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


[PATCH] core: add property "StateReason" to NMDevice

2012-01-29 Thread Thomas Bechtold
Remember the NMDeviceStateReason for a NMDeviceState in
NMDevicePrivate. This allows everybody to get a NMDevice StateReason
without listen to nm_device_state_changed signals.
---
 introspection/nm-device.xml |   17 +
 src/nm-device.c |   21 +
 src/nm-device.h |1 +
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml
index 2f3aa8f..4f88d27 100644
--- a/introspection/nm-device.xml
+++ b/introspection/nm-device.xml
@@ -51,6 +51,11 @@
 The current state of the device.
   
 
+
+  
+The current state and state-reason of the device.
+  
+
 
   
 Object path of an ActiveConnection object that "owns" this device 
during
@@ -498,5 +503,17 @@
   
 
 
+
+  
+
+  The Device state.
+
+  
+  
+
+  The Device state reason.
+
+  
+
   
 
diff --git a/src/nm-device.c b/src/nm-device.c
index e0c8d01..d535f78 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -66,6 +66,8 @@ static void impl_device_disconnect (NMDevice *device, 
DBusGMethodInvocation *con
 #define PENDING_IP4_CONFIG "pending-ip4-config"
 #define PENDING_IP6_CONFIG "pending-ip6-config"
 
+#define DBUS_G_TYPE_UINT_STRUCT (dbus_g_type_get_struct ("GValueArray", 
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID))
+
 /***/
 typedef enum {
NM_DEVICE_ERROR_CONNECTION_ACTIVATING = 0,
@@ -131,6 +133,7 @@ enum {
PROP_IP6_CONFIG,
PROP_DHCP6_CONFIG,
PROP_STATE,
+   PROP_STATE_REASON,
PROP_ACTIVE_CONNECTION,
PROP_DEVICE_TYPE,
PROP_MANAGED,
@@ -164,6 +167,7 @@ typedef struct {
gboolean initialized;
 
NMDeviceState state;
+   NMDeviceStateReason state_reason;
QueuedState   queued_state;
 
char *udi;
@@ -273,6 +277,7 @@ nm_device_init (NMDevice *self)
priv->type = NM_DEVICE_TYPE_UNKNOWN;
priv->capabilities = NM_DEVICE_CAP_NONE;
priv->state = NM_DEVICE_STATE_UNMANAGED;
+   priv->state_reason = NM_DEVICE_STATE_REASON_NONE;
priv->dhcp_timeout = 0;
priv->rfkill_type = RFKILL_TYPE_UNKNOWN;
 }
@@ -3693,6 +3698,14 @@ get_property (GObject *object, guint prop_id,
case PROP_STATE:
g_value_set_uint (value, priv->state);
break;
+   case PROP_STATE_REASON:
+   g_value_set_boxed (value,
+   
dbus_g_type_specialized_construct (DBUS_G_TYPE_UINT_STRUCT));
+   dbus_g_type_struct_set (value,
+   0, priv->state,
+   1, 
priv->state_reason,
+   G_MAXUINT);
+   break;
case PROP_ACTIVE_CONNECTION:
if (priv->act_request)
ac_path = nm_act_request_get_active_connection_path 
(priv->act_request);
@@ -3832,6 +3845,13 @@ nm_device_class_init (NMDeviceClass *klass)
"State",
0, G_MAXUINT32, NM_DEVICE_STATE_UNKNOWN,
G_PARAM_READABLE));
+   g_object_class_install_property
+   (object_class, PROP_STATE_REASON,
+g_param_spec_boxed (NM_DEVICE_STATE_REASON,
+"StateReason",
+"StateReason",
+
DBUS_G_TYPE_UINT_STRUCT,
+G_PARAM_READABLE));
 
g_object_class_install_property
(object_class, PROP_ACTIVE_CONNECTION,
@@ -4109,6 +4129,7 @@ nm_device_state_changed (NMDevice *device,
 
old_state = priv->state;
priv->state = state;
+   priv->state_reason = reason;
 
nm_log_info (LOGD_DEVICE, "(%s): device state change: %s -> %s (reason 
'%s') [%d %d %d]",
 nm_device_get_iface (device),
diff --git a/src/nm-device.h b/src/nm-device.h
index 9d3f74b..e69b989 100644
--- a/src/nm-device.h
+++ b/src/nm-device.h
@@ -47,6 +47,7 @@
 #define NM_DEVICE_IP6_CONFIG   "ip6-config"
 #define NM_DEVICE_DHCP6_CONFIG "dhcp6-config"
 #define NM_DEVICE_STATE"state"
+#define NM_DEVICE_STATE_REASON "state-reason"
 #define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
 #define NM_DEVICE_DEVICE_TYPE  "device-type" /* ugh */
 #define NM_DEVICE_MANAGED  "managed"
-- 
1.7.8.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 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


Force default gateway for a specific connection?

2012-01-18 Thread Thomas Bechtold

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.


TIA

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


[PATCH] core: add missing device state reasons

2012-01-11 Thread Thomas Bechtold
Some NMDeviceStateReason 's are not available in
introspection/nm-device.xml

Tom


---
 introspection/nm-device.xml |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml
index 5fdda96..2f3aa8f 100644
--- a/introspection/nm-device.xml
+++ b/introspection/nm-device.xml
@@ -476,6 +476,26 @@
   The Bluetooth connection timed out or failed.
 
   
+  
+
+  GSM Modem's SIM Card not inserted.
+
+  
+  
+
+  GSM Modem's SIM Pin required.
+
+  
+  
+
+  GSM Modem's SIM Puk required.
+
+  
+  
+
+  GSM Modem's SIM wrong
+
+  
 
 
   
-- 
1.7.8.3

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


Store NMDeviceStateReason in NMDevicePrivate

2011-12-23 Thread Thomas Bechtold
Hi,

i would like to store the NMDeviceStateReason in NMDevicePrivate.
Currently the NMDeviceStateReason is sent with a signal when the
NMDeviceState changes. I don't want to change this behaviour but
additionally i want to store the NMDeviceStateReason. Then it's possible
to get the Reason for a device state even if you don't catch the
signals.

Comments?


Cheers,

Tom 

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


Re: difference of nm to others

2011-12-04 Thread Thomas Bechtold
On Mon, 2011-12-05 at 10:57 +0530, Harish Mandowara wrote:
> hi all,
> 
> what is the difference between network manager and wpa_supplicant.
> 
> Is network manager internally using wpa_supplicant.

Yes.

Cheers,

Tom

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


Re: device removal signals does not work for me

2011-11-25 Thread Thomas Bechtold

On 25/11/11 11:40, Jirka Klimes wrote:

On Thursday 24 of November 2011 18:21:54 Thomas Bechtold wrote:

Hi Jirka,

thank you very much for the description and the fix. is it possible to
fix this in the 0.8 branch, too?

Cheers,

Tom



It needed some adjustments, but it's been in NM_0_8 too now.


thanks!


Cheers,

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


Re: device removal signals does not work for me

2011-11-24 Thread Thomas Bechtold

Hi Jirka,

thank you very much for the description and the fix. is it possible to 
fix this in the 0.8 branch, too?


Cheers,

Tom

On 24/11/11 17:57, Jirka Klimes wrote:

On Wednesday 23 of November 2011 07:33:07 Thomas Bechtold wrote:

Hi Dan,

any other idea why the example code does not work?




I've look into the problem. It showed up that it is really libnm-glib problem.

DeviceAdded and DeviceRemoved signals are seen in dbus-monitor output. And
they are also delivered to libnm-glib.

However, what was the problem is that NMClient/NMDevice in libnm-glib use lazy
approach and get data from NM over D-Bus only after they are asked for them
(or get them via signals). This is nice in general. However, in case of device
removal, libnm-glib tries to get devices from NM only after receiving
DeviceRemoved signal. But at this point the device is not in NM any more, so
no info is available about it (apart object path received as DeviceRemoved
signal argument).

So, when device is added *before* NMClient runs, NMClient won't have any info
about that. When the device is added *while* NMClient is already running,
libnm-glib will request devices upon DeviceAadded signal and thus the data
will be available later upon DeviceRemoved signal.

I pushed fixes to libnm-glib to correct the behaviour. Now, the device data
are obtained from NM in constructor.
42060fdd897749c79fcc60ac16bb6fa67e4c8fd3
576acdd2bf4cfde11f9b8ea15ec87bb7271c5502

I hope the explanation is understandable.

Jirka

PS:
Dan, one question for you:
NM's NMDevice has ip4-address property, which is not in libnm-glib. So I have
to use a little hack (removing the propery from GetAll()'s reply), so that
NMObject doesn't print errors.
Do you think we should remove "ip4-address" from NM's NMDevice? In my opinion,
"ip4-config" is sufficient and "ip4-address" is redundant now.

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


Re: [PATCH] core: add internet connectivity check

2011-11-22 Thread Thomas Bechtold

Hi Marcel,

On 23/11/11 07:33, Marcel Holtmann wrote:

However if your long term goal is WISPr support, then you have to look
at the whole page anyway. There is no guarantee that the WISPr XML is at
the beginning. Some providers actually just attach it to the end.


personally i don't care about WISPr. I just want to know if i have a
working internet connection.


Doing this without also handling WISPr seems rather pointless. I prefer
my system to automatically log me into a hotspot if I have access
credentials for it.


why do you think that's pointless?
eg i have a embedded device with an usb-gadget (detected as ethernet
device). when i connect my pc with the device over usb, the device has
no internet connection. but when i configure my pc to forward some
traffic from the device, the device has internet connection. for this
usecase it's very nice to check the connectivity.
the device can do different task if a connection is available.


I would solve that entirely different, but fair enough.


would be interessting for me to know your solution for this. but that's 
not the point for NM.


What about a solution with both - header check and content check. we add 
another field to the configuration file. Then we have 3 fields:


- connectivity-uri
- connectivit-response-header
- connectivity-response-content

if no uri is given, the check is disabled.
if only a response-header is given, only the header will be checked
if only a response-content is given, only the content will be checked 
(first with a simple string match. later we can implement something to 
handle WISPr)

if both response-header and response-content are given, we check both.


Cheers,

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


Re: device removal signals does not work for me

2011-11-22 Thread Thomas Bechtold

Hi Dan,

any other idea why the example code does not work?


Cheers,

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


Re: [PATCH] core: add internet connectivity check

2011-11-22 Thread Thomas Bechtold

Hi Marcel,

On 22/11/11 12:21, Marcel Holtmann wrote:

Hi Thomas,


i just want to summarize the discussion about the response handling so
we can decide which solution we want to use.
mentioned solutions are:

1) check http status-response 204 (or any other) (chromiumos method)
2) check content for a specific http header (connman method)
3) check start of content (implemented in patch V3)
4) check complete content
5) check http status-response 200 (creates false positives for hotspots)
6) check content with a regex (tie us into a specific regex lib)

5+6 are already declined.

i prefer solution 3 because it's more flexible than 1) and produce fewer
traffic than 2).


actually 2) would produce fewer traffic than 3) since the HTTP headers
are transmitted before the content.


You are right. i mixed up http headers with html headers.


If you just want some stupid check, then looking at the headers is
simpler since otherwise you have to deal with HTTP 1.0 vs 1.1 and have
to have support for chunked encoding.


i'm not sure but i think libsoup handles 1.0/1.1 and chunked encoding.

i like the idea of a plain text file because it's more easy to setup on
server side than http headers.


creating server side HTTP headers is as simple as plain text files. We
decided for the HTTP headers since it a lot more logical then doing some
random plain file comparison.


if you have a managed server (without root access) i think it's not so 
easy to send http headers but it's simple to deliver a plain text file.



Actually the HTTP header makes a lot more sense since once you received
the valid one, you can just terminate the HTTP request and do not have
to deal with downloading the whole file. Keep in mind that some hotspots
have a lot of HTML in there. In case you care on how fast your overall
connection setup time is. If you don't, then it does not matter of
course.


right. imo the speed/traffic is an important argument.




However if your long term goal is WISPr support, then you have to look
at the whole page anyway. There is no guarantee that the WISPr XML is at
the beginning. Some providers actually just attach it to the end.


personally i don't care about WISPr. I just want to know if i have a
working internet connection.


Doing this without also handling WISPr seems rather pointless. I prefer
my system to automatically log me into a hotspot if I have access
credentials for it.


why do you think that's pointless?
eg i have a embedded device with an usb-gadget (detected as ethernet 
device). when i connect my pc with the device over usb, the device has 
no internet connection. but when i configure my pc to forward some 
traffic from the device, the device has internet connection. for this 
usecase it's very nice to check the connectivity.

the device can do different task if a connection is available.

Cheers,

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


Re: [PATCH] core: add internet connectivity check

2011-11-22 Thread Thomas Bechtold

Hi Marcel,

On 22/11/11 08:55, Marcel Holtmann wrote:

Hi Thomas,


i just want to summarize the discussion about the response handling so
we can decide which solution we want to use.
mentioned solutions are:

1) check http status-response 204 (or any other) (chromiumos method)
2) check content for a specific http header (connman method)
3) check start of content (implemented in patch V3)
4) check complete content
5) check http status-response 200 (creates false positives for hotspots)
6) check content with a regex (tie us into a specific regex lib)

5+6 are already declined.

i prefer solution 3 because it's more flexible than 1) and produce fewer
traffic than 2).


actually 2) would produce fewer traffic than 3) since the HTTP headers
are transmitted before the content.


You are right. i mixed up http headers with html headers.


If you just want some stupid check, then looking at the headers is
simpler since otherwise you have to deal with HTTP 1.0 vs 1.1 and have
to have support for chunked encoding.


i'm not sure but i think libsoup handles 1.0/1.1 and chunked encoding.

i like the idea of a plain text file because it's more easy to setup on 
server side than http headers.



However if your long term goal is WISPr support, then you have to look
at the whole page anyway. There is no guarantee that the WISPr XML is at
the beginning. Some providers actually just attach it to the end.


personally i don't care about WISPr. I just want to know if i have a 
working internet connection.



Cheers,

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


Re: [PATCH] core: add internet connectivity check

2011-11-21 Thread Thomas Bechtold
Hi,

i just want to summarize the discussion about the response handling so
we can decide which solution we want to use.
mentioned solutions are:

1) check http status-response 204 (or any other) (chromiumos method)
2) check content for a specific http header (connman method)
3) check start of content (implemented in patch V3)
4) check complete content
5) check http status-response 200 (creates false positives for hotspots)
6) check content with a regex (tie us into a specific regex lib)

5+6 are already declined.

i prefer solution 3 because it's more flexible than 1) and produce fewer
traffic than 2).


Cheers,

Tom

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


Re: [PATCH] core: add internet connectivity check

2011-11-17 Thread Thomas Bechtold
Hi Marcel,

On Fri, 2011-11-18 at 06:52 +0100, Marcel Holtmann wrote:
> > > within ConnMan we decided to go for a vendor-header with a specific
> > > value within the HTTP response. That way we are keeping the HTTP
> > > response code and don't have to define a magic one.
> > 
> > I don't understand this. Has connman a database with vendor-headers and
> > should every vendor set a specific http header in the response?
> 
> what don't you understand? We return X-ConnMan-Status HTTP header and so
> can determine this way if we are connected to the Internet or not.

ok. i was a bit confused. thanks.

Tom


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


Re: [PATCH] core: add internet connectivity check

2011-11-16 Thread Thomas Bechtold
Hi Marcel,

On Thu, 2011-11-17 at 10:07 +0900, Marcel Holtmann wrote:
> within ConnMan we decided to go for a vendor-header with a specific
> value within the HTTP response. That way we are keeping the HTTP
> response code and don't have to define a magic one.

I don't understand this. Has connman a database with vendor-headers and
should every vendor set a specific http header in the response?

Cheers,

Tom



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


Re: [PATCH] core: add internet connectivity check - V3

2011-11-16 Thread Thomas Bechtold
Hi,

On Wed, 2011-11-16 at 00:19 -0600, Dan Williams wrote:
> Pretty much what I was thinking about, but I wonder what we should do
> for the expected response.  I'm not sure a regex is the right way to go
> at the moment because regex libraries differ in syntax and that might
> tie us into a specific one.  But regex is powerful :)  I think maybe for
> the moment we should just specify that it's a string match.  Then later
> when more intelligently handling hotspot perhaps we'll do regexes.

i use g_str_has_prefix() now to compare the response with the expected
response.
Try it with:

NetworkManager --no-daemon --log-domains=CORE --log-level=DEBUG
--connectivity-uri=http://toabctl.de/conntest.txt
--connectivity-response=HelloNM


Cheers,

Tom
>From b04fe037a5ab994d62943402874a2adba24012ef Mon Sep 17 00:00:00 2001
From: Thomas Bechtold 
Date: Fri, 21 Oct 2011 21:21:30 +0200
Subject: [PATCH] core: add internet connectivity check

* use libsoup to compare a http response from a given
  uri with a given response (use g_str_has_prefix () to compare)
* do periodically check the connectivity. Check interval is configurable
* check connectivity when device state change
  from/to NM_DEVICE_STATE_ACTIVATED
---
 configure.ac  |4 +
 src/Makefile.am   |6 +-
 src/main.c|   14 ++-
 src/nm-config.c   |   66 +-
 src/nm-config.h   |6 +
 src/nm-connectivity.c |  349 +
 src/nm-connectivity.h |   69 ++
 src/nm-manager.c  |   84 ++--
 src/nm-manager.h  |5 +-
 9 files changed, 583 insertions(+), 20 deletions(-)
 create mode 100644 src/nm-connectivity.c
 create mode 100644 src/nm-connectivity.h

diff --git a/configure.ac b/configure.ac
index 8d57f71..a68ec63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -283,6 +283,10 @@ PKG_CHECK_MODULES(GIO, gio-2.0)
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
+PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26])
+AC_SUBST(LIBSOUP_CFLAGS)
+AC_SUBST(LIBSOUP_LIBS)
+
 GOBJECT_INTROSPECTION_CHECK([0.9.6])
 
 # Qt4
diff --git a/src/Makefile.am b/src/Makefile.am
index c46e5e8..d11fbd4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -187,7 +187,9 @@ NetworkManager_SOURCES = \
 		nm-dhcp6-config.h \
 		nm-rfkill.h \
 		nm-session-monitor.c \
-		nm-session-monitor.h
+		nm-session-monitor.h \
+		nm-connectivity.c \
+		nm-connectivity.h
 
 nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml
 	$(AM_V_GEN) dbus-binding-tool --prefix=nm_access_point --mode=glib-server --output=$@ $<
@@ -250,6 +252,7 @@ NetworkManager_CPPFLAGS = \
 	$(LIBNL_CFLAGS) \
 	$(GMODULE_CFLAGS) \
 	$(POLKIT_CFLAGS) \
+	$(LIBSOUP_CFLAGS) \
 	-DG_DISABLE_DEPRECATED \
 	-DBINDIR=\"$(bindir)\" \
 	-DSBINDIR=\"$(sbindir)\" \
@@ -290,6 +293,7 @@ NetworkManager_LDADD = \
 	$(LIBNL_LIBS) \
 	$(GMODULE_LIBS) \
 	$(POLKIT_LIBS) \
+	$(LIBSOUP_LIBS) \
 	$(LIBM) \
 	$(LIBDL)
 
diff --git a/src/main.c b/src/main.c
index 26fa28f..4b92e2d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -420,6 +420,9 @@ main (int argc, char *argv[])
 	char *pidfile = NULL, *state_file = NULL;
 	char *config_path = NULL, *plugins = NULL;
 	char *log_level = NULL, *log_domains = NULL;
+	char *connectivity_uri = NULL;
+	gint connectivity_interval = -1;
+	char *connectivity_response = NULL;
 	gboolean wifi_enabled = TRUE, net_enabled = TRUE, wwan_enabled = TRUE, wimax_enabled = TRUE;
 	gboolean success, show_version = FALSE;
 	NMPolicy *policy = NULL;
@@ -449,6 +452,9 @@ main (int argc, char *argv[])
 		"   WIFI_SCAN,IP4,IP6,AUTOIP4,DNS,VPN,SHARING,SUPPLICANT,\n"
 		"   AGENTS,SETTINGS,SUSPEND,CORE,DEVICE,OLPC,WIMAX]",
 		"HW,RFKILL,WIFI" },
+		{ "connectivity-uri", 0, 0, G_OPTION_ARG_STRING, &connectivity_uri, "A http(s) address to check internet connectivity" },
+		{ "connectivity-interval", 0, 0, G_OPTION_ARG_INT, &connectivity_interval, "the interval in seconds how often a connectivity check will be done" },
+		{ "connectivity-response", 0, 0, G_OPTION_ARG_STRING, &connectivity_response, "the expected start of the response" },
 		{NULL}
 	};
 
@@ -503,7 +509,8 @@ main (int argc, char *argv[])
 		exit (1);
 
 	/* Read the config file and CLI overrides */
-	config = nm_config_new (config_path, plugins, log_level, log_domains, &error);
+	config = nm_config_new (config_path, plugins, log_level, log_domains,
+			connectivity_uri, connectivity_interval, connectivity_response, &error);
 	if (config == NULL) {
 		fprintf (stderr, "Failed to read configuration: (%d) %s\n",
 		 error ? error->code : -1,
@@ -637,6 +644,9 @@ main (int argc, char *argv[])
 	  wifi_enabled,
 	   

Re: [PATCH] core: add internet connectivity check

2011-11-16 Thread Thomas Bechtold

On 16/11/11 07:19, Dan Williams wrote:

to test the connectivity check, do eg:

./NetworkManager --no-daemon --log-level=DEBUG --log-domains=CORE
--connectivity-uri=http://toabctl.de
--connectivity-response="toabctl.de"


Pretty much what I was thinking about, but I wonder what we should do
for the expected response.  I'm not sure a regex is the right way to go
at the moment because regex libraries differ in syntax and that might
tie us into a specific one.  But regex is powerful :)  I think maybe for
the moment we should just specify that it's a string match.


you mean just (g_strcmp0 (defined_string, response_string) == 0) ? 
That's it?


Cheers,

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


Re: device removal signals does not work for me

2011-11-16 Thread Thomas Bechtold

On 15/11/11 19:50, Dan Williams wrote:

dbus-monitor 
"type='signal',sender='org.freedesktop.NetworkManager',interface='org.freedesktop.NetworkManager'"


see output (with kernel debug messages in between). So 'DeviceRemoved' 
signals are sent. Then the problem is in NMClient?


Cheers,

Tom

 output 
usb 1-2: USB disconnect, address 10
MOSCHIP usb-ethernet driver 1-2:1.0: eth0: unregister 'MOSCHIP 
usb-ethernet driver' usb-at91-2, MOSCHIP 7830/7730 usb-NET adapter
signal sender=:1.104 -> dest=(null destination) serial=109 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=StateChanged

   uint32 4
signal sender=:1.104 -> dest=(null destination) serial=110 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=StateChange

   uint32 4
signal sender=:1.104 -> dest=(null destination) serial=116 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=DeviceRemoved

   object path "/org/freedesktop/NetworkManager/Devices/0"
signal sender=:1.104 -> dest=(null destination) serial=117 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=PropertiesChanged

   array [
  dict entry(
 string "State"
 variant uint32 4
  )
  dict entry(
 string "ActiveConnections"
 variant array [
]
  )
   ]
usb 1-2: new full speed USB device using at91_ohci and address 14
usb 1-2: New USB device found, idVendor=9710, idProduct=7830
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2: Product: USB-MAC Controller
usb 1-2: Manufacturer: Moschip Semiconductor
usb 1-2: SerialNumber: 3b000e66
usb 1-2: applying rev.C fixup
usb 1-2: applying rev.C fixup
MOSCHIP usb-ethernet driver 1-2:1.0: eth0: register 'MOSCHIP 
usb-ethernet driver' at usb-at91-2, MOSCHIP 7830/7730 usb-NET adapter, 
00:13:3b:00:0e:66
signal sender=:1.104 -> dest=(null destination) serial=122 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=DeviceAdded

   object path "/org/freedesktop/NetworkManager/Devices/4"
signal sender=:1.104 -> dest=(null destination) serial=125 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=PropertiesChanged

   array [
  dict entry(
 string "ActiveConnections"
 variant array [
]
  )
   ]
signal sender=:1.104 -> dest=(null destination) serial=126 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=StateChanged

   uint32 2
signal sender=:1.104 -> dest=(null destination) serial=127 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=StateChange

   uint32 2
signal sender=:1.104 -> dest=(null destination) serial=130 
path=/org/freedesktop/NetworkManager; 
interface=org.freedesktop.NetworkManager; member=PropertiesChanged

   array [
  dict entry(
 string "State"
 variant uint32 2
  )
  dict entry(
 string "ActiveConnections"
 variant array [
   object path 
"/org/freedesktop/NetworkManager/ActiveConnection/1"

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


device removal signals does not work for me

2011-11-15 Thread Thomas Bechtold

Hi,

i wrote a small program to test the NMClient signals (see attachment).
When i have a usb-ethernet adapter attached, start the program and 
remove the device, there is no "device-removed" signal sent.


When i replug the adapter, and then remove the adapter again, the signal 
is sent.


Why is there no signal after the first removal? Maybe i miss something 
in the code?


Here is the output of the program (with some kernel debug messages in 
between):


# ./nm-test
start test...
start mainloop ...
usb 1-2: USB disconnect, address 9
MOSCHIP usb-ethernet driver 1-2:1.0: eth0: unregister 'MOSCHIP 
usb-ethernet driver' usb-at91-2, MOSCHIP 7830/7730 usb-NET adapter

client state changed to: 4
active connections changed
usb 1-2: new full speed USB device using at91_ohci and address 11
usb 1-2: New USB device found, idVendor=9710, idProduct=7830
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2: Product: USB-MAC Controller
usb 1-2: Manufacturer: Moschip Semiconductor
usb 1-2: SerialNumber: 3b000e66
usb 1-2: applying rev.C fixup
usb 1-2: applying rev.C fixup
MOSCHIP usb-ethernet driver 1-2:1.0: eth0: register 'MOSCHIP 
usb-ethernet driver' at usb-at91-2, MOSCHIP 7830/7730 usb-NET adapter, 
00:13:3b:00:0e:66
device added: 
'/sys/devices/platform/at91_ohci/usb1/1-2/1-2:1.0/net/eth0' (eth0)

active connections changed
client state changed to: 2
usb 1-2: USB disconnect, address 11
MOSCHIP usb-ethernet driver 1-2:1.0: eth0: unregister 'MOSCHIP 
usb-ethernet driver' usb-at91-2, MOSCHIP 7830/7730 usb-NET adapter
device removed: 
'/sys/devices/platform/at91_ohci/usb1/1-2/1-2:1.0/net/eth0' (eth0)

client state changed to: 4
active connections changed






Cheers,

Tom


/**
 * Test the NMClient signals:
 * Author: Thomas Bechtold  
 * License: GPL-2 (or any newer version)
 *
 * compile with: 
 * gcc `pkg-config --libs --cflags glib-2.0 gobject-2.0 libnm-util libnm-glib` nm-test.c -o nm-test
 * or cross compile for arm with:
 * PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig /usr/bin/arm-linux-gnueabi-gcc `pkg-config --libs --cflags glib-2.0 gobject-2.0 libnm-util libnm-glib` nm-test.c -o nm-test
 *
 */

#include 
#include 
#include 

#include 
//#include 
#include 

static GMainLoop* loop = NULL;
static NMClient* nm_client = NULL;



static void
client_active_connections_changed (NMClient *client, GParamSpec *pspec, gpointer user_data)
{
	printf ("active connections changed\n");
}


static void
client_state_changed (NMClient *client, GParamSpec *pspec, gpointer user_data)
{
	NMState state = nm_client_get_state (client);
	printf ("client state changed to: %i\n", state);
}


static void
client_device_added (NMClient *client, GObject  *device, gpointer  user_data)
{
	NMDevice *dev = NM_DEVICE (device);

	const gchar* udi = nm_device_get_udi (dev);
	const gchar* iface = nm_device_get_iface (dev);

	printf ("device added: '%s' (%s)\n", udi, iface);

}

static void
client_device_removed (NMClient *client, GObject  *device, gpointer  user_data)
{
	NMDevice *dev = NM_DEVICE (device);

	const gchar* udi = nm_device_get_udi (dev);
	const gchar* iface = nm_device_get_iface (dev);

	printf ("device removed: '%s' (%s)\n", udi, iface);

}


int
main (void)
{
	printf ("start test...\n");
	g_type_init();

	nm_client = nm_client_new ();
	if (!nm_client)
	{
		printf ("can not get NMClient");
		exit (-1);
	}

	g_signal_connect (nm_client, "notify::active-connections",
	  G_CALLBACK (client_active_connections_changed),
	  NULL);
	g_signal_connect (nm_client, "notify::state",
	  G_CALLBACK (client_state_changed),
	  NULL);
	g_signal_connect (nm_client, "device-added",
			  G_CALLBACK (client_device_added),
			  NULL);
	g_signal_connect (nm_client, "device-removed",
			  G_CALLBACK (client_device_removed),
			  NULL);
	
	printf ("start mainloop ...\n");
	loop = g_main_loop_new (NULL, FALSE);
	g_main_loop_run (loop);
	
}
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Initial state of modems

2011-11-15 Thread Thomas Bechtold

Hi,

i use a Fasttrack xTend FXT009 with an external power supply.
i use MM on an embedded device and the modem is connected over usb.
When i have an active connection with the modem, remove the power from 
the embedded device (so MM has no chance to cleanup anything) and then i 
restart the embedded device (and MM also restarts), MM can not handle 
the modem because the modem is still in connection mode.
i talked to aleksander on irc and a simple solution is to send "+++" 
before any other at-command.

any problems expected with this solution?

Cheers,

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


Re: Wrong SIM-Pin not detected by MM?

2011-11-15 Thread Thomas Bechtold

On 15/11/11 09:19, Uwe Geuder wrote:

On 15 November 2011 09:55, Thomas Bechtold  wrote:


MM can handle different modems. Not only modems included in phones. eg.
usb-umts-modems aks for the sim pin.



Absolutely. But in your first message you had a example for MM PIN handling
from an N900. Because N900 is a phone I did not understand how the
example could be relevant.


You start your phone, press the "Skip" button without entering the PIN 
code and then you try to use your phone with MM.

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


Re: Subject: Wrong SIM-Pin not detected by MM?

2011-11-14 Thread Thomas Bechtold

Hi Uwe,

On 15/11/11 08:42, Uwe Geuder wrote:

Ok. Then my general remark would be: Aren't all phones used like that,
that they are first powered on and registered to the network? So the
PIN is entered using the UI of the phone before MM gets involved.


MM can handle different modems. Not only modems included in phones. eg. 
usb-umts-modems aks for the sim pin.


Cheers,

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


Re: [PATCH] modem: map modemmanager errors more detailed

2011-11-14 Thread Thomas Bechtold

On 15/11/11 00:32, Dan Williams wrote:

- in NM/include/NetworkManager.h are some NMDeviceStateReason defined
   which are never used. eg NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE,
   NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER,
   NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED,
   NM_DEVICE_STATE_REASON_GSM_APN_FAILED,
   NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED
   maybe there are some more unused NMDeviceStateReason.
   Why are these reason available?


Because we thought they'd be used, but turned out they aren't used yet.
Some of them just never got hooked up.


Then we should remove the Reasons for the 1.0 release, right?


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


Re: Subject: Wrong SIM-Pin not detected by MM?

2011-11-14 Thread Thomas Bechtold

Hi,

On 15/11/11 08:06, Uwe Geuder wrote:

On 13 November 2011 19:49, Thomas Bechtold  wrote:


i tried NM 0.9 (latest from git) with MM 0.5 (from ubuntu 11.10) and
recognized that MM does not detect a wrong SIM-Pin (with a Nokia N900).
i used a wrong Pin (1234) and got the attached NM logs when i tried to
activate the connection with "nmcli con up id simyo".


I have used N900 with NM many times before. Only with 0.8.x though and
only with the graphical applets (both GNOME and KDE).

I don't understand what you (or the software) want to do with the PIN
code at all.


i just tested with a N900.It's more a general question and not a 
specific problem with the N900.


Cheers,

Tom

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


[PATCH] modem: map modemmanager errors more detailed

2011-11-13 Thread Thomas Bechtold
Hi,

attached is a patch to handle some ModemManager errors more detailed.
But i still have some questions about the code and i'm not sure if this
patch is the correct way to solve the problem that NM does not know the
exact reason why a modem connection fails.
Here are my questions:

- should NM have a NMDeviceStateReason for every MM error 
  or should some MM errors be combined to one NMDeviceStateReason?
- in NM/include/NetworkManager.h are some NMDeviceStateReason defined 
  which are never used. eg NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE, 
  NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER, 
  NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED, 
  NM_DEVICE_STATE_REASON_GSM_APN_FAILED, 
  NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED
  maybe there are some more unused NMDeviceStateReason. 
  Why are these reason available?


Cheers,

Tom




* add 4 new NMDeviceStateReason to map ModemManager errors more detailed
* fix wrong error mapping for MM_MODEM_CONNECT_ERROR_NO_DIALTONE
---
 include/NetworkManager.h |   12 +++
 src/modem-manager/nm-modem-gsm.c |   65 -
 src/nm-device.c  |8 +
 3 files changed, 69 insertions(+), 16 deletions(-)

diff --git a/include/NetworkManager.h b/include/NetworkManager.h
index 4755f30..eb72564 100644
--- a/include/NetworkManager.h
+++ b/include/NetworkManager.h
@@ -463,6 +463,18 @@ typedef enum {
/* The Bluetooth connection failed or timed out */
NM_DEVICE_STATE_REASON_BT_FAILED = 44,
 
+   /* GSM Modem's SIM Card not inserted */
+   NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED = 45,
+
+   /* GSM Modem's SIM Pin required */
+   NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED = 46,
+
+   /* GSM Modem's SIM Puk required */
+   NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED = 47,
+
+   /* GSM Modem's SIM wrong */
+   NM_DEVICE_STATE_REASON_GSM_SIM_WRONG = 48,
+
/* Unused */
NM_DEVICE_STATE_REASON_LAST = 0x
 } NMDeviceStateReason;
diff --git a/src/modem-manager/nm-modem-gsm.c b/src/modem-manager/nm-modem-gsm.c
index 9a96ae9..777b2e2 100644
--- a/src/modem-manager/nm-modem-gsm.c
+++ b/src/modem-manager/nm-modem-gsm.c
@@ -140,20 +140,34 @@ translate_mm_error (GError *error)
 
if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_NO_CARRIER))
reason = NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER;
-   if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_NO_DIALTONE))
-   reason = NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT;
-   if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_BUSY))
+   else if (dbus_g_error_has_name (error, 
MM_MODEM_CONNECT_ERROR_NO_DIALTONE))
+   reason = NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE;
+   else if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_BUSY))
reason = NM_DEVICE_STATE_REASON_MODEM_BUSY;
-   if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_NO_ANSWER))
+   else if (dbus_g_error_has_name (error, 
MM_MODEM_CONNECT_ERROR_NO_ANSWER))
reason = NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT;
-   if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NETWORK_NOT_ALLOWED))
+   else if (dbus_g_error_has_name (error, 
MM_MODEM_ERROR_NETWORK_NOT_ALLOWED))
reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED;
-   if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NETWORK_TIMEOUT))
+   else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NETWORK_TIMEOUT))
reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT;
-   if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NO_NETWORK))
+   else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NO_NETWORK))
reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING;
+   else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_NOT_INSERTED))
+   reason = NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED;
+   else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN))
+   reason = NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED;
+   else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PUK))
+   reason = NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED;
+   else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_WRONG))
+   reason = NM_DEVICE_STATE_REASON_GSM_SIM_WRONG;
+   else
+   {
+   /* unable to map the ModemManager error to a 
NM_DEVICE_STATE_REASON */
+   nm_log_dbg (LOGD_MB, "unmapped dbus error detected: '%s'", 
dbus_g_error_get_name (error));
+   reason = NM_DEVICE_STATE_REASON_UNKNOWN;
+   }
 
-   /* FIXME: We have only GSM error messages here, and we have no idea 
which 
+   /* FIXME: We have only GSM error messages here, and we have no idea 
which
   activation state failed. Reasons like:
   NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED,
   NM_DEVICE_STATE_REASON_MODEM_INIT

Wrong SIM-Pin not detected by MM?

2011-11-13 Thread Thomas Bechtold
Hi,

i tried NM 0.9 (latest from git) with MM 0.5 (from ubuntu 11.10) and
recognized that MM does not detect a wrong SIM-Pin (with a Nokia N900).
i used a wrong Pin (1234) and got the attached NM logs when i tried to
activate the connection with "nmcli con up id simyo".

NM output this: "GSM PIN unlock failed: (32) Unknown error". I think to
get a correct error mm_serial_parser_v1_parse () should handle the
serial response for 'AT+CPIN="1234"' correct. But currently i get:

# MM log 
[mm-at-serial-port.c:298] debug_log(): (ttyACM0): --> 'AT
+CPIN="1234"'
[mm-at-serial-port.c:298] debug_log(): (ttyACM0): <--
'ERROR'
[mm-serial-parsers.c:412] mm_serial_parser_v1_parse(): Got failure code
100: Unknown error


Are there any reasons why this response is not handled as an known
error? eg as MM_MOBILE_ERROR_WRONG_SIM_PIN.

Cheers,

Tom



# NM log 
NetworkManager[32314]:  Activation (ttyACM0) starting connection
'simyo'
NetworkManager[32314]:  (ttyACM0): device state change:
disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[32314]:  Activation (ttyACM0) Stage 1 of 5 (Device
Prepare) scheduled...
NetworkManager[32314]:  Activation (ttyACM0) Stage 1 of 5 (Device
Prepare) started...
NetworkManager[32314]:  (ttyACM0): device state change: prepare ->
need-auth (reason 'none') [40 60 0]
NetworkManager[32314]:  Activation (ttyACM0) Stage 1 of 5 (Device
Prepare) complete.
NetworkManager[32314]:  Activation (ttyACM0) Stage 1 of 5 (Device
Prepare) scheduled...
NetworkManager[32314]:  Activation (ttyACM0) Stage 1 of 5 (Device
Prepare) started...
NetworkManager[32314]:  (ttyACM0): device state change: need-auth
-> prepare (reason 'none') [60 40 0]
NetworkManager[32314]:  Activation (ttyACM0) Stage 1 of 5 (Device
Prepare) complete.
NetworkManager[32314]:  GSM modem enable failed: (32) SIM PIN
required
NetworkManager[32314]:  GSM PIN unlock failed: (32) Unknown error
NetworkManager[32314]:  unmapped dbus error detected:
'org.freedesktop.ModemManager.Modem.Gsm.Unknown'
NetworkManager[32314]:  (ttyACM0): device state change: prepare ->
failed (reason 'modem-init-failed') [40 120 28]
NetworkManager[32314]:  Activation (ttyACM0) failed.
NetworkManager[32314]:  (ttyACM0): device state change: failed ->
disconnected (reason 'none') [120 30 0]


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


Re: problems with fasttrack xtend fxt009

2011-11-10 Thread Thomas Bechtold

On 09/11/11 09:49, Thomas Bechtold wrote:

i tried an older MM version (git snapshot from 20110608t111033) and with
that version, the modems sends responses even if the apn does not work.


Here are the logs with the older MM version (NM version is the same).
i started the same connection with "nmcli con up id ModemGSM". The modem 
works here. Can can not reproduce the provider failure.



Cheers,

Tom

# MM-Log ###
# pkill modem-manager && modem-manager --debug --log-level=DEBUG
modem-manager[24420]:   [132090.411168] [main.c:167] main(): 
ModemManager (version 0.5.999) starting...
modem-manager[24420]:   [132090.639997] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Option'
modem-manager[24420]:   [132090.640659] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'X22X'
modem-manager[24420]:   [132090.641238] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Ericsson MBM'
modem-manager[24420]:   [132090.641816] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Sierra'
modem-manager[24420]:   [132090.643231] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Linktop'
modem-manager[24420]:   [132090.643552] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'AnyData'
modem-manager[24420]:   [132090.643789] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Longcheer'
modem-manager[24420]:   [132090.644106] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Wavecom'
modem-manager[24420]:   [132090.644339] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Novatel'
modem-manager[24420]:   [132090.644557] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'SimTech'
modem-manager[24420]:   [132090.644777] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Nokia'
modem-manager[24420]:   [132090.645207] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Samsung'
modem-manager[24420]:   [132090.645458] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Gobi'
modem-manager[24420]:   [132090.645683] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Huawei'
modem-manager[24420]:   [132090.645900] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'MotoC'
modem-manager[24420]:   [132090.646116] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'ZTE'
modem-manager[24420]:   [132090.646982] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Option High-Speed'
modem-manager[24420]:   [132090.647560] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Cinterion'
modem-manager[24420]:   [132090.648146] [mm-manager.c:154] 
found_plugin(): Loaded plugin 'Generic'
modem-manager[24420]:   [132090.648746] [mm-manager.c:206] 
load_plugins(): Successfully loaded 19 plugins
modem-manager[24420]:  [132090.659432] [mm-manager.c:1012] 
mm_manager_start(): Starting device scan...
modem-manager[24420]:  [132090.685973] [mm-manager.c:844] 
device_added(): (tty/ttyS0): port's parent platform driver is not 
whitelisted
modem-manager[24420]:  [132090.728696] [mm-manager.c:844] 
device_added(): (tty/ttyS2): port's parent platform driver is not 
whitelisted
modem-manager[24420]:  [132090.731369] [mm-manager.c:844] 
device_added(): (tty/ttyS4): port's parent platform driver is not 
whitelisted
modem-manager[24420]:  [132090.788052] [mm-manager.c:844] 
device_added(): (net/usb0): port's parent platform driver is not whitelisted
modem-manager[24420]:  [132090.790052] [mm-manager.c:1030] 
mm_manager_start(): Finished device scan...
modem-manager[24420]:   [132090.790926] [mm-serial-port.c:760] 
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[24420]:  [132090.793319] [mm-serial-port.c:822] 
mm_serial_port_open(): (ttyS1) device open count is 1 (open)
modem-manager[24420]:  [132090.794001] 
[mm-plugin-base.c:1021] try_open(): (ttyS1): probe requested by plugin 
'Cinterion'
modem-manager[24420]:  [132090.903090] 
[mm-at-serial-port.c:298] debug_log(): (ttyS1): --> 'AT+GCAP'
modem-manager[24420]:  [132095.011100] 
[mm-at-serial-port.c:298] debug_log(): (ttyS1): --> 'AT+GCAP'
modem-manager[24420]:  [132099.008879] 
[mm-at-serial-port.c:298] debug_log(): (ttyS1): --> 'AT+GCAP'
modem-manager[24420]:  [1320922233.006625] [mm-serial-port.c:856] 
mm_serial_port_close(): (ttyS1) device open count is 0 (close)
modem-manager[24420]:   [1320922233.007032] [mm-serial-port.c:871] 
mm_serial_port_close(): (ttyS1) closing serial port...
modem-manager[24420]:   [1320922233.007587] [mm-serial-port.c:892] 
mm_serial_port_close(): (ttyS1) serial port closed
modem-manager[24420]:   [1320922233.008942] [mm-serial-port.c:760] 
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[24420]:  [1320922233.009824]

Re: problems with fasttrack xtend fxt009

2011-11-09 Thread Thomas Bechtold

Hi,

On 08/11/11 12:22, Thomas Bechtold wrote:

I'm unable to get a working connection (see MM-Log).


i talked to vodafone and they had problems with the apn 'web.vodafone.de'.


After the connection, the modem does not answer to any AT-commands (see
the end of MM-Log).


i tried an older MM version (git snapshot from 20110608t111033) and with 
that version, the modems sends responses even if the apn does not work.


after i changed the apn to 'event.vodafone.de', i got a connection (with 
the git version from 20110608t111033).


i still have to try the modem with event.vodafone.de and the current git 
snapshot.



cheers,

Tom


I tried to enable the modem with "nmcli con up id ModemGSM". See NM-Log
for network-manager details.

The NetworkManager config for "ModemGSM" is:
# cat /etc/NetworkManager/system-connections/ModemGSM

[connection]
id=ModemGSM
uuid=baa2af1b-e21e-7bcf-f1ac-1a775c46ddc3
type=gsm
autoconnect=false

[ipv4]
method=auto

[gsm]
number=#99*
username=vodafone
password=vodafone
apn=web.vodafone.de
pin=

[serial]
baud=115200




Ideas how to solve the problem?

Cheers,

Tom



# MM-Log ###
# pkill modem-manager && modem-manager --debug --log-level=DEBUG
modem-manager[2800]:  [1320750454.293239] [main.c:167] main():
ModemManager (version 0.5.999) starting...
modem-manager[2800]:  [1320750454.549302] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Option'
modem-manager[2800]:  [1320750454.550114] [mm-manager.c:158]
found_plugin(): Loaded plugin 'X22X'
modem-manager[2800]:  [1320750454.550857] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Ericsson MBM'
modem-manager[2800]:  [1320750454.574424] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Sierra'
modem-manager[2800]:  [1320750454.574749] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Linktop'
modem-manager[2800]:  [1320750454.575024] [mm-manager.c:158]
found_plugin(): Loaded plugin 'AnyData'
modem-manager[2800]:  [1320750454.575285] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Longcheer'
modem-manager[2800]:  [1320750454.575547] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Wavecom'
modem-manager[2800]:  [1320750454.575807] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Novatel'
modem-manager[2800]:  [1320750454.576068] [mm-manager.c:158]
found_plugin(): Loaded plugin 'SimTech'
modem-manager[2800]:  [1320750454.576328] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Nokia'
modem-manager[2800]:  [1320750454.576585] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Samsung'
modem-manager[2800]:  [1320750454.576842] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Gobi'
modem-manager[2800]:  [1320750454.577308] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Huawei'
modem-manager[2800]:  [1320750454.578022] [mm-manager.c:158]
found_plugin(): Loaded plugin 'MotoC'
modem-manager[2800]:  [1320750454.578747] [mm-manager.c:158]
found_plugin(): Loaded plugin 'ZTE'
modem-manager[2800]:  [1320750454.579459] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Option High-Speed'
modem-manager[2800]:  [1320750454.580178] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Cinterion'
modem-manager[2800]:  [1320750454.580900] [mm-manager.c:158]
found_plugin(): Loaded plugin 'Generic'
modem-manager[2800]:  [1320750454.585689] [mm-manager.c:210]
load_plugins(): Successfully loaded 19 plugins
modem-manager[2800]:  [1320750454.596035] [mm-manager.c:1030]
mm_manager_start(): Starting device scan...
modem-manager[2800]:  [1320750454.672028] [mm-manager.c:848]
device_added(): (tty/ttyS0): port's parent platform driver is not
whitelisted
modem-manager[2800]:  [1320750454.720729] [mm-manager.c:848]
device_added(): (tty/ttyS2): port's parent platform driver is not
whitelisted
modem-manager[2800]:  [1320750454.723998] [mm-manager.c:848]
device_added(): (tty/ttyS4): port's parent platform driver is not
whitelisted
modem-manager[2800]:  [1320750454.789874] [mm-manager.c:848]
device_added(): (net/usb0): port's parent platform driver is not
whitelisted
modem-manager[2800]:  [1320750454.792532] [mm-manager.c:1048]
mm_manager_start(): Finished device scan...
modem-manager[2800]:  [1320750454.793574] [mm-serial-port.c:805]
mm_serial_port_open(): (ttyACM0) opening serial port...
modem-manager[2800]:  [1320750454.796262] [mm-serial-port.c:874]
mm_serial_port_open(): (ttyACM0) device open count is 1 (open)
modem-manager[2800]:  [1320750454.797095] [mm-plugin-base.c:1045]
try_open(): (ttyACM0): probe requested by plugin 'Wavecom'
modem-manager[2800]:  [1320750454.799453] [mm-serial-port.c:805]
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[2800]:  [1320750454.800870] [mm-serial-port.c:874]
mm_serial_port_open(): (ttyS1) device

problems with fasttrack xtend fxt009

2011-11-08 Thread Thomas Bechtold

Hi,

i use latest git-snapshot from ModemManager with NM 0.8.4. I try to use 
a Fastttrack XTend FXT009.


I'm unable to get a working connection (see MM-Log).
After the connection, the modem does not answer to any AT-commands (see 
the end of MM-Log).


I tried to enable the modem with "nmcli con up id ModemGSM". See NM-Log 
for network-manager details.


The NetworkManager config for "ModemGSM" is:
# cat /etc/NetworkManager/system-connections/ModemGSM

[connection]
id=ModemGSM
uuid=baa2af1b-e21e-7bcf-f1ac-1a775c46ddc3
type=gsm
autoconnect=false

[ipv4]
method=auto

[gsm]
number=#99*
username=vodafone
password=vodafone
apn=web.vodafone.de
pin=

[serial]
baud=115200




Ideas how to solve the problem?

Cheers,

Tom



# MM-Log ###
# pkill modem-manager && modem-manager --debug --log-level=DEBUG
modem-manager[2800]:   [1320750454.293239] [main.c:167] main(): 
ModemManager (version 0.5.999) starting...
modem-manager[2800]:   [1320750454.549302] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Option'
modem-manager[2800]:   [1320750454.550114] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'X22X'
modem-manager[2800]:   [1320750454.550857] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Ericsson MBM'
modem-manager[2800]:   [1320750454.574424] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Sierra'
modem-manager[2800]:   [1320750454.574749] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Linktop'
modem-manager[2800]:   [1320750454.575024] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'AnyData'
modem-manager[2800]:   [1320750454.575285] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Longcheer'
modem-manager[2800]:   [1320750454.575547] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Wavecom'
modem-manager[2800]:   [1320750454.575807] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Novatel'
modem-manager[2800]:   [1320750454.576068] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'SimTech'
modem-manager[2800]:   [1320750454.576328] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Nokia'
modem-manager[2800]:   [1320750454.576585] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Samsung'
modem-manager[2800]:   [1320750454.576842] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Gobi'
modem-manager[2800]:   [1320750454.577308] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Huawei'
modem-manager[2800]:   [1320750454.578022] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'MotoC'
modem-manager[2800]:   [1320750454.578747] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'ZTE'
modem-manager[2800]:   [1320750454.579459] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Option High-Speed'
modem-manager[2800]:   [1320750454.580178] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Cinterion'
modem-manager[2800]:   [1320750454.580900] [mm-manager.c:158] 
found_plugin(): Loaded plugin 'Generic'
modem-manager[2800]:   [1320750454.585689] [mm-manager.c:210] 
load_plugins(): Successfully loaded 19 plugins
modem-manager[2800]:  [1320750454.596035] [mm-manager.c:1030] 
mm_manager_start(): Starting device scan...
modem-manager[2800]:  [1320750454.672028] [mm-manager.c:848] 
device_added(): (tty/ttyS0): port's parent platform driver is not 
whitelisted
modem-manager[2800]:  [1320750454.720729] [mm-manager.c:848] 
device_added(): (tty/ttyS2): port's parent platform driver is not 
whitelisted
modem-manager[2800]:  [1320750454.723998] [mm-manager.c:848] 
device_added(): (tty/ttyS4): port's parent platform driver is not 
whitelisted
modem-manager[2800]:  [1320750454.789874] [mm-manager.c:848] 
device_added(): (net/usb0): port's parent platform driver is not whitelisted
modem-manager[2800]:  [1320750454.792532] [mm-manager.c:1048] 
mm_manager_start(): Finished device scan...
modem-manager[2800]:   [1320750454.793574] [mm-serial-port.c:805] 
mm_serial_port_open(): (ttyACM0) opening serial port...
modem-manager[2800]:  [1320750454.796262] [mm-serial-port.c:874] 
mm_serial_port_open(): (ttyACM0) device open count is 1 (open)
modem-manager[2800]:  [1320750454.797095] [mm-plugin-base.c:1045] 
try_open(): (ttyACM0): probe requested by plugin 'Wavecom'
modem-manager[2800]:   [1320750454.799453] [mm-serial-port.c:805] 
mm_serial_port_open(): (ttyS1) opening serial port...
modem-manager[2800]:  [1320750454.800870] [mm-serial-port.c:874] 
mm_serial_port_open(): (ttyS1) device open count is 1 (open)
modem-manager[2800]:  [1320750454.801855] [mm-plugin-base.c:1045] 
try_open(): (ttyS1): probe requested by plugin 'Cinterion'
modem-manager[2800]:  [1320750454.913371] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM0): --> 'AT+GCAP'
modem-manager[2800]:  [1320750454.914534] 
[mm-at-serial-port.c:298] debug_log(): (ttyS1): --> 'AT+GCAP'
modem-manager[2800]:  [1320750455.701495] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM0): <-- 
'ERROR'
modem-manager[2800]:  [1320750455.702913] 
[mm-serial-parsers.c:410] mm_serial_parser_v1_parse(): Got failure code 
100: Unknown error
modem-manager[

[PATCH] trivial: set correct log domain in dhcp client

2011-10-27 Thread Thomas Bechtold
just set the correct log domain


---
 src/dhcp-manager/nm-dhcp-client.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/dhcp-manager/nm-dhcp-client.c 
b/src/dhcp-manager/nm-dhcp-client.c
index f10f3de..16c6dd7 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -262,7 +262,7 @@ daemon_watch_cb (GPid pid, gint status, gpointer user_data)
 priv->iface, pid,
 WIFEXITED (status) ? WEXITSTATUS (status) : -1);
} else {
-   nm_log_info (LOGD_DHCP6, "(%s): DHCPv4 client pid %d exited 
with status %d",
+   nm_log_info (LOGD_DHCP4, "(%s): DHCPv4 client pid %d exited 
with status %d",
 priv->iface, pid,
 WIFEXITED (status) ? WEXITSTATUS (status) : -1);
}
-- 
1.7.5.4

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


Re: [PATCH] core: add internet connectivity check

2011-10-22 Thread Thomas Bechtold
Hi Marcel,

On Sat, 2011-10-22 at 11:59 +0200, Marcel Holtmann wrote:
> Hi Tom,
> 
> > * use libsoup to check internet connectivity with
> >   a http request to a configurable uri and check
> >   the response code for 200
> 
> just checking for result code 200 will not be enough. A bunch of
> hotspots return result code 200 actually. You need to also check that
> the content of your requested website is valid. Otherwise you have a
> bunch of false positives.

you are right. result code check is not enough. the attached patch adds
another parameter (connectivity-response) to define the expected
response. the connectivity-response can be a regular expression and if
the expression match the http response, connectivity check was
successful. the status code doesn't matter any more.

to test the connectivity check, do eg:

./NetworkManager --no-daemon --log-level=DEBUG --log-domains=CORE
--connectivity-uri=http://toabctl.de
--connectivity-response="toabctl.de"


Tom

>From c5e05b7181b74db80525f49eb2224b81adc190a7 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold 
Date: Fri, 21 Oct 2011 21:21:30 +0200
Subject: [PATCH] core: add internet connectivity check

* use libsoup to compare a http response from a given
  uri with a given response (use regex for this)
* do periodically check the connectivity. Check interval
  is configurable
* check connectivity when device state change
  from/to NM_DEVICE_STATE_ACTIVATED
---
 configure.ac  |4 +
 src/Makefile.am   |6 +-
 src/main.c|   14 ++-
 src/nm-config.c   |   66 +-
 src/nm-config.h   |6 +
 src/nm-connectivity.c |  349 +
 src/nm-connectivity.h |   69 ++
 src/nm-manager.c  |   84 ++--
 src/nm-manager.h  |5 +-
 9 files changed, 583 insertions(+), 20 deletions(-)
 create mode 100644 src/nm-connectivity.c
 create mode 100644 src/nm-connectivity.h

diff --git a/configure.ac b/configure.ac
index ac6da48..dabb4f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -266,6 +266,10 @@ PKG_CHECK_MODULES(GIO, gio-2.0)
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
+PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26])
+AC_SUBST(LIBSOUP_CFLAGS)
+AC_SUBST(LIBSOUP_LIBS)
+
 GOBJECT_INTROSPECTION_CHECK([0.9.6])
 
 # Qt4
diff --git a/src/Makefile.am b/src/Makefile.am
index cbcfdc6..d8e9a2d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -177,7 +177,9 @@ NetworkManager_SOURCES = \
 		nm-dhcp6-config.h \
 		nm-rfkill.h \
 		nm-session-monitor.c \
-		nm-session-monitor.h
+		nm-session-monitor.h \
+		nm-connectivity.c \
+		nm-connectivity.h
 
 nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml
 	$(AM_V_GEN) dbus-binding-tool --prefix=nm_access_point --mode=glib-server --output=$@ $<
@@ -240,6 +242,7 @@ NetworkManager_CPPFLAGS = \
 	$(LIBNL_CFLAGS) \
 	$(GMODULE_CFLAGS) \
 	$(POLKIT_CFLAGS) \
+	$(LIBSOUP_CFLAGS) \
 	-DG_DISABLE_DEPRECATED \
 	-DBINDIR=\"$(bindir)\" \
 	-DSBINDIR=\"$(sbindir)\" \
@@ -279,6 +282,7 @@ NetworkManager_LDADD = \
 	$(LIBNL_LIBS) \
 	$(GMODULE_LIBS) \
 	$(POLKIT_LIBS) \
+	$(LIBSOUP_LIBS) \
 	$(LIBM) \
 	$(LIBDL)
 
diff --git a/src/main.c b/src/main.c
index b7c0fd5..3b972d1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -419,6 +419,9 @@ main (int argc, char *argv[])
 	char *pidfile = NULL, *state_file = NULL;
 	char *config_path = NULL, *plugins = NULL;
 	char *log_level = NULL, *log_domains = NULL;
+	char *connectivity_uri = NULL;
+	gint connectivity_interval = -1;
+	char *connectivity_response = NULL;
 	gboolean wifi_enabled = TRUE, net_enabled = TRUE, wwan_enabled = TRUE, wimax_enabled = TRUE;
 	gboolean success, show_version = FALSE;
 	NMPolicy *policy = NULL;
@@ -447,6 +450,9 @@ main (int argc, char *argv[])
 		"   WIFI_SCAN,IP4,IP6,AUTOIP4,DNS,VPN,SHARING,SUPPLICANT,\n"
 		"   AGENTS,SETTINGS,SUSPEND,CORE,DEVICE,OLPC,WIMAX]",
 		"HW,RFKILL,WIFI" },
+		{ "connectivity-uri", 0, 0, G_OPTION_ARG_STRING, &connectivity_uri, "A http(s) address to check internet connectivity" },
+		{ "connectivity-interval", 0, 0, G_OPTION_ARG_INT, &connectivity_interval, "the interval in seconds how often a connectivity check will be done" },
+		{ "connectivity-response", 0, 0, G_OPTION_ARG_STRING, &connectivity_response, "the expected response (regular expression)" },
 		{NULL}
 	};
 
@@ -501,7 +507,8 @@ main (int argc, char *argv[])
 		exit (1);
 
 	/* Read the config file and CLI overrides */
-	config = nm_config_new (config_path, plugins, log_level, log_domains, &error);
+	config = nm_config_new (config_path, plugins, log_level, log_domains,
+			connectivity_uri, connectivity_interval, connectivity_response, &error);
 	if (config == NULL) 

[PATCH] core: add internet connectivity check

2011-10-22 Thread Thomas Bechtold
(config);
 }
diff --git a/src/nm-config.h b/src/nm-config.h
index fae344f..c71b5be 100644
--- a/src/nm-config.h
+++ b/src/nm-config.h
@@ -40,6 +40,8 @@ NMConfig *nm_config_new (const char *cli_config_path,
  const char *cli_plugins,
  const char *cli_log_level,
  const char *cli_log_domains,
+ const char *cli_connectivity_check_uri,
+ const gint connectivity_check_interval,
  GError **error);
 
 const char *nm_config_get_path (NMConfig *config);
@@ -48,6 +50,9 @@ const char *nm_config_get_dhcp_client (NMConfig *config);
 const char **nm_config_get_dns_plugins (NMConfig *config);
 const char *nm_config_get_log_level (NMConfig *config);
 const char *nm_config_get_log_domains (NMConfig *config);
+const char *nm_config_get_connectivity_uri (NMConfig *config);
+const guint nm_config_get_connectivity_interval (NMConfig *config);
+
 
 void nm_config_free (NMConfig *config);
 
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
new file mode 100644
index 000..1c49991
--- /dev/null
+++ b/src/nm-connectivity.c
@@ -0,0 +1,330 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2011 Thomas Bechtold 
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "nm-connectivity.h"
+#include "nm-logging.h"
+#include "nm-manager.h"
+
+
+typedef struct {
+   //used for http requests
+   SoupSession *soup_session;
+   //indicates if a connectivity check is currently running
+   gboolean check_running;
+   //the uri to check
+   const gchar *check_uri;
+   //seconds when a check will be repeated
+   guint check_interval;
+   //indicates if the last connection check was successful
+   gboolean connected;
+   //the source id for the periodic check
+   guint check_interval_source_id;
+
+} NMConnectivityPrivate;
+
+G_DEFINE_TYPE (NMConnectivity, nm_connectivity, G_TYPE_OBJECT)
+
+#define NM_CONNECTIVITY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
NM_TYPE_CONNECTIVITY, NMConnectivityPrivate))
+
+
+enum {
+   CONNECTED_CHANGED,
+
+   LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+enum {
+   PROP_0,
+   PROP_CHECK_RUNNING,
+   PROP_CHECK_URI,
+   PROP_CHECK_INTERVAL,
+   PROP_CONNECTED,
+   LAST_PROP
+};
+
+
+static gboolean nm_connectivity_interval (NMConnectivity *connectivity)
+{
+   /* periodically check connectivity */
+   nm_connectivity_check (connectivity);
+   return TRUE;
+}
+
+
+static void
+nm_connectivity_check_cb (SoupSession *session, SoupMessage *msg, gpointer 
user_data)
+{
+   NMConnectivity *connectivity;
+   NMConnectivityPrivate *priv;
+   guint status_code;
+   SoupURI *soup_uri;
+   gboolean connected_new;
+
+   g_return_if_fail (NM_IS_CONNECTIVITY (user_data));
+   connectivity = NM_CONNECTIVITY (user_data);
+   priv = NM_CONNECTIVITY_GET_PRIVATE (connectivity);
+
+   g_object_get (msg, SOUP_MESSAGE_STATUS_CODE, &status_code, NULL);
+   soup_uri = soup_message_get_uri (msg);
+   /* just check connectivity_code */
+   if (status_code == SOUP_STATUS_OK) {
+   nm_log_dbg (LOGD_CORE, "Connectivity check for '%s' successful. 
status code is: %i", soup_uri_to_string (soup_uri, FALSE), status_code);
+   connected_new = TRUE;
+   } else {
+   nm_log_dbg (LOGD_CORE, "Connectivity check for '%s' not 
successful. status code is: %i", soup_uri_to_string (soup_uri, FALSE), 
status_code);
+   connected_new = FALSE;
+   }
+
+   /* update connectivity and emit signal */
+   if (priv->connected != connected_new) {
+   priv->connected = connected_new;
+   g_object_notify (G_OBJECT (connectivity), 
NM_CONNECTIVITY_CONNECTED);
+   g_signal_emit_by_name (connectivity, 
NM_CONNECTIVITY_SIGNAL_CONNECTED_CHANGED, priv->connected);
+   }
+
+   priv->check_running = FALSE;
+   g_object_notify (G_OBJEC

[PATCH] core: implement internet connectivity check feature

2011-10-21 Thread Thomas Bechtold
_SYSTEM_CONF_FILE, cli_plugins, 
cli_log_level, cli_log_domains,
+   cli_connectivity_uri, 
cli_connectivity_interval, &local))
return config;
 
if (g_error_matches (local, G_KEY_FILE_ERROR, 
G_KEY_FILE_ERROR_NOT_FOUND) == FALSE) {
@@ -211,7 +247,8 @@ nm_config_new (const char *cli_config_path,
g_clear_error (&local);
 
/* Try the standard config file location next */
-   if (fill_from_file (config, NM_DEFAULT_SYSTEM_CONF_FILE, cli_plugins, 
cli_log_level, cli_log_domains, &local))
+   if (fill_from_file (config, NM_DEFAULT_SYSTEM_CONF_FILE, cli_plugins, 
cli_log_level, cli_log_domains,
+   cli_connectivity_uri, 
cli_connectivity_interval, &local))
return config;
 
if (g_error_matches (local, G_KEY_FILE_ERROR, 
G_KEY_FILE_ERROR_NOT_FOUND) == FALSE) {
@@ -226,6 +263,7 @@ nm_config_new (const char *cli_config_path,
 
/* ignore error if config file not found */
g_clear_error (&local);
+
return config;
 }
 
@@ -240,7 +278,7 @@ nm_config_free (NMConfig *config)
g_strfreev (config->dns_plugins);
g_free (config->log_level);
g_free (config->log_domains);
-
+   g_free (config->connectivity_uri);
memset (config, 0, sizeof (*config));
g_free (config);
 }
diff --git a/src/nm-config.h b/src/nm-config.h
index fae344f..c71b5be 100644
--- a/src/nm-config.h
+++ b/src/nm-config.h
@@ -40,6 +40,8 @@ NMConfig *nm_config_new (const char *cli_config_path,
  const char *cli_plugins,
  const char *cli_log_level,
  const char *cli_log_domains,
+ const char *cli_connectivity_check_uri,
+ const gint connectivity_check_interval,
  GError **error);
 
 const char *nm_config_get_path (NMConfig *config);
@@ -48,6 +50,9 @@ const char *nm_config_get_dhcp_client (NMConfig *config);
 const char **nm_config_get_dns_plugins (NMConfig *config);
 const char *nm_config_get_log_level (NMConfig *config);
 const char *nm_config_get_log_domains (NMConfig *config);
+const char *nm_config_get_connectivity_uri (NMConfig *config);
+const guint nm_config_get_connectivity_interval (NMConfig *config);
+
 
 void nm_config_free (NMConfig *config);
 
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
new file mode 100644
index 000..9db1c8e
--- /dev/null
+++ b/src/nm-connectivity.c
@@ -0,0 +1,323 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2011 Thomas Bechtold 
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "nm-connectivity.h"
+#include "nm-logging.h"
+#include "nm-manager.h"
+
+
+typedef struct {
+   //used for http requests
+   SoupSession *soup_session;
+   //indicates if a connectivity check is currently running
+   gboolean check_running;
+   //the uri to check
+   const gchar *check_uri;
+   //seconds when a check will be repeated
+   guint check_interval;
+   //indicates if the last connection check was successful
+   gboolean connected;
+   //the source id for the periodic check
+   guint check_interval_source_id;
+
+} NMConnectivityPrivate;
+
+G_DEFINE_TYPE (NMConnectivity, nm_connectivity, G_TYPE_OBJECT)
+
+#define NM_CONNECTIVITY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
NM_TYPE_CONNECTIVITY, NMConnectivityPrivate))
+
+
+enum {
+   CONNECTED_CHANGED,
+
+   LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+enum {
+   PROP_0,
+   PROP_CHECK_RUNNING,
+   PROP_CHECK_URI,
+   PROP_CHECK_INTERVAL,
+   PROP_CONNECTED,
+   LAST_PROP
+};
+
+
+static gboolean nm_connectivity_interval (NMConnectivity *connectivity)
+{
+   /* periodically check connectivity */
+   nm_connectivity_check (connectivity);
+   return TRUE;
+}
+
+
+static void
+nm_connectivity_check_cb (SoupSession *session, SoupMessage *msg, gpointer 
user_data)
+{
+   NMConnectivity *connectivity;
+   NM

Re: [PATCH] Re: problem with cinterion TC63i rs232 modem

2011-10-14 Thread Thomas Bechtold

Hi Aleksander,

The attached patch solved the problem. Thanks!

Cheers,

Tom

On 13/10/11 22:12, Aleksander Morgado wrote:

Hi,

So the real problem here is that the Cinterion modem sends a NUL byte
before the CONNECT response:


[mm-at-serial-port.c:298] debug_log(): (ttyS1): -->  'ATD*99***1#'
modem-manager[2621]:  [1317807408.548825]
[mm-at-serial-port.c:298] debug_log(): (ttyS1):<-- '\0'
modem-manager[2621]:  [1317807410.433152]
[mm-at-serial-port.c:298] debug_log(): (ttyS1):<--
'CONNECT'


It only does that during the first reply to ATD, not in the next tries,
that is why you were able to connect successfully after the first try.

Attached is a patch that solves the issue. It modifies the common serial
parser, so not something Cinterion-specific, but the change is quite
small and shouldn't affect other plugins.

Cheers,


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


Re: problem with cinterion TC63i rs232 modem

2011-10-06 Thread Thomas Bechtold

Hi Aleksander,

On 06/10/11 10:05, Aleksander Morgado wrote:

Hey Thomas,



To reproduce, i do the following:

1 ) stop NM, MM and disconnect the modem from power supply
2 ) connect the modem to power supply
3 ) start MM: modem-manager --debug --log-level=DEBUG
4 ) start NM: /etc/init.d/network-manager start
5 ) nmcli con up uuid baa2af1b-e21e-7bcf-f1ac-1a775c46ddc3

No i have no connection (see debug log).



The modem ends up replying NO CARRIER at some point when trying the
connection the first time:

 [mm-at-serial-port.c:298] debug_log(): (ttyS1):<-- 'NO
 CARRIER'


6 ) /etc/init.d/network-manager stop
7 ) kill modem-manager
8 ) start MM again: modem-manager --debug --log-level=DEBUG
9 ) start NM again: /etc/init.d/network-manager start
10) nmcli con up uuid baa2af1b-e21e-7bcf-f1ac-1a775c46ddc3

Now i have a working connection.



In the second try the modem didn't return NO CARRIER, connection
succeeded.

Is this something that you can reproduce always? I don't recall having
seen this situation myself when writing the Cinterion plugin.



Yes, i can reproduce this. Tried 4x and the behaviour is always the same.
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


MM and NM release strategy questions

2011-10-04 Thread Thomas Bechtold

Hi Dan,

i want to know if it's possible to release a new ModemManager version 
(0.5.1 or 0.6) before the new API will be merged into master and before 
gdbus will be used.


The reasons for a new version are:
- users of debian squeeze,ubuntu 10.04 and maybe other distributions 
have glib-2.24, but gdbus needs >=2.26.
- users of NetworkManager 0.8.x will not be able to use a new 
ModemManager version because of the new API (or will the new API be 
implemented in NM 0.8?)



What about NetworkManager 0.9? Will NM support the old _and_ the new MM 
API or only the new one?




Cheers,

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


[PATCH] core: improve keyfile error handling

2011-09-30 Thread Thomas Bechtold
  * better error messages
  * fix memory leak in parse_state_file ()
  * create intermediate parent directories as needed for state file
---
 src/main.c  |   30 +-
 src/nm-config.c |   13 ++---
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/src/main.c b/src/main.c
index 59d7cd1..682cfcd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -327,8 +327,8 @@ parse_state_file (const char *filename,
 
state_file = g_key_file_new ();
if (!state_file) {
-   g_set_error (error, 0, 0,
-"Not enough memory to load state file.");
+   g_set_error (error, NM_CONFIG_ERROR, NM_CONFIG_ERROR_NO_MEMORY,
+"Not enough memory to load state file %s.", 
filename);
return FALSE;
}
 
@@ -348,11 +348,12 @@ parse_state_file (const char *filename,
/* try to create the directory if it doesn't exist */
dirname = g_path_get_dirname (filename);
errno = 0;
-   if (mkdir (dirname, 0755) != 0) {
+   if (g_mkdir_with_parents (dirname, 0755) != 0) {
if (errno != EEXIST) {
g_set_error (error, G_FILE_ERROR, 
G_FILE_ERROR_ACCES,
-"Error creating state 
directory %s: %d", dirname, errno);
+"Error creating state 
directory %s: %s", dirname, strerror(errno));
g_free (dirname);
+   g_clear_error (&tmp_error);
return FALSE;
}
}
@@ -368,13 +369,15 @@ parse_state_file (const char *filename,
if (data)
ret = g_file_set_contents (filename, data, len, 
error);
g_free (data);
+   g_clear_error (&tmp_error);
 
return ret;
} else {
-   g_set_error_literal (error, tmp_error->domain, 
tmp_error->code, tmp_error->message);
-   g_clear_error (&tmp_error);
+   /* the error is not "No such file or directory" - 
propagate the error */
+   g_propagate_error (error, tmp_error);
}
 
+   g_clear_error (&tmp_error);
/* Otherwise, file probably corrupt or inaccessible */
return FALSE;
}
@@ -384,34 +387,27 @@ parse_state_file (const char *filename,
 */
net = g_key_file_get_boolean (state_file, "main", "NetworkingEnabled", 
&tmp_error);
if (tmp_error)
-   g_set_error_literal (error, tmp_error->domain, tmp_error->code, 
tmp_error->message);
+   g_clear_error (&tmp_error);
else
*net_enabled = net;
-   g_clear_error (&tmp_error);
 
wifi = g_key_file_get_boolean (state_file, "main", "WirelessEnabled", 
&tmp_error);
if (tmp_error) {
-   g_clear_error (error);
-   g_set_error_literal (error, tmp_error->domain, tmp_error->code, 
tmp_error->message);
+   g_clear_error (&tmp_error);
} else
*wifi_enabled = wifi;
-   g_clear_error (&tmp_error);
 
wwan = g_key_file_get_boolean (state_file, "main", "WWANEnabled", 
&tmp_error);
if (tmp_error) {
-   g_clear_error (error);
-   g_set_error_literal (error, tmp_error->domain, tmp_error->code, 
tmp_error->message);
+   g_clear_error (&tmp_error);
} else
*wwan_enabled = wwan;
-   g_clear_error (&tmp_error);
 
wimax = g_key_file_get_boolean (state_file, "main", "WimaxEnabled", 
&tmp_error);
if (tmp_error) {
-   g_clear_error (error);
-   g_set_error_literal (error, tmp_error->domain, tmp_error->code, 
tmp_error->message);
+   g_clear_error (&tmp_error);
} else
*wimax_enabled = wimax;
-   g_clear_error (&tmp_error);
 
g_key_file_free (state_file);
 
diff --git a/src/nm-config.c b/src/nm-config.c
index f52f06f..7e582f4 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -130,14 +130,14 @@ fill_from_file (NMConfig *config,
gboolean success = FALSE;
 
if (g_file_test (path, G_FILE_TEST_EXISTS) == FALSE) {
-   g_set_error (error, G_KEY_FILE_ERROR, 
G_KEY_FILE_ERROR_NOT_FOUND, "file not found");
+   g_set_error (error, G_KEY_FILE_ERROR, 
G_KEY_FILE_ERROR_NOT_FOUND, "file %s not found", path);
return FALSE;
}
 
kf = g_key_file_new ();
if (!kf) {
g_set_error (error, NM_CONFIG_ERROR, NM_CONFIG_ERROR_NO_MEMORY,
-"N

Re: [PATCH 8/8] api: Let MM_MODEM_MODE be a bitfield, and new PreferredMode property

2011-09-30 Thread Thomas Bechtold
Hi Aleksander,

the changes looking great. one question about the preferred mode (see
below).

On Fri, 2011-09-30 at 15:01 +0200, Aleksander Morgado wrote:
> Supported and Allowed modes are modified to be bitmasks of MM_MODEM_MODE 
> values,
> and preference of a specific mode is now given in the new PreferredMode
> property and as an extra argument to the SetAllowedModes() call.
> 
>  * Supported Modes: bitmask specifying which modes are supported by the 
> specific
> hardware. For example, a modem may only support 1G/2G/3G connections (not 4G).
> 
>  * Allowed Modes: bitmask specifying which modes, of the ones Supported by the
> modem, are allowed to use. For example, a modem may support 1G/2G/3G 
> connections
> but only 1G and 2G connections are allowed by the user as 3G involves more
> expensive data rates.
> 
>  [Allowed] ⊆ [Supported]
> 
>  * Preferred Mode: specific mode which is preferred among the ones defined in
> the Allowed modes bitmask. For example, a modem may allow 1G/2G/3G connections
> but the user would like that if possible 2G be used, as 3G consumes too much
> battery. If 2G is not possible, 3G can be used.

Is it also possible to define the order? eg 1G/2G/3G are available and i
want to use 1) 2G, 2) 1G and 3) 3G?


Cheers,

Tom


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


Re: [PATCH] settings: add support for mac-blacklists for wifi and ethernet

2011-06-21 Thread Thomas Bechtold
On Tue, 2011-06-21 at 18:11 +0200, Jirka Klimes wrote:
> Thanks for the patches!
> 
> I've tested the feature. I needed to update the patches a bit. It crashed 
> when 
> the address matched the list ;) 'cause no error was set. I've fixed that and 
> done other minor tweaks too.
> 
> Pushed to NM_0_8 branch: ed5cd006cbe04beeabef85dbe44a7c443c7fe91a

Thanks!



signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] settings: add support for mac-blacklists for wifi and ethernet

2011-06-16 Thread Thomas Bechtold
Hi,

i missed the blacklist check in real_check_connection_compatible() for
ethernet and wifi. Patch attached.


Cheers,

Tom

On Thu, 2011-06-16 at 23:41 +0200, Thomas Bechtold wrote:
> Hi,
> 
> i created a patch to support MAC address blacklists for Ethernet/Wifi
> connections. With this patch it's possible to disable a connection for a
> given list of mac-addresses. 
> 
> I created this patch for the NM 0.8 branch and i have not tested this
> for 0.9 and i don't know if it's difficult to port this patch to NM 0.9.
> 
> Cheers,
> 
> Tom
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list

From b4e118440aa3b840ff10ff005276f6d1b2de76c4 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold 
Date: Thu, 16 Jun 2011 23:07:40 +0200
Subject: [PATCH 1/2] settings: add support for mac-blacklists for wifi and
 ethernet

wifi and ethernet settings have a new parameter called
"mac-address-blacklist". Devices with MAC addresses listed in
"mac-address-blacklist" will never use this connection.
---
 libnm-util/libnm-util.ver|2 +
 libnm-util/nm-setting-wired.c|   50 ++
 libnm-util/nm-setting-wired.h|2 +
 libnm-util/nm-setting-wireless.c |   48 ++-
 libnm-util/nm-setting-wireless.h |2 +
 src/nm-device-ethernet.c |   20 +++
 src/nm-device-wifi.c |   19 ++
 7 files changed, 141 insertions(+), 2 deletions(-)

diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver
index b348fd6..f58076f 100644
--- a/libnm-util/libnm-util.ver
+++ b/libnm-util/libnm-util.ver
@@ -319,6 +319,7 @@ global:
 	nm_setting_wired_get_cloned_mac_address;
 	nm_setting_wired_get_duplex;
 	nm_setting_wired_get_mac_address;
+	nm_setting_wired_get_mac_address_blacklist;
 	nm_setting_wired_get_mtu;
 	nm_setting_wired_get_num_s390_options;
 	nm_setting_wired_get_port;
@@ -339,6 +340,7 @@ global:
 	nm_setting_wireless_get_channel;
 	nm_setting_wireless_get_cloned_mac_address;
 	nm_setting_wireless_get_mac_address;
+	nm_setting_wireless_get_mac_address_blacklist;
 	nm_setting_wireless_get_mode;
 	nm_setting_wireless_get_mtu;
 	nm_setting_wireless_get_num_seen_bssids;
diff --git a/libnm-util/nm-setting-wired.c b/libnm-util/nm-setting-wired.c
index 8691aee..d148578 100644
--- a/libnm-util/nm-setting-wired.c
+++ b/libnm-util/nm-setting-wired.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "nm-setting-wired.h"
 #include "nm-param-spec-specialized.h"
@@ -79,6 +80,7 @@ typedef struct {
 	gboolean auto_negotiate;
 	GByteArray *device_mac_address;
 	GByteArray *cloned_mac_address;
+	GSList *mac_address_blacklist;
 	guint32 mtu;
 	GPtrArray *s390_subchannels;
 	char *s390_nettype;
@@ -93,6 +95,7 @@ enum {
 	PROP_AUTO_NEGOTIATE,
 	PROP_MAC_ADDRESS,
 	PROP_CLONED_MAC_ADDRESS,
+	PROP_MAC_ADDRESS_BLACKLIST,
 	PROP_MTU,
 	PROP_S390_SUBCHANNELS,
 	PROP_S390_NETTYPE,
@@ -165,6 +168,14 @@ nm_setting_wired_get_cloned_mac_address (NMSettingWired *setting)
 	return NM_SETTING_WIRED_GET_PRIVATE (setting)->cloned_mac_address;
 }
 
+const GSList *
+nm_setting_wired_get_mac_address_blacklist (NMSettingWired *setting)
+{
+	g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), NULL);
+
+	return NM_SETTING_WIRED_GET_PRIVATE (setting)->mac_address_blacklist;
+}
+
 guint32
 nm_setting_wired_get_mtu (NMSettingWired *setting)
 {
@@ -363,6 +374,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
 	const char *valid_duplex[] = { "half", "full", NULL };
 	const char *valid_nettype[] = { "qeth", "lcs", "ctc", NULL };
 	GHashTableIter iter;
+	GSList* mac_blacklist_iter;
 	const char *key, *value;
 
 	if (priv->port && !_nm_utils_string_in_list (priv->port, valid_ports)) {
@@ -389,6 +401,19 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
 		return FALSE;
 	}
 
+	for (mac_blacklist_iter = priv->mac_address_blacklist; 
+		 mac_blacklist_iter; mac_blacklist_iter = mac_blacklist_iter->next) {
+		struct ether_addr addr;
+
+		if (!ether_aton_r (mac_blacklist_iter->data, &addr)) {
+			g_set_error (error,
+			 NM_SETTING_WIRED_ERROR,
+			 NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
+			 NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST);
+			return FALSE;
+		}
+	}
+
 	if (   priv->s390_subchannels
 	&& !(priv->s390_subchannels->len == 3 || priv->s390_subchannels->len == 2)) {
 		g_set_error (error,
@@ -456,6 +481,8 @@ finalize (GObject *object)
 	if (priv->cloned_mac_address)
 		g_byte_array_free (priv->cloned_mac_address, TRUE);
 
+	nm_utils_slist_free (priv->mac_address_blacklist, g_free);
+
 	G_OBJECT_CLASS (nm_setting_wire

[PATCH] settings: add support for mac-blacklists for wifi and ethernet

2011-06-16 Thread Thomas Bechtold
Hi,

i created a patch to support MAC address blacklists for Ethernet/Wifi
connections. With this patch it's possible to disable a connection for a
given list of mac-addresses. 

I created this patch for the NM 0.8 branch and i have not tested this
for 0.9 and i don't know if it's difficult to port this patch to NM 0.9.

Cheers,

Tom
From b4e118440aa3b840ff10ff005276f6d1b2de76c4 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold 
Date: Thu, 16 Jun 2011 23:07:40 +0200
Subject: [PATCH] settings: add support for mac-blacklists for wifi and
 ethernet

wifi and ethernet settings have a new parameter called
"mac-address-blacklist". Devices with MAC addresses listed in
"mac-address-blacklist" will never use this connection.
---
 libnm-util/libnm-util.ver|2 +
 libnm-util/nm-setting-wired.c|   50 ++
 libnm-util/nm-setting-wired.h|2 +
 libnm-util/nm-setting-wireless.c |   48 ++-
 libnm-util/nm-setting-wireless.h |2 +
 src/nm-device-ethernet.c |   20 +++
 src/nm-device-wifi.c |   19 ++
 7 files changed, 141 insertions(+), 2 deletions(-)

diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver
index b348fd6..f58076f 100644
--- a/libnm-util/libnm-util.ver
+++ b/libnm-util/libnm-util.ver
@@ -319,6 +319,7 @@ global:
 	nm_setting_wired_get_cloned_mac_address;
 	nm_setting_wired_get_duplex;
 	nm_setting_wired_get_mac_address;
+	nm_setting_wired_get_mac_address_blacklist;
 	nm_setting_wired_get_mtu;
 	nm_setting_wired_get_num_s390_options;
 	nm_setting_wired_get_port;
@@ -339,6 +340,7 @@ global:
 	nm_setting_wireless_get_channel;
 	nm_setting_wireless_get_cloned_mac_address;
 	nm_setting_wireless_get_mac_address;
+	nm_setting_wireless_get_mac_address_blacklist;
 	nm_setting_wireless_get_mode;
 	nm_setting_wireless_get_mtu;
 	nm_setting_wireless_get_num_seen_bssids;
diff --git a/libnm-util/nm-setting-wired.c b/libnm-util/nm-setting-wired.c
index 8691aee..d148578 100644
--- a/libnm-util/nm-setting-wired.c
+++ b/libnm-util/nm-setting-wired.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "nm-setting-wired.h"
 #include "nm-param-spec-specialized.h"
@@ -79,6 +80,7 @@ typedef struct {
 	gboolean auto_negotiate;
 	GByteArray *device_mac_address;
 	GByteArray *cloned_mac_address;
+	GSList *mac_address_blacklist;
 	guint32 mtu;
 	GPtrArray *s390_subchannels;
 	char *s390_nettype;
@@ -93,6 +95,7 @@ enum {
 	PROP_AUTO_NEGOTIATE,
 	PROP_MAC_ADDRESS,
 	PROP_CLONED_MAC_ADDRESS,
+	PROP_MAC_ADDRESS_BLACKLIST,
 	PROP_MTU,
 	PROP_S390_SUBCHANNELS,
 	PROP_S390_NETTYPE,
@@ -165,6 +168,14 @@ nm_setting_wired_get_cloned_mac_address (NMSettingWired *setting)
 	return NM_SETTING_WIRED_GET_PRIVATE (setting)->cloned_mac_address;
 }
 
+const GSList *
+nm_setting_wired_get_mac_address_blacklist (NMSettingWired *setting)
+{
+	g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), NULL);
+
+	return NM_SETTING_WIRED_GET_PRIVATE (setting)->mac_address_blacklist;
+}
+
 guint32
 nm_setting_wired_get_mtu (NMSettingWired *setting)
 {
@@ -363,6 +374,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
 	const char *valid_duplex[] = { "half", "full", NULL };
 	const char *valid_nettype[] = { "qeth", "lcs", "ctc", NULL };
 	GHashTableIter iter;
+	GSList* mac_blacklist_iter;
 	const char *key, *value;
 
 	if (priv->port && !_nm_utils_string_in_list (priv->port, valid_ports)) {
@@ -389,6 +401,19 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
 		return FALSE;
 	}
 
+	for (mac_blacklist_iter = priv->mac_address_blacklist; 
+		 mac_blacklist_iter; mac_blacklist_iter = mac_blacklist_iter->next) {
+		struct ether_addr addr;
+
+		if (!ether_aton_r (mac_blacklist_iter->data, &addr)) {
+			g_set_error (error,
+			 NM_SETTING_WIRED_ERROR,
+			 NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
+			 NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST);
+			return FALSE;
+		}
+	}
+
 	if (   priv->s390_subchannels
 	&& !(priv->s390_subchannels->len == 3 || priv->s390_subchannels->len == 2)) {
 		g_set_error (error,
@@ -456,6 +481,8 @@ finalize (GObject *object)
 	if (priv->cloned_mac_address)
 		g_byte_array_free (priv->cloned_mac_address, TRUE);
 
+	nm_utils_slist_free (priv->mac_address_blacklist, g_free);
+
 	G_OBJECT_CLASS (nm_setting_wired_parent_class)->finalize (object);
 }
 
@@ -497,6 +524,10 @@ set_property (GObject *object, guint prop_id,
 			g_byte_array_free (priv->cloned_mac_address, TRUE);
 		priv->cloned_mac_address = g_value_dup_boxed (value);
 		break;
+	case PROP_MAC_ADDRESS_BLACKLIST:
+		nm_utils_slist_free (priv->mac_address_blacklist, g_free);
+		priv->mac_address_blacklist = g_value_dup_boxed (value);
+		break;
 	case P

NM: Connection order for devices

2011-06-14 Thread Thomas Bechtold

Hi,

i have 2 connections in /etc/NetworkManager/system-connections

### Connection 1 ###
[connection]
id=Ethernet
uuid=be2ae05f-b04d-dcf6-efa3-1e63e0f0e111
type=802-3-ethernet
[ipv4]
method=auto


### Connection 2 ###
[connection]
id=UsbHost
uuid=66d1285e-9905-4991-99c8-25fa3b3aa08a
type=802-3-ethernet
[ipv4]
method=link-local
[802-3-ethernet]
duplex=full
mac-address=00:50:c2:cd:a5:c7
[ipv6]
method=ignore


I have 2 devices:
Device1 is an ethernet adapter and Device2 is a UsbHostDevice (with mac 
00:50:c2:cd:a5:c7).




When i start NM, seems that NM try to use Conection 1 with Device 2 but 
i told NM to use Connection 2 for device 2 (because of the mac-address 
entry). Why does this happen?


cheers,

tom


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


Re: What about the patch for USB gadgets?

2011-05-12 Thread Thomas Bechtold

Hi Dan,

On 12/05/11 04:55, Dan Williams wrote:

A quick question on these, are they properly represented in sysfs or are
they "virtual" devices?  Given that they are USB connected it would seem
they should be properly presented, even in the case of platform drivers
since there has to be a USB tree in sysfs to root things in...  One
thing you can do is grab the attached lsudev.c tool and run that like
"lsudev net" when the device is present, and that'll give me more
information about the sysfs layout that I can use to answer my question.


output of "lsudev net" attached.

/devices/platform/at91_ohci/usb1/1-1/1-1:1.0/net/eth1 is a usb ethernet 
adapter. The device we want to use is usb0.


ifconfig and manual device configuration works:

# ifconfig usb0
usb0  Link encap:Ethernet  HWaddr 46:0d:9e:67:69:ec
  inet addr:10.0.0.40  Bcast:10.0.0.255  Mask:255.255.255.0
  inet6 addr: fe80::440d:9eff:fe67:69ec/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:38 errors:0 dropped:0 overruns:0 frame:0
  TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:9245 (9.0 KiB)  TX bytes:468 (468.0 B)



Cheers,

Tom
--
Name: eth1
Type: (null)
Subsys:   net
Number:   1
Path: /sys/devices/platform/at91_ohci/usb1/1-1/1-1:1.0/net/eth1
Driver:   (null)
Action:   (null)
Seq Num:  0
Dev File: (null)

Properties:
  UDEV_LOG:3
  DEVPATH: /devices/platform/at91_ohci/usb1/1-1/1-1:1.0/net/eth1
  INTERFACE:   eth1
  IFINDEX: 3
  SUBSYSTEM:   net
  ID_VENDOR:   Moschip_Semiconductor
  ID_VENDOR_ENC:   Moschip\x20Semiconductor
  ID_VENDOR_ID:9710
  ID_MODEL:USB-MAC_Controller
  ID_MODEL_ENC:USB-MAC\x20Controller\x20\x20\x20
  ID_MODEL_ID: 7830
  ID_REVISION: 0100
  ID_SERIAL:   Moschip_Semiconductor_USB-MAC_Controller_3b00082f
  ID_SERIAL_SHORT: 3b00082f
  ID_TYPE: generic
  ID_BUS:  usb
  ID_USB_INTERFACES:   :ff00ff:
  ID_USB_INTERFACE_NUM:00
  ID_USB_DRIVER:   MOSCHIP usb-ethernet driver
  ID_VENDOR_FROM_DATABASE: MosChip Semiconductor
  ID_MODEL_FROM_DATABASE:  MCS7830 10/100 Mbps Ethernet adapter
  ID_MM_CANDIDATE: 1

--
Name: 1-1:1.0
Type: usb_interface
Subsys:   usb
Number:   0
Path: /sys/devices/platform/at91_ohci/usb1/1-1/1-1:1.0
Driver:   MOSCHIP usb-ethernet driver
Action:   (null)
Seq Num:  0
Dev File: (null)

Properties:
  UDEV_LOG:  3
  DEVPATH:   /devices/platform/at91_ohci/usb1/1-1/1-1:1.0
  DEVTYPE:   usb_interface
  DRIVER:MOSCHIP usb-ethernet driver
  PRODUCT:   9710/7830/100
  TYPE:  255/0/255
  INTERFACE: 255/0/255
  MODALIAS:  usb:v9710p7830d0100dcFFdsc00dpFFicFFisc00ipFF
  SUBSYSTEM: usb

--
Name: 1-1
Type: usb_device
Subsys:   usb
Number:   1
Path: /sys/devices/platform/at91_ohci/usb1/1-1
Driver:   usb
Action:   (null)
Seq Num:  0
Dev File: /dev/bus/usb/001/003

Properties:
  UDEV_LOG:  3
  DEVPATH:   /devices/platform/at91_ohci/usb1/1-1
  MAJOR: 189
  MINOR: 2
  DEVNAME:   /dev/bus/usb/001/003
  DEVTYPE:   usb_device
  DRIVER:usb
  PRODUCT:   9710/7830/100
  TYPE:  255/0/255
  BUSNUM:001
  DEVNUM:003
  SUBSYSTEM: usb
  ID_VENDOR: Moschip_Semiconductor
  ID_VENDOR_ENC: Moschip\x20Semiconductor
  ID_VENDOR_ID:  9710
  ID_MODEL:  USB-MAC_Controller
  ID_MODEL_ENC:  USB-MAC\x20Controller\x20\x20\x20
  ID_MODEL_ID:   7830
  ID_REVISION:   0100
  ID_SERIAL: Moschip_Semiconductor_USB-MAC_Controller_3b00082f
  ID_SERIAL_SHORT:   3b00082f
  ID_BUS:usb
  ID_USB_INTERFACES: :ff00ff:
  DEVLINKS:  /dev/char/189:2

--
Name: usb1
Type: usb_device
Subsys:   usb
Number:   1
Path: /sys/devices/platform/at91_ohci/usb1
Driver:   usb
Action:   (null)
Seq Num:  0
Dev File: /dev/bus/usb/001/001

Properties:
  UDEV_LOG:  3
  DEVPATH:   /devices/platform/at91_ohci/usb1
  

problem with dhcp: /var/lib/dhcp/dhclient-be2...c4-eth4.lease line 34: semicolon expected.

2011-05-02 Thread Thomas Bechtold

Hi,

i have a problem with NM 0.8.4 and dhcp:

Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 1 of 5 (Device Prepare) started...
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 2 of 5 (Device Configure) scheduled...
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 1 of 5 (Device Prepare) complete.
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 2 of 5 (Device Configure) starting...
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  (eth4): 
device state change: 4 -> 5 (reason 0)
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 2 of 5 (Device Configure) successful.
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 3 of 5 (IP Configure Start) scheduled.
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 2 of 5 (Device Configure) complete.
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 3 of 5 (IP Configure Start) started...
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  (eth4): 
device state change: 5 -> 7 (reason 0)
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Beginning DHCPv4 transaction (timeout in 45 seconds)
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
dhclient started with pid 1159
Jan  1 00:08:07 meteo-40 daemon.info NetworkManager[760]:  
Activation (eth4) Stage 3 of 5 (IP Configure Start) complete.
Jan  1 00:08:07 meteo-40 daemon.info dhclient: Internet Systems 
Consortium DHCP Client 4.1.1-P1
Jan  1 00:08:07 meteo-40 daemon.info dhclient: Copyright 2004-2010 
Internet Systems Consortium.

Jan  1 00:08:07 meteo-40 daemon.info dhclient: All rights reserved.
Jan  1 00:08:07 meteo-40 daemon.info dhclient: For info, please visit 
https://www.isc.org/software/dhcp/

Jan  1 00:08:07 meteo-40 daemon.info dhclient:
Jan  1 00:08:07 meteo-40 daemon.err dhclient: 
/var/lib/dhcp/dhclient-be2ae05f-b04d-dcf6-efa3-1e63e0f0e111-eth4.lease 
line 34: semicolon expected.

Jan  1 00:08:07 meteo-40 daemon.err dhclient: }
Jan  1 00:08:07 meteo-40 daemon.err dhclient:  ^
Jan  1 00:08:07 meteo-40 daemon.err dhclient: 
/var/lib/dhcp/dhclient-be2ae05f-b04d-dcf6-efa3-1e63e0f0e111-eth4.lease 
line 34: unterminated lease declaration.

Jan  1 00:08:07 meteo-40 daemon.err dhclient: }
Jan  1 00:08:07 meteo-40 daemon.err dhclient:  ^






Cheers,

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


Re: ModemManager: 'org.freedesktop.DBus.Error.NoReply: Did not receive a reply.'

2011-04-04 Thread Thomas Bechtold
Am Montag, den 04.04.2011, 22:20 -0500 schrieb Dan Williams:
> On Tue, 2011-03-15 at 13:02 +0100, Thomas Bechtold wrote:
> > Hi,
> > 
> > i have a detected Modem and tried to send the SIM-PIN with the dbus 
> > method (with d-feet) 
> > org.freedesktop.ModemManager.Modem.Gsm.Card.SendPin() and get a dbus 
> > error back:
> > 
> > 'org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible 
> > causes include: the remote application did not send a reply, the message 
> > bus security policy blocked the reply, the reply timeout expired, or the 
> > network connection was broken.'
> 
> How long does it take to return that error?  Sometimes the unlock takes
> a while, and if the program uses a very short timeout, this could
> happen.  I'm not sure what d-feet uses offhand.  The other possibility
> of course is that ModemManager has a bug.  From the trace you've got
> there, it doesn't appear that MM should be rechecking the PIN state like
> that.  Any chance you can poke around in mm-generic-gsm.c where it
> checks the pin state and see what's going on?

The problem is, that the reply from the modem does not contain a "OK".
That's why MM repeats the request.
I have this behaviour with a Wavecom modem. Alexander Morgado [1] is
already working on this problem.


Cheers,

Tom


[1]
http://mail.gnome.org/archives/networkmanager-list/2011-March/msg00225.html 


> 
> Dan
> 
> > 
> > The debug output of modemmanager (it's the latest git version, 
> > 0c4b94458ac0a71d278ce1b711a022fdf96b3abf) is:
> > 
> > modem-manager[597]:   [1300190254.302326] [mm-serial-port.c:702] 
> > mm_serial_port_open(): (ttyACM3) opening serial port...
> > modem-manager[597]:  [1300190254.302770] [mm-serial-port.c:764] 
> > mm_serial_port_open(): (ttyACM3) device open count is 1 (open)
> > modem-manager[597]:  [1300190254.302829] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN=""'
> > modem-manager[597]:  [1300190256.961482] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
> > modem-manager[597]:  [1300190256.961575] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
> > modem-manager[597]:  [1300190257.005482] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
> > READY'
> > modem-manager[597]:  [1300190262.002825] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
> > modem-manager[597]:  [1300190262.020984] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
> > READY'
> > 
> > 
> > 
> > modem-manager[597]:  [1300190267.001354] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
> > modem-manager[597]:  [1300190267.020984] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
> > READY'
> > modem-manager[597]:  [1300190272.001748] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
> > modem-manager[597]:  [1300190272.017483] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
> > READY'
> > modem-manager[597]:  [1300190277.001042] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
> > modem-manager[597]:  [1300190277.020986] 
> > [mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
> > READY'
> > modem-manager[597]:  [1300190280.001790] [mm-serial-port.c:798] 
> > mm_serial_port_close(): (ttyACM3) device open count is 0 (close)
> > modem-manager[597]:   [1300190280.001826] [mm-serial-port.c:811] 
> > mm_serial_port_close(): (ttyACM3) closing serial port...
> > modem-manager[597]:   [1300190280.003664] [mm-serial-port.c:834] 
> > mm_serial_port_close(): (ttyACM3) serial port closed
> > 
> > 
> > So the AT-Command to set the SIM-PIN worked correct, but ModemManager 
> > tries to send the PIN again and again and the dbus method have a timeout?!
> > 
> > 
> > Any ideas,
> > 
> > Cheers,
> > 
> > Tom
> > ___
> > networkmanager-list mailing list
> > networkmanager-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/networkmanager-list
> 
> 



signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: Telit TER-GX400 on Ubuntu/Gumstix

2011-03-18 Thread Thomas Bechtold
Hi Andy,

Am Freitag, den 18.03.2011, 12:20 + schrieb Andy Maginnis:
> Dan,
> I just realised that modem-manager is still not displaying the debug
> messages.
> Is there something I need to enable at compile ?

No. you have to start modem-manager with the --debug option.
Use something like: 

sudo killall modem-manager && sudo modem-manager --debug

Cheers,

Tom





signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Problem with Wavecom/Sierra Wireless USB Modem

2011-03-15 Thread Thomas Bechtold

Hi,

i have a Sierra Wireless USB Modem and want to use this with 
ModemManager (latest git snapshot).


The modem is detected (generic plugin is used) and exported:

### BEGIN DEBUG MESSAGES ###

modem-manager[597]:   [1300189932.908285] [mm-serial-port.c:702] 
mm_serial_port_open(): (ttyACM3) opening serial port...
modem-manager[597]:  [1300189932.908886] [mm-serial-port.c:764] 
mm_serial_port_open(): (ttyACM3) device open count is 1 (open)
modem-manager[597]:  [1300189932.908929] [mm-plugin-base.c:838] 
try_open(): (ttyACM3): probe requested by plugin 'Generic'
modem-manager[597]:  [1300189933.009558] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+GCAP'
modem-manager[597]:  [1300189933.810361] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 
'AT+GCAP+GCAP: +CGSM, +FCLASSOK'
modem-manager[597]:  [1300189933.810450] [mm-serial-port.c:798] 
mm_serial_port_close(): (ttyACM3) device open count is 0 (close)
modem-manager[597]:   [1300189933.810469] [mm-serial-port.c:811] 
mm_serial_port_close(): (ttyACM3) closing serial port...
modem-manager[597]:   [1300189933.811758] [mm-serial-port.c:834] 
mm_serial_port_close(): (ttyACM3) serial port closed
modem-manager[597]:  [1300189933.812298] [mm-modem-base.c:155] 
mm_modem_base_add_port(): (ttyACM3) type primary claimed by 
/sys/devices/pci:00/:00:1d.7/usb2/2-2/2-2.1
modem-manager[597]:   [1300189933.812413] [mm-serial-port.c:702] 
mm_serial_port_open(): (ttyACM3) opening serial port...
modem-manager[597]:  [1300189933.812766] [mm-serial-port.c:764] 
mm_serial_port_open(): (ttyACM3) device open count is 1 (open)
modem-manager[597]:  [1300189933.812800] [mm-serial-port.c:764] 
mm_serial_port_open(): (ttyACM3) device open count is 2 (open)
modem-manager[597]:  [1300189933.812820] [mm-serial-port.c:764] 
mm_serial_port_open(): (ttyACM3) device open count is 3 (open)
modem-manager[597]:   [1300189933.812850] [mm-manager.c:557] 
do_grab_port(): (Generic): GSM modem 
/sys/devices/pci:00/:00:1d.7/usb2/2-2/2-2.1 claimed port ttyACM3
modem-manager[597]:  [1300189933.812872] [mm-manager.c:313] 
add_modem(): Added modem /sys/devices/pci:00/:00:1d.7/usb2/2-2/2-2.1
modem-manager[597]:  [1300189933.812891] [mm-manager.c:239] 
check_export_modem(): (tty/ttyACM3): outstanding support task prevents 
export of /sys/devices/pci:00/:00:1d.7/usb2/2-2/2-2.1
modem-manager[597]:  [1300189933.813022] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'ATE0'
modem-manager[597]:  [1300189933.818483] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'ATE0'
modem-manager[597]:  [1300189933.829476] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.829555] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+GMI'
modem-manager[597]:  [1300189933.844983] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- ' WAVECOM 
WIRELESS CPU'
modem-manager[597]:  [1300189933.848935] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.849010] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+GMM'
modem-manager[597]:  [1300189933.888982] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- ' 
MULTIBAND  900E  1800 '
modem-manager[597]:  [1300189933.893465] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.893549] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+GMR'
modem-manager[597]:  [1300189933.908954] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 
'R7.42.0.201003050914.GL6110 2131816 030510 09:14'
modem-manager[597]:  [1300189933.913007] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.913087] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CGMI'
modem-manager[597]:  [1300189933.931453] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- ' WAVECOM 
WIRELESS CPU'
modem-manager[597]:  [1300189933.932938] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.933010] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CGMM'
modem-manager[597]:  [1300189933.949479] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- ' 
MULTIBAND  900E  1800 '
modem-manager[597]:  [1300189933.952944] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.953006] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CGMR'
modem-manager[597]:  [1300189933.968942] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 
'R7.42.0.201003050914.GL6110 2131816 030510 09:14'
modem-manager[597]:  [1300189933.973044] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300189933.973124] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'ATI'
modem-manager[597]:  [1300189933.985464] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- ' WAVECOM 
WIRELESS CPU'
modem-manager[597]:  [1300189933.990769] 
[mm-at-serial-port.c:298] debug_log

ModemManager: 'org.freedesktop.DBus.Error.NoReply: Did not receive a reply.'

2011-03-15 Thread Thomas Bechtold

Hi,

i have a detected Modem and tried to send the SIM-PIN with the dbus 
method (with d-feet) 
org.freedesktop.ModemManager.Modem.Gsm.Card.SendPin() and get a dbus 
error back:


'org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible 
causes include: the remote application did not send a reply, the message 
bus security policy blocked the reply, the reply timeout expired, or the 
network connection was broken.'




The debug output of modemmanager (it's the latest git version, 
0c4b94458ac0a71d278ce1b711a022fdf96b3abf) is:


modem-manager[597]:   [1300190254.302326] [mm-serial-port.c:702] 
mm_serial_port_open(): (ttyACM3) opening serial port...
modem-manager[597]:  [1300190254.302770] [mm-serial-port.c:764] 
mm_serial_port_open(): (ttyACM3) device open count is 1 (open)
modem-manager[597]:  [1300190254.302829] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN=""'
modem-manager[597]:  [1300190256.961482] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- 'OK'
modem-manager[597]:  [1300190256.961575] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
modem-manager[597]:  [1300190257.005482] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
READY'
modem-manager[597]:  [1300190262.002825] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
modem-manager[597]:  [1300190262.020984] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
READY'




modem-manager[597]:  [1300190267.001354] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
modem-manager[597]:  [1300190267.020984] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
READY'
modem-manager[597]:  [1300190272.001748] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
modem-manager[597]:  [1300190272.017483] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
READY'
modem-manager[597]:  [1300190277.001042] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): --> 'AT+CPIN?'
modem-manager[597]:  [1300190277.020986] 
[mm-at-serial-port.c:298] debug_log(): (ttyACM3): <-- '+CPIN: 
READY'
modem-manager[597]:  [1300190280.001790] [mm-serial-port.c:798] 
mm_serial_port_close(): (ttyACM3) device open count is 0 (close)
modem-manager[597]:   [1300190280.001826] [mm-serial-port.c:811] 
mm_serial_port_close(): (ttyACM3) closing serial port...
modem-manager[597]:   [1300190280.003664] [mm-serial-port.c:834] 
mm_serial_port_close(): (ttyACM3) serial port closed



So the AT-Command to set the SIM-PIN worked correct, but ModemManager 
tries to send the PIN again and again and the dbus method have a timeout?!



Any ideas,

Cheers,

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


Can not compile 0.8.4-beta3 - implicit declaration of function ‘g_key_file_get_uint64’

2011-03-11 Thread Thomas Bechtold

Hi,

i can not compile (on debian squeeze) the 0.8.4-beta3 version of NM.

...
cc1: warnings being treated as errors
nm-sysconfig-settings.c: In function ‘claim_connection’:
nm-sysconfig-settings.c:541: error: implicit declaration of function 
‘g_key_file_get_uint64’

At top level:
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"
...


Cheers,

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


[PATCH] Custom init response callback for ModemManager

2011-03-07 Thread Thomas Bechtold
Hi,

the attached patch adds the possibility to ModemManager to use a custom
init response callback for
mm_plugin_base_supports_task_set_custom_init_command().

This is useful if you can detect the modem just with eg the answer of
the ATI at-cmd.

Any comments?

Tom
diff --git a/plugins/mm-plugin-zte.c b/plugins/mm-plugin-zte.c
index bb2ee17..edc6dd4 100644
--- a/plugins/mm-plugin-zte.c
+++ b/plugins/mm-plugin-zte.c
@@ -113,7 +113,7 @@ supports_port (MMPluginBase *base,
  * 	1235f71b20c92cded4abd976ccc5010649aae1a0 and
  * 	f38ad328acfdc6ce29dd1380602c546b064161ae for more details.
  */
-mm_plugin_base_supports_task_set_custom_init_command (task, "ATE0+CPMS?", 3, 4, FALSE);
+mm_plugin_base_supports_task_set_custom_init_command (task, "ATE0+CPMS?", 3, 4, FALSE, NULL, NULL);
 
 if (mm_plugin_base_probe_port (base, task, NULL))
 return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS;
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c
index da8bc03..86fbd2b 100644
--- a/src/mm-plugin-base.c
+++ b/src/mm-plugin-base.c
@@ -115,6 +115,8 @@ typedef struct {
 guint32 custom_init_tries;
 guint32 custom_init_delay_seconds;
 gboolean custom_init_fail_if_timeout;
+MMBaseSupportsTaskCustomInitResultFunc custom_init_callback;
+gpointer custom_init_callback_data;
 
 MMSupportsPortResultFunc callback;
 gpointer callback_data;
@@ -229,7 +231,9 @@ mm_plugin_base_supports_task_set_custom_init_command (MMPluginBaseSupportsTask *
   const char *cmd,
   guint32 delay_seconds,
   guint32 max_tries,
-  gboolean fail_if_timeout)
+  gboolean fail_if_timeout,
+  MMBaseSupportsTaskCustomInitResultFunc callback,
+  gpointer callback_data)
 {
 MMPluginBaseSupportsTaskPrivate *priv;
 
@@ -243,6 +247,8 @@ mm_plugin_base_supports_task_set_custom_init_command (MMPluginBaseSupportsTask *
 priv->custom_init_max_tries = max_tries;
 priv->custom_init_delay_seconds = delay_seconds;
 priv->custom_init_fail_if_timeout = fail_if_timeout;
+priv->custom_init_callback = callback;
+priv->custom_init_callback_data = callback_data;
 }
 
 static void
@@ -731,7 +737,7 @@ custom_init_response (MMAtSerialPort *port,
 {
 MMPluginBaseSupportsTask *task = MM_PLUGIN_BASE_SUPPORTS_TASK (user_data);
 MMPluginBaseSupportsTaskPrivate *task_priv = MM_PLUGIN_BASE_SUPPORTS_TASK_GET_PRIVATE (task);
-
+
 if (error) {
 task_priv->custom_init_tries++;
 if (task_priv->custom_init_tries < task_priv->custom_init_max_tries) {
@@ -745,6 +751,27 @@ custom_init_response (MMAtSerialPort *port,
 return;
 }
 }
+} else {
+//custom handle init response
+MMPluginBaseClass* klass = MM_PLUGIN_BASE_GET_CLASS(task_priv->plugin);
+if(klass->handle_custom_init_response != NULL)
+{
+klass->handle_custom_init_response(task, response);
+}
+}
+
+/* check for custom init callback */
+if(task_priv->custom_init_callback != NULL)
+{
+MMBaseSupportsTaskCustomInitResultFunc callback = (MMBaseSupportsTaskCustomInitResultFunc) task_priv->custom_init_callback;
+guint32 level = callback(response, task_priv->custom_init_callback_data);
+if(level > 0)
+{
+/* Plugin supports the modem */
+task_priv->probed_caps = level;
+probe_complete(task);
+return;
+}
 }
 
 /* Otherwise proceed to probing */
@@ -1243,6 +1270,7 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass)
 g_type_class_add_private (object_class, sizeof (MMPluginBasePrivate));
 
 klass->handle_probe_response = real_handle_probe_response;
+klass->handle_custom_init_response = NULL;
 
 /* Virtual methods */
 object_class->get_property = get_property;
diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h
index a32d53b..fa67c0a 100644
--- a/src/mm-plugin-base.h
+++ b/src/mm-plugin-base.h
@@ -56,6 +56,9 @@ typedef struct {
 
 GType mm_plugin_base_supports_task_get_type (void);
 
+typedef guint32 (*MMBaseSupportsTaskCustomInitResultFunc) (GString* response,
+   gpointer user_data);
+
 MMPlugin *mm_plugin_base_supports_task_get_plugin (MMPluginBaseSupportsTask *task);
 
 GUdevDevice *mm_plugin_base_supports_task_get_port (MMPluginBaseSupportsTask *task);
@@ -73,7 +76,9 @@ void mm_plugin_base_supports_task_set_custom_init_command (MMPluginBaseSupportsT
const char *cmd,
guint32 delay_seconds,
  

Howto rescan for modems on RS232 port with udevadm

2011-03-03 Thread Thomas Bechtold

Hi,

i changed the udev rule 77-mm-platform-serial-whitelist.rules to:

### ModemManager: only check /dev/ttyS1 (atmel_usart.1) ###
ACTION!="add|change", 
GOTO="mm_platform_device_whitelist_end"whitelist.rules.real

SUBSYSTEM!="platform", GOTO="mm_platform_device_whitelist_end"
DRIVERS=="atmel_usart", KERNELS=="atmel_usart.1", 
ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"

LABEL="mm_platform_device_whitelist_end"


The modem detection works, but i need a modem rescan (eg attach a rs232 
modem after modemmanager started).


I tried to do this with udevadm:

# udevadm trigger --action=add --subsystem-match=tty 
--subsystem-match=platform --sysname-match=ttyS1 --verbose

/sys/devices/platform/atmel_usart.1/tty/ttyS1


But MM does nothing. When i execute the command with ttyS0, the output is:
# udevadm trigger --action=add --subsystem-match=tty 
--subsystem-match=platform --sysname-match=ttyS0 --verbose

/sys/devices/platform/atmel_usart.1/tty/ttyS0
modem-manager[772]:  [1299145393.216952] [mm-manager.c:802] 
device_added(): (tty/ttyS0): port's parent platform driver is not 
whitelisted




Any ideas how to solve this?

Cheers,

Tom





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