Re: IP address and Name server configuration using dbus-send
Hi, I would like to configure ip addess and name server manually for my connection using connman. I would like to configure using dbus-send. Can any body please help me in this. # dbus-send --system --print-reply --dest=org.moblin.connman /profile/default/wifi_123419bd1234_12346f123465723031_managed_psk org.moblin.connman.Service.SetProperty string:Nameservers.Configuration variant:string:109.33.192.134 *Error org.moblin.connman.Error.InvalidArguments: Invalid arguments* Please let me know how to configure both name server and ip config using dbus-send. actually I don't think you can do it with dbus-send. There are some data types that are not supported by dbus-send. ConnMan ships with many examples in Python in the test/ directory. Have a look there for settings domainnames and IP address. Regards Marcel ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[PATCH proxy-manual] connman manual proxy support
Hi, the following patches implement manual proxy support for connman. The last patch (5) implements a plugin for setting up the proxy settings in gconf (for legacy apps). Jukka ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[PATCH proxy-manual 1/5] Add manual proxy description
--- doc/service-api.txt | 69 +- 1 files changed, 67 insertions(+), 2 deletions(-) diff --git a/doc/service-api.txt b/doc/service-api.txt index c1dd541..b8b694b 100644 --- a/doc/service-api.txt +++ b/doc/service-api.txt @@ -410,13 +410,78 @@ Propertiesstring State [readonly] If no automatic configuration is available, then direct is set. - The values auto and manual are not yet - supported. + The value auto is not yet supported. string URL [readonly] Automatic proxy configuration URL. + string Http [readonly] + + Address/hostname for HTTP proxy. Used when + Method is manual + + uint16 HttpPort [readonly] + + Port number for HTTP proxy. Used if Http has + a value. + + string Https [readonly] + + Address/hostname for HTTPS proxy. Used when + Method is manual + + uint16 HttpsPort [readonly] + + Port number for HTTPS proxy. Used if Https has + a value. + + string Ftp [readonly] + + Address/hostname for FTP proxy. Used when + Method is manual + + uint16 FtpPort [readonly] + + Port number for FTP proxy. Used if Ftp has + a value. + + string Socks [readonly] + + Address/hostname for socks proxy. Used when + Method is manual + + uint16 SocksPort [readonly] + + Port number for socks proxy. Used if Socks has + a value. + + string Rtsp [readonly] + + Address/hostname for RTSP proxy. Used when + Method is manual + + uint16 RtspPort [readonly] + + Port number for RTSP proxy. Used if Rtsp has + a value. + + array{string} Ignore [readonly] + + List of networks or hostnames that do not + have a proxy. + + dict Proxy.Configuration [readwrite] + + Same values as Proxy property. The Proxy represents + the actual system configuration while this allows + user configuration. + + The proxy port must be set the same time as proxy host + when saving initial entry. It is possible to update + the port and host individually of an existing proxy + setting. + dict Provider [readonly] string Host [readonly] -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[PATCH proxy-manual 3/5] Add test script for setting up proxy
--- Makefile.am|3 +- test/set-proxy | 74 2 files changed, 76 insertions(+), 1 deletions(-) create mode 100755 test/set-proxy diff --git a/Makefile.am b/Makefile.am index 1bf7207..128d4b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -179,7 +179,8 @@ test_scripts = test/get-state test/list-profiles test/list-services \ test/monitor-manager test/test-counter test/set-ip-method \ test/set-nameservers test/set-domains test/find-service \ test/get-services test/get-proxy-autoconfig \ - test/enable-tethering test/disable-tethering test/backtrace + test/enable-tethering test/disable-tethering test/backtrace \ + test/set-proxy if TEST testdir = $(pkglibdir)/test diff --git a/test/set-proxy b/test/set-proxy new file mode 100755 index 000..35a4bf1 --- /dev/null +++ b/test/set-proxy @@ -0,0 +1,74 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) 2): + print Usage: %s service [direct|auto|manual|auto-config] [url=pac-url] [http=host:port] [https=host:port] [ftp=host:port] [socks=host:port] [rtsp=host:port] [ignore=host1,host2,...] % (sys.argv[0]) + print Example: %s service0 manual http=http.proxy.example.com:8080 rtsp= % sys.argv[0] + print This would set the http proxy and clear the rtsp proxy values + sys.exit(1) + +bus = dbus.SystemBus() +path = /profile/default/ + sys.argv[1] +service = dbus.Interface(bus.get_object('org.moblin.connman', path), + 'org.moblin.connman.Service') +values = {} +values[Method] = sys.argv[2] + +properties = service.GetProperties() + +for arg in sys.argv[3:]: + if arg.startswith(url=): + url = arg.replace(url=, , 1) + #print url: %s % url + values[URL] = url + if arg.startswith(http=): + try: + (host, port) = arg.replace(http=,,1).split(:) + except: + (host, port) = (, 0) + #print http: %s:%s % (host, port) + values[Http] = host + values[HttpPort] = dbus.UInt16(port) + if arg.startswith(https=): + try: + (host, port) = arg.replace(https=,,1).split(:) + except: + (host, port) = (, 0) + #print https: %s:%s % (host, port) + values[Https] = host + values[HttpsPort] = dbus.UInt16(port) + if arg.startswith(ftp=): + try: + (host, port) = arg.replace(ftp=,,1).split(:) + except: + (host, port) = (, 0) + #print ftp: %s:%s % (host, port) + values[Ftp] = host + values[FtpPort] = dbus.UInt16(port) + if arg.startswith(socks=): + try: + (host, port) = arg.replace(socks=,,1).split(:) + except: + (host, port) = (, 0) + #print socks: %s:%s % (host, port) + values[Socks] = host + values[SocksPort] = dbus.UInt16(port) + if arg.startswith(rtsp=): + try: + (host, port) = arg.replace(rtsp=,,1).split(:) + except: + (host, port) = (, 0) + #print rtsp: %s:%s % (host, port) + values[Rtsp] = host + values[RtspPort] = dbus.UInt16(port) + if arg.startswith(ignore=): + try: + ignore_hosts = arg.replace(ignore=,,1).split(,) + except: + ignore_hosts = [] + #print ignore: %s % ignore_hosts + values[Ignore] = ignore_hosts + +service.SetProperty(Proxy.Configuration, dbus.Dictionary(values, signature = sv)) -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[PATCH proxy-manual 4/5] Pretty print proxy data
--- test/get-services |9 ++--- test/list-providers |8 ++-- test/list-services|8 ++-- test/monitor-services | 10 +++--- test/test-manager |8 ++-- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/test/get-services b/test/get-services index d337e0c..b4b849a 100755 --- a/test/get-services +++ b/test/get-services @@ -6,7 +6,10 @@ def extract_values(values): val = { for key in values.keys(): val += + key + = - val += str(values[key]) + if key in [Ignore]: + val += extract_list(values[key]) + else: + val += str(values[key]) val += } return val @@ -33,8 +36,8 @@ for entry in services: for key in properties.keys(): if key in [IPv4, IPv4.Configuration, IPv6, IPv6.Configuration, - Proxy, Ethernet, - Provider]: + Proxy, Ethernet, Provider, + Proxy.Configuration]: val = extract_values(properties[key]) elif key in [Nameservers, Nameservers.Configuration, Domains, Domains.Configuration]: diff --git a/test/list-providers b/test/list-providers index 94375d5..6c74a1d 100755 --- a/test/list-providers +++ b/test/list-providers @@ -9,7 +9,10 @@ def extract_values(values): if key in [PrefixLength]: val += %s % (int(values[key])) else: - val += str(values[key]) + if key in [Ignore]: + val += extract_list(values[key]) + else: + val += str(values[key]) val += } return val @@ -38,7 +41,8 @@ for path in properties[Providers]: for key in properties.keys(): if key in [IPv4, IPv4.Configuration, IPv6, IPv6.Configuration, - Proxy, Ethernet, Provider]: + Proxy, Proxy.Configuration, + Ethernet, Provider]: val = extract_values(properties[key]) elif key in [Nameservers, Nameservers.Configuration, Domains, Domains.Configuration]: diff --git a/test/list-services b/test/list-services index a894092..bf225de 100755 --- a/test/list-services +++ b/test/list-services @@ -9,7 +9,10 @@ def extract_values(values): if key in [PrefixLength]: val += %s % (int(values[key])) else: - val += str(values[key]) + if key in [Ignore]: + val += extract_list(values[key]) + else: + val += str(values[key]) val += } return val @@ -38,7 +41,8 @@ for path in properties[Services]: for key in properties.keys(): if key in [IPv4, IPv4.Configuration, IPv6, IPv6.Configuration, - Proxy, Ethernet, Provider]: + Proxy, Proxy.Configuration, + Ethernet, Provider]: val = extract_values(properties[key]) elif key in [Nameservers, Nameservers.Configuration, Domains, Domains.Configuration]: diff --git a/test/monitor-services b/test/monitor-services index 05d1e1d..ead9d36 100755 --- a/test/monitor-services +++ b/test/monitor-services @@ -9,7 +9,10 @@ def extract_values(values): val = { for key in values.keys(): val += + key + = - val += str(values[key]) + if key in [Ignore]: + val += extract_list(values[key]) + else: + val += str(values[key]) val += } return val @@ -29,8 +32,9 @@ def property_changed(name, value, path): val = val + + i[i.rfind(/) + 1:] val = val + ] elif name in [IPv4, IPv4.Configuration, - IPv6, IPv6.Configuration, - Proxy, Ethernet]: + IPv6, IPv6.Configuration, + Proxy, Proxy.Configuration, + Ethernet]: val = extract_values(value) elif name in [Nameservers, Nameservers.Configuration, Domains, Domains.Configuration]: diff --git a/test/test-manager b/test/test-manager index b5a2530..da23e8d
[PATCH proxy-manual 5/5] Add plugin for setting up proxy data in gconf
--- Makefile.plugins |7 ++ configure.ac | 10 +++ plugins/proxygconf.c | 183 ++ 3 files changed, 200 insertions(+), 0 deletions(-) create mode 100644 plugins/proxygconf.c diff --git a/Makefile.plugins b/Makefile.plugins index 4ca78d3..2f15d85 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -230,6 +230,13 @@ plugins_ntpd_la_LDFLAGS = $(plugin_ldflags) endif endif +if PROXYGCONF +plugin_LTLIBRARIES += plugins/proxygconf.la +plugin_objects += $(plugins_proxygconf_la_OBJECTS) +plugins_proxygconf_la_CFLAGS = $(plugin_cflags) @GCONF_CFLAGS@ +plugins_proxygconf_la_LDFLAGS = $(plugin_ldflags) @GCONF_LIBS@ +endif + EXTRA_DIST += plugins/polkit.policy scripts/dhclient.conf plugins/connman.policy: plugins/polkit.policy diff --git a/configure.ac b/configure.ac index 6923aa1..ddba330 100644 --- a/configure.ac +++ b/configure.ac @@ -368,5 +368,15 @@ AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles], [enable_datafiles=${enableval}]) AM_CONDITIONAL(DATAFILES, test ${enable_datafiles} != no) +AC_ARG_ENABLE(proxygconf, AC_HELP_STRING([--enable-proxygconf], + [enable proxy GConf support]), [enable_proxygconf=${enableval}]) +AM_CONDITIONAL(PROXYGCONF, test ${enable_proxygconf} = yes) +if (test ${enable_proxygconf} = yes); then + PKG_CHECK_MODULES(GCONF, gconf-2.0, dummy=yes, + AC_MSG_ERROR(gconf library is required)) + AC_SUBST(GCONF_CFLAGS) + AC_SUBST(GCONF_LIBS) +fi + AC_OUTPUT(Makefile include/version.h src/connman.service scripts/connman doc/version.xml connman.pc) diff --git a/plugins/proxygconf.c b/plugins/proxygconf.c new file mode 100644 index 000..2987567 --- /dev/null +++ b/plugins/proxygconf.c @@ -0,0 +1,183 @@ +/* + * Save proxy settings to gconf. + * + * Copyright (C) 2010 Nokia Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include stdio.h + +#define CONNMAN_API_SUBJECT_TO_CHANGE +#include connman/plugin.h +#include connman/storage.h +#include connman/log.h + +#include gconf/gconf-client.h + +#define CONF_PROXY /system/proxy +#define HTTP_PROXY /system/http_proxy + + +static void set(GConfClient *gconf, + const char *host_path, const char *host, + const char *port_path, uint16_t port) +{ + if (host host[0]) { + gconf_client_set_string(gconf, host_path, host, NULL); + if (port_path) + gconf_client_set_int(gconf, port_path, port, NULL); + } else { + gconf_client_unset(gconf, host_path, NULL); + if (port_path) + gconf_client_unset(gconf, port_path, NULL); + } +} + +static void clear_entries(GConfClient *gconf) +{ + gconf_client_unset(gconf, CONF_PROXY /mode, NULL); + gconf_client_unset(gconf, CONF_PROXY /secure_host, NULL); + gconf_client_unset(gconf, CONF_PROXY /secure_port, NULL); + gconf_client_unset(gconf, CONF_PROXY /ftp_host, NULL); + gconf_client_unset(gconf, CONF_PROXY /ftp_port, NULL); + gconf_client_unset(gconf, CONF_PROXY /socks_host, NULL); + gconf_client_unset(gconf, CONF_PROXY /socks_port, NULL); + gconf_client_unset(gconf, CONF_PROXY /rtsp_host, NULL); + gconf_client_unset(gconf, CONF_PROXY /rtsp_port, NULL); + + gconf_client_unset(gconf, HTTP_PROXY /host, NULL); + gconf_client_unset(gconf, HTTP_PROXY /port, NULL); + gconf_client_unset(gconf, HTTP_PROXY /ignore_hosts, NULL); + gconf_client_unset(gconf, HTTP_PROXY /use_http_proxy, NULL); +} + +static int proxy_save(struct connman_service *service) +{ + GConfClient *gconf; + struct connman_manual_proxy *proxy; + enum connman_service_proxy_method method; + + DBG(); + + gconf = gconf_client_get_default(); + + proxy = connman_service_get_default_proxy(service, method); + if (!proxy) { + clear_entries(gconf); + goto out; + } + + if (method != CONNMAN_SERVICE_PROXY_METHOD_MANUAL) { + clear_entries(gconf); + goto out; + } + + set(gconf, CONF_PROXY /mode, manual,
[ofono-refactor-v2 PATCH 05/17] ofono: fix stale data usage
From: Pekka Pessi pekka.pe...@nokia.com --- plugins/ofono.c | 22 ++ 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 5ac77f5..816a4d7 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -771,12 +771,20 @@ static void add_default_context(DBusMessageIter *array, static void check_networks_reply(DBusPendingCall *call, void *user_data) { - struct connman_device *device = user_data; + char *path = user_data; + struct modem_data *modem; + struct connman_device *device; DBusMessage *reply; DBusMessageIter array, dict, contexts; dbus_bool_t attached; - DBG(device %p, device); + DBG(path %s, path); + + modem = g_hash_table_lookup(modem_hash, path); + if (modem == NULL || modem-device == NULL) + return; + + device = modem-device; reply = dbus_pending_call_steal_reply(call); @@ -834,15 +842,13 @@ static void check_networks(struct modem_data *modem) { DBusMessage *message; DBusPendingCall *call; - struct connman_device *device; DBG(modem %p, modem); if (modem == NULL) return; - device = modem-device; - if (device == NULL) + if (modem-device == NULL) return; message = dbus_message_new_method_call(OFONO_SERVICE, modem-path, @@ -864,7 +870,7 @@ static void check_networks(struct modem_data *modem) } dbus_pending_call_set_notify(call, check_networks_reply, - (void *)device, NULL); + g_strdup(modem-path), g_free); done: dbus_message_unref(message); @@ -1008,7 +1014,7 @@ static void get_imsi(const char *path) } dbus_pending_call_set_notify(call, sim_properties_reply, - (void *)path, NULL); + g_strdup(path), g_free); done: dbus_message_unref(message); @@ -1159,7 +1165,7 @@ static void get_modem_properties(struct modem_data *modem) } dbus_pending_call_set_notify(call, modem_properties_reply, - (void *)modem-path, NULL); + g_strdup(modem-path), g_free); done: dbus_message_unref(message); -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 14/17] ofono: refactor modem_has_gprs()
From: Pekka Pessi pekka.pe...@nokia.com --- plugins/ofono.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index d9c7365..81e0137 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -931,18 +931,19 @@ static struct modem_data *add_modem(const char *path) return modem; } -static gboolean modem_has_gprs(DBusMessageIter *array) +static gboolean modem_has_interface(DBusMessageIter *array, + char const *interface) { DBusMessageIter entry; dbus_message_iter_recurse(array, entry); while (dbus_message_iter_get_arg_type(entry) == DBUS_TYPE_STRING) { - const char *interface; + const char *element; - dbus_message_iter_get_basic(entry, interface); + dbus_message_iter_get_basic(entry, element); - if (g_strcmp0(OFONO_GPRS_INTERFACE, interface) == 0) + if (g_strcmp0(interface, element) == 0) return TRUE; dbus_message_iter_next(entry); @@ -951,6 +952,11 @@ static gboolean modem_has_gprs(DBusMessageIter *array) return FALSE; } +static gboolean modem_has_gprs(DBusMessageIter *array) +{ + return modem_has_interface(array, OFONO_GPRS_INTERFACE); +} + static void modem_properties_reply(DBusPendingCall *call, void *user_data) { DBusMessage *reply; -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 06/17] ofono: avoid race between signals and methods
From: Pekka Pessi pekka.pe...@nokia.com Create modem only after Modem.GetProperties succeeds, thus avoiding races with Modem.PropertyChanged signal. Do not call Modem.GetProperties again while modem exists. --- plugins/ofono.c | 53 ++--- 1 files changed, 34 insertions(+), 19 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 816a4d7..e5d4187 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -1033,6 +1033,8 @@ static struct modem_data *add_modem(const char *path) { struct modem_data *modem; + DBG(path %s, path); + if (path == NULL) return NULL; @@ -1082,11 +1084,17 @@ static void modem_properties_reply(DBusPendingCall *call, void *user_data) DBusError error; DBusMessageIter array, dict; const char *path = user_data; + dbus_bool_t powered = FALSE; + gboolean has_gprs = FALSE; + struct modem_data *new_modem; DBG(path %s, path); reply = dbus_pending_call_steal_reply(call); + if (g_hash_table_lookup(modem_hash, path)) + goto done; + dbus_error_init(error); if (dbus_set_error_from_message(error, reply)) { @@ -1107,7 +1115,6 @@ static void modem_properties_reply(DBusPendingCall *call, void *user_data) while (dbus_message_iter_get_arg_type(dict) == DBUS_TYPE_DICT_ENTRY) { DBusMessageIter entry, value; const char *key; - dbus_bool_t powered; dbus_message_iter_recurse(dict, entry); dbus_message_iter_get_basic(entry, key); @@ -1115,38 +1122,41 @@ static void modem_properties_reply(DBusPendingCall *call, void *user_data) dbus_message_iter_next(entry); dbus_message_iter_recurse(entry, value); - if (g_str_equal(key, Powered) == TRUE) { + if (g_str_equal(key, Powered) == TRUE) dbus_message_iter_get_basic(value, powered); - - if (powered == FALSE) { - modem_change_powered(path, TRUE); - break; - } - } else if (g_str_equal(key, Interfaces) == TRUE) { - if (modem_has_gprs(value) == TRUE) - get_imsi(path); - } + else if (g_str_equal(key, Interfaces) == TRUE) + has_gprs = modem_has_gprs(value); dbus_message_iter_next(dict); } + new_modem = add_modem(path); + if (new_modem == NULL) + goto done; + + if (!powered) + modem_change_powered(path, TRUE); + + if (has_gprs) + get_imsi(path); + done: dbus_message_unref(reply); dbus_pending_call_unref(call); } -static void get_modem_properties(struct modem_data *modem) +static void get_modem_properties(const char *path) { DBusMessage *message; DBusPendingCall *call; - DBG(path %s, modem-path); + DBG(path %s, path); - if (modem-path == NULL) + if (path == NULL) return; - message = dbus_message_new_method_call(OFONO_SERVICE, modem-path, + message = dbus_message_new_method_call(OFONO_SERVICE, path, OFONO_MODEM_INTERFACE, GET_PROPERTIES); if (message == NULL) return; @@ -1165,7 +1175,7 @@ static void get_modem_properties(struct modem_data *modem) } dbus_pending_call_set_notify(call, modem_properties_reply, - g_strdup(modem-path), g_free); + g_strdup(path), g_free); done: dbus_message_unref(message); @@ -1200,6 +1210,8 @@ static void update_modems(DBusMessageIter *array) { DBusMessageIter entry; + DBG(); + dbus_message_iter_recurse(array, entry); modems_set_unavailable(); @@ -1211,9 +1223,12 @@ static void update_modems(DBusMessageIter *array) dbus_message_iter_get_basic(entry, path); - modem = add_modem(path); - if (modem != NULL) - get_modem_properties(modem); + modem = g_hash_table_lookup(modem_hash, path); + + if (modem) + modem-available = TRUE; + else + get_modem_properties(path); dbus_message_iter_next(entry); } -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 13/17] ofono: refactor sim
From: Pekka Pessi pekka.pe...@nokia.com MCC and MNC are no more propagated to the service. --- plugins/ofono.c | 48 1 files changed, 4 insertions(+), 44 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index def33b6..d9c7365 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -649,14 +649,6 @@ static void add_network(struct connman_device *device, const char *path) connman_network_set_available(network, TRUE); connman_network_set_index(network, -1); - mcc = connman_device_get_string(device, MCC); - if (mcc != NULL) - connman_network_set_string(network, Cellular.MCC, mcc); - - mnc = connman_device_get_string(device, MNC); - if (mnc != NULL) - connman_network_set_string(network, Cellular.MNC, mnc); - if (connman_device_add_network(device, network) == 0) return; @@ -812,8 +804,7 @@ static void check_networks(struct modem_data *modem) DBUS_TYPE_INVALID); } -static void add_device(const char *path, const char *imsi, - const char *mcc, const char *mnc) +static void add_device(const char *path, const char *imsi) { struct modem_data *modem; struct connman_device *device; @@ -839,10 +830,6 @@ static void add_device(const char *path, const char *imsi, connman_device_set_mode(device, CONNMAN_DEVICE_MODE_NETWORK_MULTIPLE); connman_device_set_string(device, Path, path); - if (mcc != NULL) - connman_device_set_string(device, MCC, mcc); - if (mnc != NULL) - connman_device_set_string(device, MNC, mnc); if (connman_device_register(device) 0) { connman_device_unref(device); @@ -858,10 +845,6 @@ static void sim_properties_reply(DBusPendingCall *call, void *user_data) { const char *path = user_data; const char *imsi; - char *mcc = NULL; - char *mnc = NULL; - /* If MobileNetworkCodeLength is not provided, mnc_length is 0 */ - unsigned char mnc_length = 0; DBusMessage *reply; DBusMessageIter array, dict; @@ -887,37 +870,14 @@ static void sim_properties_reply(DBusPendingCall *call, void *user_data) dbus_message_iter_next(entry); dbus_message_iter_recurse(entry, value); - if (g_str_equal(key, SubscriberIdentity) == TRUE) + if (g_str_equal(key, SubscriberIdentity) == TRUE) { dbus_message_iter_get_basic(value, imsi); - /* -* 'MobileNetworkCodeLength' is deprecated since version 0.20, but -* keep it here for backward compatibility reasons. -*/ - else if (g_str_equal(key, MobileNetworkCodeLength) == TRUE) - dbus_message_iter_get_basic(value, - (void *) mnc_length); - else if (g_str_equal(key, MobileCountryCode) == TRUE) - dbus_message_iter_get_basic(value, - (void *) mcc); - else if (g_str_equal(key, MobileNetworkCode) == TRUE) - dbus_message_iter_get_basic(value, - (void *) mnc); + add_device(path, imsi); + } dbus_message_iter_next(dict); } - if (mnc_length == 2 || mnc_length == 3) { - mcc = g_strndup(imsi, 3); - mnc = g_strndup(imsi + 3, mnc_length); - } - - add_device(path, imsi, mcc, mnc); - - if (mnc_length == 2 || mnc_length == 3) { - g_free(mcc); - g_free(mnc); - } - done: dbus_message_unref(reply); -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 10/17] ofono: don't reuse identifier pending_network
From: Pekka Pessi pekka.pe...@nokia.com --- plugins/ofono.c | 16 +++- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index c92f360..46b26d0 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -496,8 +496,7 @@ static int network_probe(struct connman_network *network) static struct connman_network *pending_network; -static gboolean pending_network_is_available( - struct connman_network *pending_network) +static gboolean pending_network_is_available(struct connman_network *network) { struct connman_device *device; struct connman_network *network; @@ -505,17 +504,17 @@ static gboolean pending_network_is_available( char *ident; /* Modem may be removed during waiting for active reply */ - device = connman_network_get_device(pending_network); + device = connman_network_get_device(network); if (device == NULL) { DBG(Modem is removed); return FALSE; } - identifier = connman_network_get_identifier(pending_network); + identifier = connman_network_get_identifier(network); ident = g_strdup(identifier); - connman_network_unref(pending_network); + connman_network_unref(network); /* network may be removed during waiting for active reply */ network = connman_device_get_network(device, ident); @@ -1494,15 +1493,14 @@ static void cleanup_ipconfig(struct connman_element *parent) parent-ipv4.method = CONNMAN_IPCONFIG_METHOD_UNKNOWN; } -static int static_network_set_connected( - struct connman_network *pending_network, - struct connman_element *parent, +static int static_network_set_connected(struct connman_network *network, + struct connman_element *parent, connman_bool_t connected) { if (connected == FALSE) cleanup_ipconfig(parent); - connman_network_set_connected(pending_network, connected); + connman_network_set_connected(network, connected); return 0; } -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 02/17] service: don't keep ref to a removed network
From: Pekka Pessi pekka.pe...@nokia.com --- src/service.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/service.c b/src/service.c index eb467a0..ca4cfb4 100644 --- a/src/service.c +++ b/src/service.c @@ -3644,6 +3644,12 @@ void __connman_service_remove_from_network(struct connman_network *network) if (service == NULL) return; + if (service-network == NULL) + return; + + connman_network_unref(service-network); + service-network = NULL; + __connman_service_put(service); } -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 15/17] device: add connman_device_get_ident()
From: Pekka Pessi pekka.pe...@nokia.com Expose former core function __connman_device_get_ident(). --- include/device.h |1 + src/connman.h|1 - src/device.c |2 +- src/network.c|2 +- src/service.c|2 +- 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/device.h b/include/device.h index b4bb297..a5ed412 100644 --- a/include/device.h +++ b/include/device.h @@ -70,6 +70,7 @@ const char *connman_device_get_control(struct connman_device *device); void connman_device_set_ident(struct connman_device *device, const char *ident); +const char *connman_device_get_ident(struct connman_device *device); void connman_device_set_mode(struct connman_device *device, enum connman_device_mode mode); diff --git a/src/connman.h b/src/connman.h index f5b03c8..95bc164 100644 --- a/src/connman.h +++ b/src/connman.h @@ -362,7 +362,6 @@ void __connman_device_set_reconnect(struct connman_device *device, connman_bool_t __connman_device_get_reconnect(struct connman_device *device); const char *__connman_device_get_type(struct connman_device *device); -const char *__connman_device_get_ident(struct connman_device *device); int __connman_device_set_offlinemode(connman_bool_t offlinemode); diff --git a/src/device.c b/src/device.c index 93da00b..ef0a86d 100644 --- a/src/device.c +++ b/src/device.c @@ -951,7 +951,7 @@ void connman_device_set_ident(struct connman_device *device, device-ident = g_strdup(ident); } -const char *__connman_device_get_ident(struct connman_device *device) +const char *connman_device_get_ident(struct connman_device *device) { return device-ident; } diff --git a/src/network.c b/src/network.c index 15f4f1e..2b92e6f 100644 --- a/src/network.c +++ b/src/network.c @@ -567,7 +567,7 @@ const char *__connman_network_get_ident(struct connman_network *network) if (network-device == NULL) return NULL; - return __connman_device_get_ident(network-device); + return connman_device_get_ident(network-device); } connman_bool_t __connman_network_get_weakness(struct connman_network *network) diff --git a/src/service.c b/src/service.c index ca4cfb4..e4033a4 100644 --- a/src/service.c +++ b/src/service.c @@ -3013,7 +3013,7 @@ int __connman_service_create_and_connect(DBusMessage *msg) if (device == NULL) return -EOPNOTSUPP; - ident = __connman_device_get_ident(device); + ident = connman_device_get_ident(device); if (ident == NULL) return -EOPNOTSUPP; -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 09/17] ofono: fix add_network()
From: Pekka Pessi pekka.pe...@nokia.com Protect against duplication, remove leak. --- plugins/ofono.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 76759b4..c92f360 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -654,18 +654,19 @@ static void add_network(struct connman_device *device, const char *path) DBG(device %p path %s, device, path); - network = connman_device_get_network(device, path); + ident = get_ident(path); + + network = connman_device_get_network(device, ident); if (network != NULL) return; - ident = get_ident(path); - - network = connman_network_create(ident, - CONNMAN_NETWORK_TYPE_CELLULAR); + network = connman_network_create(ident, CONNMAN_NETWORK_TYPE_CELLULAR); if (network == NULL) return; - connman_network_set_string(network, Path, path); + if (connman_network_set_string(network, Path, path) != 0) + goto error; + connman_network_set_available(network, TRUE); connman_network_set_index(network, -1); @@ -677,7 +678,11 @@ static void add_network(struct connman_device *device, const char *path) if (mnc != NULL) connman_network_set_string(network, Cellular.MNC, mnc); - connman_device_add_network(device, network); + if (connman_device_add_network(device, network) == 0) + return; + +error: + connman_network_unref(network); } static void add_networks(struct connman_device *device, DBusMessageIter *array) -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 12/17] ofono: refactor pri_context_changed handler
From: Pekka Pessi pekka.pe...@nokia.com Do not use pending_network outside pri_context_changed. --- plugins/ofono.c | 78 +++--- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index d84c7b6..def33b6 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -1367,12 +1367,13 @@ static void get_dns(DBusMessageIter *array, struct connman_element *parent) } static void update_settings(DBusMessageIter *array, - struct connman_element *parent) + struct connman_network *network) { + struct connman_element *parent = connman_network_get_element(network); DBusMessageIter dict; const char *interface = NULL; - DBG(); + DBG(network %p, network); if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY) return; @@ -1386,6 +1387,8 @@ static void update_settings(DBusMessageIter *array, dbus_message_iter_recurse(dict, entry); dbus_message_iter_get_basic(entry, key); + DBG(key %s, key); + dbus_message_iter_next(entry); dbus_message_iter_recurse(entry, value); @@ -1398,8 +1401,7 @@ static void update_settings(DBusMessageIter *array, index = connman_inet_ifindex(interface); if (index = 0) { - connman_network_set_index( - pending_network, index); + connman_network_set_index(network, index); } else { connman_error(Can not find interface %s, interface); @@ -1453,11 +1455,13 @@ static void update_settings(DBusMessageIter *array, /* deactive, oFono send NULL inteface before deactive signal */ if (interface == NULL) - connman_network_set_index(pending_network, -1); + connman_network_set_index(network, -1); } -static void cleanup_ipconfig(struct connman_element *parent) +static void cleanup_ipconfig(struct connman_network *network) { + struct connman_element *parent = connman_network_get_element(network); + g_free(parent-ipv4.address); parent-ipv4.address = NULL; @@ -1473,23 +1477,40 @@ static void cleanup_ipconfig(struct connman_element *parent) parent-ipv4.method = CONNMAN_IPCONFIG_METHOD_UNKNOWN; } -static int static_network_set_connected(struct connman_network *network, - struct connman_element *parent, - connman_bool_t connected) + +static void set_connected(struct connman_network *network, + connman_bool_t connected) { - if (connected == FALSE) - cleanup_ipconfig(parent); + struct connman_element *parent = connman_network_get_element(network); + enum connman_ipconfig_method method = parent-ipv4.method; - connman_network_set_connected(network, connected); + switch (method) { + case CONNMAN_IPCONFIG_METHOD_UNKNOWN: + case CONNMAN_IPCONFIG_METHOD_OFF: + case CONNMAN_IPCONFIG_METHOD_MANUAL: + return; - return 0; + case CONNMAN_IPCONFIG_METHOD_FIXED: + connman_network_set_method(network, method); + + if (connected == FALSE) + cleanup_ipconfig(network); + + connman_network_set_connected(network, connected); + break; + + case CONNMAN_IPCONFIG_METHOD_DHCP: + connman_network_set_method(network, method); + + connman_network_set_connected(network, connected); + break; + } } static gboolean pri_context_changed(DBusConnection *connection, DBusMessage *message, void *user_data) { const char *path = dbus_message_get_path(message); - struct connman_element *parent; const char *pending_path; DBusMessageIter iter, value; const char *key; @@ -1503,8 +1524,6 @@ static gboolean pri_context_changed(DBusConnection *connection, if (g_strcmp0(pending_path, path) != 0) return TRUE; - parent = connman_network_get_element(pending_network); - if (dbus_message_iter_init(message, iter) == FALSE) return TRUE; @@ -1513,33 +1532,14 @@ static gboolean pri_context_changed(DBusConnection *connection, dbus_message_iter_next(iter); dbus_message_iter_recurse(iter, value); - if (g_str_equal(key, Settings) == TRUE) { - - update_settings(value, parent); - } else if (g_str_equal(key, Active) == TRUE) { + if (g_str_equal(key, Settings) == TRUE) + update_settings(pending_network, value); +
[ofono-refactor-v2 PATCH 07/17] ofono: refactor dbus calls
From: Pekka Pessi pekka.pe...@nokia.com Use call_ofono() wrapper. --- plugins/ofono.c | 267 --- 1 files changed, 75 insertions(+), 192 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index e5d4187..9ad8708 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -79,6 +79,56 @@ static void modem_remove(struct connman_device *device) DBG(device %p, device); } +static int call_ofono(const char *path, + const char *interface, const char *method, + DBusPendingCallNotifyFunction notify, void *user_data, + DBusFreeFunction free_function, + int type, ...) +{ + DBusMessage *message; + DBusPendingCall *call; + dbus_bool_t ok; + va_list va; + + DBG(path %s %s.%s, path, interface, method); + + if (path == NULL) + return -EINVAL; + + message = dbus_message_new_method_call(OFONO_SERVICE, path, + interface, method); + if (message == NULL) + return -ENOMEM; + + dbus_message_set_auto_start(message, FALSE); + + va_start(va, type); + ok = dbus_message_append_args_valist(message, type, va); + va_end(va); + + if (!ok) + return -ENOMEM; + + if (dbus_connection_send_with_reply(connection, message, + call, TIMEOUT) == FALSE) { + connman_error(Failed to call %s.%s, interface, method); + dbus_message_unref(message); + return -EINVAL; + } + + if (call == NULL) { + connman_error(D-Bus connection not available); + dbus_message_unref(message); + return -EINVAL; + } + + dbus_pending_call_set_notify(call, notify, user_data, free_function); + + dbus_message_unref(message); + + return -EINPROGRESS; +} + static void set_property_reply(DBusPendingCall *call, void *user_data) { DBusMessage *reply; @@ -289,8 +339,6 @@ done: static void set_network_name(struct connman_network *network) { struct connman_device *device; - DBusMessage *message; - DBusPendingCall *call; const char *path; device = connman_network_get_device(network); @@ -301,29 +349,9 @@ static void set_network_name(struct connman_network *network) DBG(path %s, path); - message = dbus_message_new_method_call(OFONO_SERVICE, path, - OFONO_REGISTRATION_INTERFACE, GET_PROPERTIES); - if (message == NULL) - return; - - dbus_message_set_auto_start(message, FALSE); - - if (dbus_connection_send_with_reply(connection, message, - call, TIMEOUT) == FALSE) { - connman_error(Failed to get operator name); - goto done; - } - - if (call == NULL) { - connman_error(D-Bus connection not available); - goto done; - } - - dbus_pending_call_set_notify(call, set_network_name_reply, - (void *)network, NULL); - -done: - dbus_message_unref(message); + call_ofono(path, OFONO_REGISTRATION_INTERFACE, GET_PROPERTIES, + set_network_name_reply, network, NULL, + DBUS_TYPE_INVALID); } static void config_network_reply(DBusPendingCall *call, void *user_data) @@ -384,34 +412,11 @@ done: static void config_network(struct connman_network *network, const char *path) { - DBusMessage *message; - DBusPendingCall *call; - DBG(path %s, path); - message = dbus_message_new_method_call(OFONO_SERVICE, path, - OFONO_PRI_CONTEXT_INTERFACE, GET_PROPERTIES); - if (message == NULL) - return; - - dbus_message_set_auto_start(message, FALSE); - - if (dbus_connection_send_with_reply(connection, message, - call, TIMEOUT) == FALSE) { - connman_error(Failed to get Primary Context); - goto done; - } - - if (call == NULL) { - connman_error(D-Bus connection not available); - goto done; - } - - dbus_pending_call_set_notify(call, config_network_reply, - (void *)network, NULL); - -done: - dbus_message_unref(message); + ofono_call(path, OFONO_PRI_CONTEXT_INTERFACE, GET_PROPERTIES, + config_network_reply, network, NULL, + DBUS_TYPE_INVALID); } static gboolean registration_changed(DBusConnection *connection, @@ -740,33 +745,11 @@ static void add_default_context(DBusMessageIter *array, DBG(path %s, name %s, type %s, path, name, type); - message =
[ofono-refactor-v2 PATCH 08/17] ofono: do not strdup in get_ident()
From: Pekka Pessi pekka.pe...@nokia.com Fix leak if network creation fails. --- plugins/ofono.c |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 9ad8708..76759b4 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -252,7 +252,7 @@ static char *get_ident(const char *path) if (pos == NULL) return NULL; - return g_strdup(pos + 1); + return pos + 1; } static void create_service(struct connman_network *network) @@ -267,8 +267,6 @@ static void create_service(struct connman_network *network) group = get_ident(path); connman_network_set_group(network, group); - - g_free(group); } static void set_network_name_reply(DBusPendingCall *call, void *user_data) @@ -667,8 +665,6 @@ static void add_network(struct connman_device *device, const char *path) if (network == NULL) return; - g_free(ident); - connman_network_set_string(network, Path, path); connman_network_set_available(network, TRUE); connman_network_set_index(network, -1); -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 11/17] ofono: fix pending_network_is_available()
From: Pekka Pessi pekka.pe...@nokia.com connman_network_get_device() returns NULL if network has been removed. --- plugins/ofono.c | 26 +++--- 1 files changed, 3 insertions(+), 23 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 46b26d0..d84c7b6 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -498,32 +498,12 @@ static struct connman_network *pending_network; static gboolean pending_network_is_available(struct connman_network *network) { - struct connman_device *device; - struct connman_network *network; - const char *identifier; - char *ident; - - /* Modem may be removed during waiting for active reply */ - device = connman_network_get_device(network); - if (device == NULL) { - DBG(Modem is removed); + /* Modem or network may be removed during waiting for active reply */ + if (connman_network_get_device(network) == NULL) { + DBG(Modem or network was removed); return FALSE; } - identifier = connman_network_get_identifier(network); - - ident = g_strdup(identifier); - - connman_network_unref(network); - - /* network may be removed during waiting for active reply */ - network = connman_device_get_network(device, ident); - - g_free(ident); - - if (network == NULL) - return FALSE; - return TRUE; } -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 16/17] ofono: use Modem Online property
From: Pekka Pessi pekka.pe...@nokia.com Modem Online property gets controlled with the cellular device Powered property. As the oFono plugin needs to get the Powered state from the device it gets created when the SIM is ready. The GPRS networks get added after ConnMan can access the GPRS interface. As a side effect the oFono modems which do support Online but do not support GPRS are also visible in ConnMan. The ConnMan device gets now removed when the SIM is removed or the IMSI changes. --- plugins/ofono.c | 246 +++--- 1 files changed, 196 insertions(+), 50 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 81e0137..11f700f 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -64,7 +64,12 @@ static GHashTable *modem_hash = NULL; struct modem_data { char *path; struct connman_device *device; + gboolean has_sim; + gboolean has_gprs; gboolean available; + gboolean pending_online; + gboolean requested_online; + gboolean online; }; static int modem_probe(struct connman_device *device) @@ -205,13 +210,62 @@ static int set_property(const char *path, const char *interface, return -EINPROGRESS; } -static int gprs_change_powered(const char *path, dbus_bool_t powered) +static void update_modem_online(struct modem_data *modem, + connman_bool_t online) { - DBG(path %s powered %d, path, powered); + DBG(modem %p path %s online %d, modem, modem-path, online); - return set_property(path, OFONO_GPRS_INTERFACE, Powered, - DBUS_TYPE_BOOLEAN, powered, - NULL, NULL, NULL); + modem-online = online; + modem-requested_online = online; + modem-pending_online = FALSE; + + if (modem-device) + connman_device_set_powered(modem-device, online); +} + +static void set_online_reply(DBusPendingCall *call, void *user_data) +{ + struct modem_data *modem; + DBusMessage *reply; + DBusError error; + gboolean result; + + DBG(path %s, (char *)user_data); + + if (modem_hash == NULL) + return; + + modem = g_hash_table_lookup(modem_hash, user_data); + if (modem == NULL) + return; + + reply = dbus_pending_call_steal_reply(call); + + dbus_error_init(error); + + if (dbus_set_error_from_message(error, reply)) { + connman_error(SetProperty(Online): %s: %s, + error.name, error.message); + dbus_error_free(error); + + result = modem-online; + } else + result = modem-requested_online; + + if (modem-pending_online) + update_modem_online(modem, result); + + dbus_message_unref(reply); + + dbus_pending_call_unref(call); +} + +static int modem_change_online(char const *path, dbus_bool_t online) +{ + return set_property(path, OFONO_MODEM_INTERFACE, Online, + DBUS_TYPE_BOOLEAN, online, + set_online_reply, + (void *)g_strdup(path), g_free); } static int modem_enable(struct connman_device *device) @@ -220,16 +274,16 @@ static int modem_enable(struct connman_device *device) DBG(device %p, path, %s, device, path); - return gprs_change_powered(path, TRUE); + return modem_change_online(path, TRUE); } static int modem_disable(struct connman_device *device) { const char *path = connman_device_get_string(device, Path); - DBG(device %p, path %s, device, path); + DBG(device %p, path, %s, device, path); - return gprs_change_powered(path, FALSE); + return modem_change_online(path, FALSE); } static struct connman_device_driver modem_driver = { @@ -241,6 +295,31 @@ static struct connman_device_driver modem_driver = { .disable= modem_disable, }; +static void modem_remove_device(struct modem_data *modem) +{ + DBG(modem %p path %s device %p, modem, modem-path, modem-device); + + if (modem-device == NULL) + return; + + connman_device_remove_all_networks(modem-device); + connman_device_unregister(modem-device); + connman_device_unref(modem-device); + + modem-device = NULL; +} + +static void remove_modem(gpointer data) +{ + struct modem_data *modem = data; + + modem_remove_device(modem); + + g_free(modem-path); + + g_free(modem); +} + static char *get_ident(const char *path) { char *pos; @@ -773,12 +852,6 @@ static void check_networks_reply(DBusPendingCall *call, void *user_data) contexts = value; add_default_context(contexts, path, CONTEXT_NAME, CONTEXT_TYPE); - } else if (g_str_equal(key, Powered) == TRUE) { -
[ofono-refactor-v2 PATCH 01/17] device: remove stale pointer from network
From: Pekka Pessi pekka.pe...@nokia.com --- src/device.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/device.c b/src/device.c index e782bb5..93da00b 100644 --- a/src/device.c +++ b/src/device.c @@ -696,6 +696,8 @@ static void unregister_network(gpointer data) connman_element_unregister((struct connman_element *) network); + __connman_network_set_device(network, NULL); + connman_network_unref(network); } -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[ofono-refactor-v2 PATCH 04/17] ofono: log more of the errors
From: Pekka Pessi pekka.pe...@nokia.com --- plugins/ofono.c | 32 +++- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 69121e2..5ac77f5 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -92,8 +92,8 @@ static void set_property_reply(DBusPendingCall *call, void *user_data) reply = dbus_pending_call_steal_reply(call); if (dbus_set_error_from_message(error, reply)) { - connman_error(SetProperty(\%s\) %s, name, - error.message); + connman_error(SetProperty(%s) %s %s, name, + error.name, error.message); dbus_error_free(error); } @@ -310,7 +310,7 @@ static void set_network_name(struct connman_network *network) if (dbus_connection_send_with_reply(connection, message, call, TIMEOUT) == FALSE) { - connman_error(Failed to get operator); + connman_error(Failed to get operator name); goto done; } @@ -546,7 +546,8 @@ static void set_active_reply(DBusPendingCall *call, void *user_data) pending_network = NULL; - connman_error(%s, error.message); + connman_error(SetProperty(Active) %s %s, + error.name, error.message); dbus_error_free(error); } else @@ -710,7 +711,8 @@ static void create_context_reply(DBusPendingCall *call, void *user_data) reply = dbus_pending_call_steal_reply(call); if (dbus_set_error_from_message(error, reply)) { - connman_error(%s, error.message); + connman_error(CreateContext() %s %s, + error.name, error.message); dbus_error_free(error); } @@ -1071,6 +1073,7 @@ static gboolean modem_has_gprs(DBusMessageIter *array) static void modem_properties_reply(DBusPendingCall *call, void *user_data) { DBusMessage *reply; + DBusError error; DBusMessageIter array, dict; const char *path = user_data; @@ -1078,6 +1081,15 @@ static void modem_properties_reply(DBusPendingCall *call, void *user_data) reply = dbus_pending_call_steal_reply(call); + dbus_error_init(error); + + if (dbus_set_error_from_message(error, reply)) { + connman_error(Modem.GetProperties(%s) %s %s, + path, error.name, error.message); + dbus_error_free(error); + goto done; + } + if (dbus_message_iter_init(reply, array) == FALSE) goto done; @@ -1206,12 +1218,22 @@ static void update_modems(DBusMessageIter *array) static void manager_properties_reply(DBusPendingCall *call, void *user_data) { DBusMessage *reply; + DBusError error; DBusMessageIter array, dict; DBG(); reply = dbus_pending_call_steal_reply(call); + dbus_error_init(error); + + if (dbus_set_error_from_message(error, reply)) { + connman_error(ModemManager.GetProperties() %s %s, + error.name, error.message); + dbus_error_free(error); + goto done; + } + if (dbus_message_iter_init(reply, array) == FALSE) goto done; -- 1.7.0.4 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Re: [PATCH proxy-manual] connman manual proxy support
Hi David, the following patches implement manual proxy support for connman. The last patch (5) implements a plugin for setting up the proxy settings in gconf (for legacy apps). In gconf for which user? Or for which user and which value of $DISPLAY, since I think that matters too? I'm not sure this approach is particularly viable. in Nokia's Maemo the GConf was global. They hacked it to be for all users. No difference between system or session level. Regards Marcel ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
RE: [PATCH proxy-manual] connman manual proxy support
That makes it easy.dont have to type ;) -Original Message- From: connman-boun...@connman.net [mailto:connman-boun...@connman.net] On Behalf Of David Woodhouse Sent: Thursday, August 26, 2010 3:29 PM To: Marcel Holtmann Cc: connman@connman.net Subject: Re: [PATCH proxy-manual] connman manual proxy support On Thu, 2010-08-26 at 16:21 +0200, Marcel Holtmann wrote: Hi David, the following patches implement manual proxy support for connman. The last patch (5) implements a plugin for setting up the proxy settings in gconf (for legacy apps). In gconf for which user? Or for which user and which value of $DISPLAY, since I think that matters too? I'm not sure this approach is particularly viable. in Nokia's Maemo the GConf was global. They hacked it to be for all users. No difference between system or session level. Ah, that explains it. I've already tried using the gconf settings in MeeGo, and it doesn't work very well. I'd set them for the user, and things running as root (like yum) don't pick them up. Hence my conclusion that the best approach is to use libproxy. What we actually want is a libproxy dæmon which fetches and loads the PAC file *once*, then individual applications just use a libproxy plugin which talks to that dæmon -- and don't all have to download the PAC file and run the JS interpreter for themselves. But a libproxy module which just gets the info from ConnMan is the first step. -- David WoodhouseOpen Source Technology Centre david.woodho...@intel.com Intel Corporation ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman