Re: [PATCH] network: query signal strength when status changes to registered or roaming.
2010/12/3 Marit Henriksen maritsofie.henriks...@gmail.com From: Marit Henriksen marit.henrik...@stericsson.com Hi. I was wondering if you have had the chance to look at this patch yet? regards, Marit Signal strength is set to -1 whenever registration status changes and differs from registered or roaming. When registration status changes again to registered or roaming, the signal strength needs to be updated, so add query towards driver to get it. --- src/network.c | 29 - 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/network.c b/src/network.c index d5b42a1..80fa83d 100644 --- a/src/network.c +++ b/src/network.c @@ -1296,6 +1296,19 @@ emit: notify_status_watches(netreg); } +static void signal_strength_callback(const struct ofono_error *error, + int strength, void *data) +{ + struct ofono_netreg *netreg = data; + + if (error-type != OFONO_ERROR_TYPE_NO_ERROR) { + DBG(Error during signal strength query); + return; + } + + ofono_netreg_strength_notify(netreg, strength); +} + void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status, int lac, int ci, int tech) { @@ -1319,6 +1332,9 @@ void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status, if (netreg-driver-current_operator) netreg-driver-current_operator(netreg, current_operator_callback, netreg); + if (netreg-driver-strength) + netreg-driver-strength(netreg, + signal_strength_callback, netreg); } else { struct ofono_error error; @@ -1345,19 +1361,6 @@ void ofono_netreg_time_notify(struct ofono_netreg *netreg, __ofono_nettime_info_received(modem, info); } -static void signal_strength_callback(const struct ofono_error *error, - int strength, void *data) -{ - struct ofono_netreg *netreg = data; - - if (error-type != OFONO_ERROR_TYPE_NO_ERROR) { - DBG(Error during signal strength query); - return; - } - - ofono_netreg_strength_notify(netreg, strength); -} - static void init_registration_status(const struct ofono_error *error, int status, int lac, int ci, int tech, void *data) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] test/list-modems : print Strength as an integer
org.ofono.NetworkRegistration property Strength is an integer, so print it as such. --- test/list-modems 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/test/list-modems b/test/list-modems index 557efd5..8c075ac 100755 --- a/test/list-modems +++ b/test/list-modems @@ -51,7 +51,8 @@ for path, properties in modems: elif key in [MobileNetworkCodeLength, VoicemailMessageCount, MicrophoneVolume, - SpeakerVolume]: + SpeakerVolume, + Strength]: val = int(properties[key]) elif key in [MainMenu]: val = , .join([ text + ( + str(int(icon)) + -- 1.7.0.3 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] ctm: use ofono_error instead of DBG for errors
--- src/ctm.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ctm.c b/src/ctm.c index 1df34c2..2c82c2e 100644 --- a/src/ctm.c +++ b/src/ctm.c @@ -90,7 +90,7 @@ static void ctm_set_enabled_callback(const struct ofono_error *error, DBusMessage *reply; if (error-type != OFONO_ERROR_TYPE_NO_ERROR) { - DBG(Error setting ctm enabled property); + ofono_error(Error setting ctm enabled property); reply = __ofono_error_failed(ctm-pending); __ofono_dbus_pending_reply(ctm-pending, reply); @@ -116,7 +116,7 @@ static void ctm_query_enabled_callback(const struct ofono_error *error, if (error-type != OFONO_ERROR_TYPE_NO_ERROR) { DBusMessage *reply; - DBG(Error during ctm enabled query); + ofono_error(Error during ctm enabled query); reply = __ofono_error_failed(ctm-pending); __ofono_dbus_pending_reply(ctm-pending, reply); -- 1.7.3.2 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] ctm: use ofono_error instead of DBG for errors
Gustavo F. Padovan pado...@profusion.mobi writes: [PATCH] ctm: use ofono_error instead of DBG for errors I'm a newcomer to ofono, and to this list, but in general I'd hope to see more explanation/justification of code changes than this patch provides. In other words, why is it better to use ofono_error instead of DBG? Regards, Neil ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] ctm: use ofono_error instead of DBG for errors
Hi Neil, * Neil Jerram n...@ossau.uklinux.net [2010-12-15 21:23:20 +]: Gustavo F. Padovan pado...@profusion.mobi writes: [PATCH] ctm: use ofono_error instead of DBG for errors I'm a newcomer to ofono, and to this list, but in general I'd hope to see more explanation/justification of code changes than this patch provides. In other words, why is it better to use ofono_error instead of DBG? This patch fixes situation where we were reporting error in DBG messages. If we have an error to print it is good to give the right priority to the message. Just look the patch and you will figure out this. -- Gustavo F. Padovan http://profusion.mobi ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCHv2] plugin: Add ste modem initd integration
From: Sjur Brændeland sjur.brandel...@stericsson.com This patch introduces auto discovery of ST-Ericsson modems. ST-Ericsson modems (M5XX, M57XX, M7XX, M74XX) are managed by a Modem Init Daemon responsible for start, power cycles, flashing etc. This STE plugin monitors the modem state exposed from the Modem Init Damon's Dbus API. When the modem is in state on the STE modem is created and registered. Multiple modem instances, and reset handling is supported. --- Changes: - Support for multiple STE modems. - Better naming of STE modem instances, using received dbus path. - CAIF Link layer to use for AT channels specified pr modem instance. - Added support for reset. Makefile.am |5 + configure.ac |6 + plugins/stemid.c | 310 ++ 3 files changed, 321 insertions(+), 0 deletions(-) create mode 100644 plugins/stemid.c diff --git a/Makefile.am b/Makefile.am index 12b3c33..98096ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,6 +82,11 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \ udev_files = plugins/ofono.rules +if STE_MODEM_INITD +builtin_modules += stemid +builtin_sources += plugins/stemid.c +endif + if UDEV builtin_modules += udev builtin_sources += plugins/udev.c diff --git a/configure.ac b/configure.ac index 5c18f68..f733fc4 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,12 @@ AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles], AM_CONDITIONAL(DATAFILES, test ${enable_datafiles} != no) +AC_ARG_ENABLE(ste_modem_initd, AC_HELP_STRING([--disable-ste-modem-initd], + [disable auto discovery of STE modem using modem init daemon]), + [enable_ste_modem_initd=${enableval}]) + +AM_CONDITIONAL(STE_MODEM_INITD, test ${enable_ste_modem_initd} != no) + if (test ${prefix} = NONE); then dnl no prefix and no localstatedir, so default to /var if (test $localstatedir = '${prefix}/var'); then diff --git a/plugins/stemid.c b/plugins/stemid.c new file mode 100644 index 000..9f5da22 --- /dev/null +++ b/plugins/stemid.c @@ -0,0 +1,310 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2010 ST-Ericsson AB. + * + * 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 errno.h +#include string.h +#include net/if.h + +#include glib.h + +#define OFONO_API_SUBJECT_TO_CHANGE +#include ofono/plugin.h +#include ofono/log.h +#include ofono/modem.h +#include ofono/dbus.h + +/* + * ST-Ericsson's Modem Init Daemon is used for controling the modem power + * cycles and provides a dbus API for modem state and properties. + */ +#define MID_SERVICEcom.stericsson.modeminit +#define MID_INTERFACE MID_SERVICE .Modem + +/* The signal StateChange sends the modem state.*/ +#define STATUS_CHANGED StateChange + +#define MID_ACTION_ON on/* Modem is on */ +#define MID_ACTION_RESET dumping /* Modem is resetting */ +#define MID_ACTION_UNKNOWN unknown /* Don't care */ + +/* ResetState requests resending of StateChange. */ +#define MID_RESEND_STATE ResendState + +/* GetCaifIfName requests the CAIF Interface Name. */ +#define MID_GET_CAIFIF GetCaifIfName + +#define TIMEOUT5000 +#define STE_DRIVER_NAMEste +#define STE_INTERFACE_PROPERTY Interface + +enum ste_state { + STE_PENDING,/* Waiting for caifif and on notification */ + STE_PENDING_IF, /* Waiting for caifif, already got on */ + STE_REGISTERED, /* Modem is registered */ + STE_RESETTING /* Modem is resetting */ +}; + +struct ste_modem { + char *path; + struct ofono_modem *modem; + enum ste_state state; + gboolean got_caifif; + gboolean pending_call; +}; + +static GHashTable *modem_list; +static guint mid_api_watch; +static guint mid_state_watch; +static DBusConnection *connection; + +static void get_caifif_reply(DBusPendingCall *call, void *user_data) +{ + DBusMessage *reply; + char *ifname; + struct ste_modem *stemodem = user_data; + + stemodem-pending_call = FALSE; + stemodem-got_caifif = TRUE; + reply = dbus_pending_call_steal_reply(call); + + if (dbus_message_is_error(reply,
[PATCHv2 1/2] stemodem: Create network interfaces statically
From: Sjur Brændeland sjur.brandel...@stericsson.com Changes: o Restructure code so interfaces are created statically when probe is called, instead of creating interfaces dynamically at activation. o Changed debug messages. o Removed some of the unnecessary initializations at declaration. o No longer reporting default gateway for PtP IP Interface. o Bugfix: Handle network initiated deactivation. --- drivers/stemodem/gprs-context.c | 149 +- 1 files changed, 82 insertions(+), 67 deletions(-) diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c index faa3124..7bdcdb8 100644 --- a/drivers/stemodem/gprs-context.c +++ b/drivers/stemodem/gprs-context.c @@ -28,6 +28,7 @@ #include string.h #include stdlib.h #include stdio.h +#include errno.h #include glib.h @@ -65,10 +66,18 @@ struct gprs_context_data { }; struct conn_info { + /* +* cid is allocated in oFono Core and is identifying +* the Account. cid = 0 indicates that it is currently unused. +*/ unsigned int cid; - unsigned int device; + /* Id used by CAIF and EPPSD to identify the CAIF channel*/ unsigned int channel_id; - char interface[10]; + /* Linux Interface Id */ + unsigned int ifindex; + /* Linux Interface name */ + char interface[IF_NAMESIZE]; + gboolean created; }; struct eppsd_response { @@ -76,7 +85,6 @@ struct eppsd_response { char ip_address[IP_ADDR_LEN]; char subnet_mask[IP_ADDR_LEN]; char mtu[IP_ADDR_LEN]; - char default_gateway[IP_ADDR_LEN]; char dns_server1[IP_ADDR_LEN]; char dns_server2[IP_ADDR_LEN]; char p_cscf_server[IP_ADDR_LEN]; @@ -96,8 +104,6 @@ static void start_element_handler(GMarkupParseContext *context, rsp-current = rsp-subnet_mask; else if (!strcmp(element_name, mtu)) rsp-current = rsp-mtu; - else if (!strcmp(element_name, default_gateway)) - rsp-current = rsp-default_gateway; else if (!strcmp(element_name, dns_server) rsp-dns_server1[0] == '\0') rsp-current = rsp-dns_server1; @@ -123,7 +129,7 @@ static void text_handler(GMarkupParseContext *context, if (rsp-current) { strncpy(rsp-current, text, IP_ADDR_LEN); - rsp-current[IP_ADDR_LEN] = 0; + rsp-current[IP_ADDR_LEN] = '\0'; } } @@ -153,8 +159,7 @@ static gint conn_compare_by_cid(gconstpointer a, gconstpointer b) return 0; } -static struct conn_info *conn_info_create(unsigned int device, - unsigned int channel_id) +static struct conn_info *conn_info_create(unsigned int channel_id) { struct conn_info *connection = g_try_new0(struct conn_info, 1); @@ -162,7 +167,6 @@ static struct conn_info *conn_info_create(unsigned int device, return NULL; connection-cid = 0; - connection-device = device; connection-channel_id = channel_id; return connection; @@ -171,7 +175,7 @@ static struct conn_info *conn_info_create(unsigned int device, /* * Creates a new IP interface for CAIF. */ -static gboolean caif_if_create(const char *interface, unsigned int connid) +static gboolean caif_if_create(struct conn_info *conn) { return FALSE; } @@ -179,9 +183,8 @@ static gboolean caif_if_create(const char *interface, unsigned int connid) /* * Removes IP interface for CAIF. */ -static gboolean caif_if_remove(const char *interface, unsigned int connid) +static void caif_if_remove(struct conn_info *conn) { - return FALSE; } static void ste_eppsd_down_cb(gboolean ok, GAtResult *result, @@ -210,21 +213,13 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult *result, DBG(Did not find data (used caif device) for connection with cid; %d, gcd-active_context); - goto error; + CALLBACK_WITH_FAILURE(cb, cbd-data); + return; } conn = l-data; - - if (!caif_if_remove(conn-interface, conn-channel_id)) { - DBG(Failed to remove caif interface %s., - conn-interface); - } - conn-cid = 0; - return; - -error: - CALLBACK_WITH_FAILURE(cb, cbd-data); + CALLBACK_WITH_SUCCESS(cb, cbd-data); } static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data) @@ -233,7 +228,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data) ofono_gprs_context_up_cb_t cb = cbd-cb; struct ofono_gprs_context *gc = cbd-user; struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); - struct conn_info *conn = NULL; + struct conn_info *conn; GAtResultIter
[PATCHv2 2/2] stemodem: Use RTNL to create network interfaces.
From: Sjur Brændeland sjur.brandel...@stericsson.com --- drivers/stemodem/gprs-context.c | 43 -- 1 files changed, 36 insertions(+), 7 deletions(-) diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c index 7bdcdb8..1762fb3 100644 --- a/drivers/stemodem/gprs-context.c +++ b/drivers/stemodem/gprs-context.c @@ -47,6 +47,7 @@ #include stemodem.h #include caif_socket.h #include if_caif.h +#include caif_rtnl.h #define MAX_CAIF_DEVICES 4 #define MAX_DNS 2 @@ -172,12 +173,20 @@ static struct conn_info *conn_info_create(unsigned int channel_id) return connection; } -/* - * Creates a new IP interface for CAIF. - */ -static gboolean caif_if_create(struct conn_info *conn) +static void rtnl_callback(int ifindex, const char *ifname, void *user_data) { - return FALSE; + struct conn_info *conn = user_data; + + if (ifindex 0) { + conn-created = FALSE; + ofono_error(Failed to create caif interface %s, + conn-interface); + return; + } + + strncpy(conn-interface, ifname, sizeof(conn-interface)); + conn-ifindex = ifindex; + conn-created = TRUE; } /* @@ -185,6 +194,17 @@ static gboolean caif_if_create(struct conn_info *conn) */ static void caif_if_remove(struct conn_info *conn) { + if (!conn-created) + return; + + if (caif_rtnl_delete_interface(conn-ifindex) 0) { + ofono_error(Failed to delete caif interface %s, + conn-interface); + return; + } + + DBG(removed CAIF interface ch:%d ifname:%s ifindex:%d\n, + conn-channel_id, conn-interface, conn-ifindex); } static void ste_eppsd_down_cb(gboolean ok, GAtResult *result, @@ -526,7 +546,7 @@ static int ste_gprs_context_probe(struct ofono_gprs_context *gc, GAtChat *chat = data; struct gprs_context_data *gcd; struct conn_info *ci; - int i; + int i, err; gcd = g_new0(struct gprs_context_data, 1); gcd-chat = g_at_chat_clone(chat); @@ -539,7 +559,14 @@ static int ste_gprs_context_probe(struct ofono_gprs_context *gc, ci = conn_info_create(i+1); if (!ci) return -ENOMEM; - caif_if_create(ci); + err = caif_rtnl_create_interface(IFLA_CAIF_IPV4_CONNID, + ci-channel_id, FALSE, + rtnl_callback, ci); + if (err 0) { + DBG(Failed to create IP interface for CAIF); + return err; + } + g_caif_devices = g_slist_append(g_caif_devices, ci); } @@ -571,10 +598,12 @@ static struct ofono_gprs_context_driver driver = { void ste_gprs_context_init() { + caif_rtnl_init(); ofono_gprs_context_driver_register(driver); } void ste_gprs_context_exit() { ofono_gprs_context_driver_unregister(driver); + caif_rtnl_exit(); } -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
PATCH: Enable udev-based autodetection of calypso modem on Freerunner
Hi all, With the patch below, ofono-0.36 (the current Debian unstable version) detects the calypso modem on my freerunner. (Whereas without it, it doesn't.) I don't feel confident that the ofono.rules change is in its nicest possible form, and (IIUC) it's dependent on these earlier rules in /lib/udev/rules.d/55-openmoko-gta01-gta02.rules on my phone: # Samsung UARTS KERNEL==s3c2410_serial[0-9], NAME=ttySAC%n KERNEL==ttySAC[0-9], NAME=ttySAC%n Given that the actual udev DB entry, under 2.6.34, is: P: /devices/platform/s3c2440-uart.0/tty/ttySAC0 N: ttySAC0 S: char/204:64 E: UDEV_LOG=3 E: DEVPATH=/devices/platform/s3c2440-uart.0/tty/ttySAC0 E: MAJOR=204 E: MINOR=64 E: DEVNAME=/dev/ttySAC0 E: SUBSYSTEM=tty E: DEVLINKS=/dev/char/204:64 what's the neatest way of writing a udev rule for that? Regards, Neil From 79cc63c30dded269cdb8e8dbba78036847f6357e Mon Sep 17 00:00:00 2001 From: Neil Jerram n...@ossau.uklinux.net Date: Wed, 15 Dec 2010 21:56:50 + Subject: [PATCH] Enable udev-based autodetection of calypso modem on Freerunner As https://ofono.org/wiki/ofono-supported-modems says for calypso: It works with modem.conf. However it may need udev rule now. This patch addresses that. * plugins/udev.c (add_calypso): New function. (add_modem): Call add_calypso for calypso driver. * plugins/ofono.rules: Add udev rules for Freerunner calypso under 2.6.29 and 2.6.34 kernels. --- plugins/ofono.rules |7 +++ plugins/udev.c | 16 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/plugins/ofono.rules b/plugins/ofono.rules index da8a8ef..a0fdc96 100644 --- a/plugins/ofono.rules +++ b/plugins/ofono.rules @@ -2,6 +2,13 @@ ACTION!=add|change, GOTO=ofono_end +SUBSYSTEM!=tty, GOTO=ofono_calypso_end +NAME!=ttySAC0*, GOTO=ofono_calypso_end + +ENV{OFONO_DRIVER}=calypso + +LABEL=ofono_calypso_end + SUBSYSTEM!=tty, GOTO=ofono_tty_end KERNEL!=ttyUSB[0-9]*, GOTO=ofono_tty_end diff --git a/plugins/udev.c b/plugins/udev.c index 255755e..837ee9c 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -449,6 +449,20 @@ static void add_isi(struct ofono_modem *modem, ofono_modem_register(modem); } +static void add_calypso(struct ofono_modem *modem, + struct udev_device *udev_device) +{ + struct udev_list_entry *entry; + const char *devnode; + + DBG(modem %p, modem); + + devnode = udev_device_get_devnode(udev_device); + ofono_modem_set_string(modem, Device, devnode); + + ofono_modem_register(modem); +} + static void add_modem(struct udev_device *udev_device) { struct ofono_modem *modem; @@ -533,6 +547,8 @@ done: add_isi(modem, udev_device); else if (g_strcmp0(driver, n900) == 0) add_isi(modem, udev_device); + else if (g_strcmp0(driver, calypso) == 0) + add_calypso(modem, udev_device); } static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Voice call audio routing
While testing an e169 huawei card I was able to make voice calls and hear something with aplay and /dev/ttyUSB1. On the openmoko/freerunner is a matter of HW switches, on the n900 IIRC is done with pulseaudio. I guess that voice call audio routing is not in oFono plans, if I'm correct is there a reference project (may be not depending deeply on meego) that abstracts that task in an extensible/pluggable way? Regards Niko ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: Voice call audio routing
Nicola Mfb nicola@gmail.com writes: While testing an e169 huawei card I was able to make voice calls and hear something with aplay and /dev/ttyUSB1. On the openmoko/freerunner is a matter of HW switches, on the n900 IIRC is done with pulseaudio. I guess that voice call audio routing is not in oFono plans, if I'm correct is there a reference project (may be not depending deeply on meego) that abstracts that task in an extensible/pluggable way? Have you read design.txt in telepathy-ring's repository? I think it touches on this subject. From my limited (so far) understanding of that file, I think you are right that ofono does not manage the audio routing itself. Regards, Neil ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono