Re: [PATCH 2/6] Fix common misspellings in drivers
Hi Aki, > >> - * Copyright (C) 2010 Nokia Corporation and/or its subsidary(-ies). > >> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). > > > > for these kind of changes, I prefer if you have buy in from the Nokia > > guys. Some companies have strict rules on the copyright header. I know > > that with Intel we try to follow them consistently for all projects. So > > if Nokia wants to "misspell" this, then that is fine with me actually. > > This is a real misspelling; in other places in the source tree it is > spelled correctly. fair enough. And all of the patches have been pushed now. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH] Check if ussd is busy when doing ss
Hi, >-Original Message- >From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of >Pekka Pessi >Sent: Monday, September 13, 2010 9:19 PM >To: ofono@ofono.org >Subject: Re: [PATCH] Check if ussd is busy when doing ss > >Hi Yang, > >2010/9/6 Yang Gu : >> It's still not clear how ss and ussd interfere with each other. Current >> decision is each ss (call-barring, call-forwarding, etc.) has >> interference with ussd, but there is no interference within these ss. >> That is, call-barring has interference with ussd, but call-barring has >> no interference with call-forwarding. > >There is only one signaling channel for the supplementary services. >Only one supplementary service operation can be active at a time. (Or >two, network can initiate ussd notify or request while >mobile-originated ussd is pending.) Thank you for the info. When you say only one MO ss operation can be active at a time, do you mean modem will serialize them or oFono needs always to take care, or it's hardware specific? Regards, -Yang ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Check if ussd is busy when doing ss
Hi Yang, 2010/9/14 Gu, Yang : >>> It's still not clear how ss and ussd interfere with each other. Current >>> decision is each ss (call-barring, call-forwarding, etc.) has >>> interference with ussd, but there is no interference within these ss. >>> That is, call-barring has interference with ussd, but call-barring has >>> no interference with call-forwarding. >> >>There is only one signaling channel for the supplementary services. >>Only one supplementary service operation can be active at a time. (Or >>two, network can initiate ussd notify or request while >>mobile-originated ussd is pending.) > > Thank you for the info. When you say only one MO ss operation can be active > at a time, do you mean modem will serialize them or oFono needs always to > take care, or it's hardware specific? It is up to the firmware can do what ever it thinks is sensible. I don't think it will make any sense to serialize them, but then, you will never know. -- Pekka.Pessi mail at nokia.com ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] TODO: Add Support for Language Notification proactive command
Hi Jeevaka, On 09/14/2010 01:56 AM, Jeevaka Badrappan wrote: > --- > TODO |6 ++ > 1 files changed, 6 insertions(+), 0 deletions(-) Patch has been applied, but I reworded the commit. Please keep the commit header length to 50 characters or less. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH V2 1/5] bluetooth: Add reference count for bluetooth utils
Add bluetooth_ref()/bluetooth_unref() to support reference count in bluetooth utils. --- plugins/bluetooth.c | 62 +-- 1 files changed, 45 insertions(+), 17 deletions(-) diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 5a85eaa..10cc49d 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -39,6 +39,7 @@ static DBusConnection *connection; static GHashTable *uuid_hash = NULL; static GHashTable *adapter_address_hash = NULL; +static gint ref_count; void bluetooth_create_path(const char *dev_addr, const char *adapter_addr, char *buf, int size) @@ -503,13 +504,10 @@ static guint adapter_added_watch; static guint adapter_removed_watch; static guint property_watch; -int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile) +static int bluetooth_init() { int err; - if (uuid_hash) - goto done; - connection = ofono_dbus_get_connection(); bluetooth_watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE, @@ -542,13 +540,6 @@ int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile) adapter_address_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); -done: - g_hash_table_insert(uuid_hash, g_strdup(uuid), profile); - - bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties", - manager_properties_cb, NULL, NULL, -1, - DBUS_TYPE_INVALID); - return 0; remove: @@ -556,14 +547,27 @@ remove: g_dbus_remove_watch(connection, adapter_added_watch); g_dbus_remove_watch(connection, adapter_removed_watch); g_dbus_remove_watch(connection, property_watch); + return err; } -void bluetooth_unregister_uuid(const char *uuid) +static int bluetooth_ref() { - g_hash_table_remove(uuid_hash, uuid); + g_atomic_int_inc(&ref_count); + + if (ref_count > 1) + return 0; + + return bluetooth_init(); +} + +static void bluetooth_unref() +{ + gboolean is_zero; + + is_zero = g_atomic_int_dec_and_test(&ref_count); - if (g_hash_table_size(uuid_hash)) + if (is_zero == FALSE) return; g_dbus_remove_watch(connection, bluetooth_watch); @@ -571,9 +575,33 @@ void bluetooth_unregister_uuid(const char *uuid) g_dbus_remove_watch(connection, adapter_removed_watch); g_dbus_remove_watch(connection, property_watch); - g_hash_table_destroy(uuid_hash); - g_hash_table_destroy(adapter_address_hash); - uuid_hash = NULL; + if (uuid_hash) + g_hash_table_destroy(uuid_hash); + + if (adapter_address_hash) + g_hash_table_destroy(adapter_address_hash); +} + +int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile) +{ + int err = bluetooth_ref(); + + if (err != 0) + return err; + + g_hash_table_insert(uuid_hash, g_strdup(uuid), profile); + + bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties", + manager_properties_cb, NULL, NULL, -1, + DBUS_TYPE_INVALID); + return 0; +} + +void bluetooth_unregister_uuid(const char *uuid) +{ + g_hash_table_remove(uuid_hash, uuid); + + bluetooth_unref(); } OFONO_PLUGIN_DEFINE(bluetooth, "Bluetooth Utils Plugins", VERSION, -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH V2 3/5] bluetooth: Add bluetooth server support for DUN
It watches Bluetooth adapter property changes and addes DUN record to listen DUN client connection request. --- plugins/bluetooth.c | 379 +++ plugins/bluetooth.h | 14 ++ 2 files changed, 393 insertions(+), 0 deletions(-) diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 10cc49d..0577747 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -34,13 +34,72 @@ #include +#include #include "bluetooth.h" static DBusConnection *connection; static GHashTable *uuid_hash = NULL; static GHashTable *adapter_address_hash = NULL; +static GSList *server_list = NULL; static gint ref_count; +static const gchar *dun_record = " \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +"; + +#define TIMEOUT (60*1000) /* Timeout for user response (miliseconds) */ + +struct client { + GIOChannel *io; + guint watch; +}; + +struct server { + guint16 service; + gchar *name; + guint8 channel; + GIOChannel *io; + gchar *adapter; + guint handle; + ConnectFunc connect_cb; + gpointeruser_data; + + struct client client; +}; + void bluetooth_create_path(const char *dev_addr, const char *adapter_addr, char *buf, int size) { @@ -370,6 +429,253 @@ static gboolean property_changed(DBusConnection *connection, DBusMessage *msg, return TRUE; } +static void disconnect(struct server *server) +{ + struct client *client = &server->client; + + if (!client->io) + return; + + g_io_channel_unref(client->io); + client->io = NULL; + + if (client->watch > 0) { + g_source_remove(client->watch); + client->watch = 0; + } + + return; +} + +static void server_stop(gpointer data, gpointer user_data) +{ + struct server *server = data; + + disconnect(server); + + if (server->handle) { + DBusMessage *msg; + + msg = dbus_message_new_method_call(BLUEZ_SERVICE, + server->adapter, + BLUEZ_SERVICE_INTERFACE, + "RemoveRecord"); + dbus_message_append_args(msg, DBUS_TYPE_UINT32, &server->handle, + DBUS_TYPE_INVALID); + g_dbus_send_message(connection, msg); + + server->handle = 0; + } + + if (server->io) { + g_io_channel_shutdown(server->io, TRUE, NULL); + g_io_channel_unref(server->io); +
[PATCH V2 4/5] emulator: Add emulator atom in oFono
Create emulator atom when modem state changes to online. The emulator driver probes each driver to create specific emulator like DUN, HFP AG, etc. Once get client connection request, create GAtServer to talk AT commands with client side. --- Makefile.am|4 +- include/emulator.h | 54 +++ src/emulator.c | 189 src/modem.c|2 + src/ofono.h|5 ++ 5 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 include/emulator.h create mode 100644 src/emulator.c diff --git a/Makefile.am b/Makefile.am index d0be7b8..62cdb60 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ include_HEADERS = include/log.h include/plugin.h include/history.h \ include/cbs.h include/call-volume.h \ include/gprs.h include/gprs-context.h \ include/radio-settings.h include/stk.h \ - include/nettime.h + include/nettime.h include/emulator.h nodist_include_HEADERS = include/version.h @@ -286,7 +286,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) \ src/gprs.c src/idmap.h src/idmap.c \ src/radio-settings.c src/stkutil.h src/stkutil.c \ src/nettime.c src/stkagent.c src/stkagent.h \ - src/simfs.c src/simfs.h + src/simfs.c src/simfs.h src/emulator.c src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \ @BLUEZ_LIBS@ -ldl diff --git a/include/emulator.h b/include/emulator.h new file mode 100644 index 000..2691928 --- /dev/null +++ b/include/emulator.h @@ -0,0 +1,54 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2010 Intel 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 + * + */ + +#ifndef __OFONO_EMULATOR_H +#define __OFONO_EMULATOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct ofono_emulator; + +struct ofono_emulator_driver { + const char *name; + enum ofono_atom_type type; + int (*probe)(struct ofono_emulator *emulator, + struct ofono_modem *modem); + void (*remove)(); +}; + +int ofono_emulator_enable(struct ofono_emulator *emulator, GIOChannel *channel); +void ofono_emulator_remove(gpointer user_data); +struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem, + struct ofono_emulator_driver *driver); + +int ofono_emulator_driver_register(const struct ofono_emulator_driver *driver); +void ofono_emulator_driver_unregister( + const struct ofono_emulator_driver *driver); + +#ifdef __cplusplus +} +#endif + +#endif /* __OFONO_EMULATOR_H */ diff --git a/src/emulator.c b/src/emulator.c new file mode 100644 index 000..0f07b3e --- /dev/null +++ b/src/emulator.c @@ -0,0 +1,189 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2010 Intel 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 +#endif + +#include +#include +#include +#include +#include + +#include "ofono.h" +#include "common.h" +#include "gatserver.h" + +struct ofono_emulator { + struct ofono_modem *modem; + struct ofono_atom *atom; + unsigned int id; + GAtServer *server; + struct ofono_emulator_driver *driver; +}; + +static GSList *emulator_drivers = NULL; +static unsigned int ofono_emulator_ids; + +static void ofono_emulator_debug(const char *str, void *data) +{ + g_print("%s: %s\n", (char *)d
[PATCH V2 5/5] dun_gw: Add DUN server plugin for oFono
DUN server is probed when modem state changes to online. It registers DUN record to Bluetooth adapter and wait for incoming DUN connection. --- Makefile.am |3 + plugins/dun_gw.c | 113 ++ 2 files changed, 116 insertions(+), 0 deletions(-) create mode 100644 plugins/dun_gw.c diff --git a/Makefile.am b/Makefile.am index 62cdb60..ca1988a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -255,6 +255,9 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h builtin_modules += hfp builtin_sources += plugins/hfp.c plugins/bluetooth.h +builtin_modules += dun_gw +builtin_sources += $(btio_sources) plugins/dun_gw.c plugins/bluetooth.h + builtin_modules += palmpre builtin_sources += plugins/palmpre.c diff --git a/plugins/dun_gw.c b/plugins/dun_gw.c new file mode 100644 index 000..4e33d75 --- /dev/null +++ b/plugins/dun_gw.c @@ -0,0 +1,113 @@ +/* + * oFono - Open Source Telephony + * + * Copyright (C) 2010 Intel 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 +#endif +#include +#include +#include +#include +#include + +#define OFONO_API_SUBJECT_TO_CHANGE +#include +#include +#include +#include + +#include "bluetooth.h" + +#define DUN_GW_CHANNEL 1 + +static struct server *server; + +static void dun_gw_connect_cb(GIOChannel *io, GError *err, gpointer user_data) +{ + struct ofono_emulator *emulator = user_data; + + DBG(""); + + if (err) { + DBG("%s", err->message); + goto failed; + } + + if (ofono_emulator_enable(emulator, io) < 0) + goto failed; + + return; + +failed: + g_io_channel_shutdown(io, TRUE, NULL); + ofono_emulator_remove(emulator); + bluetooth_unregister_server(server); + server = NULL; +} + +static int dun_gw_probe(struct ofono_emulator *emulator, + struct ofono_modem *modem) +{ + struct ofono_atom *gprs; + + if (server) + return -1; + + DBG(""); + + gprs = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_GPRS); + /* Make sure the modem has GPRS atom */ + if (!gprs) + return -1; + + server = bluetooth_register_server(DUN_GW, "Dial-Up Networking", + DUN_GW_CHANNEL, dun_gw_connect_cb, emulator); +} + +static void dun_gw_remove() +{ + if (server == NULL) + return; + + DBG(""); + + bluetooth_unregister_server(server); + server = NULL; +} + +static struct ofono_emulator_driver emulator_driver = { + .name = "Dial-Up Networking", + .type = OFONO_ATOM_TYPE_EMULATOR_DUN, + .probe = dun_gw_probe, + .remove = dun_gw_remove, +}; + +static int dun_gw_init() +{ + return ofono_emulator_driver_register(&emulator_driver); +} + +static void dun_gw_exit() +{ + ofono_emulator_driver_unregister(&emulator_driver); +} + +OFONO_PLUGIN_DEFINE(dun_gw, "Dial-up Networking Profile Plugins", VERSION, + OFONO_PLUGIN_PRIORITY_DEFAULT, dun_gw_init, dun_gw_exit) -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH V2 0/5] Add DUN server for oFono
Hi, I updated the DUN server patches according to the comments, mainly patch 4/5 and 5/5. It's quite similar with history/nettime plugins, which to probe the plugin when modem state changes to 'online'. Please review them. Thanks. Regards, Zhenhua ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH V2 2/5] bluetooth: Add Btio library for DUN
Btio library is the low level socket API for BT RFCOMM connection. We share the same library among BlueZ, Obex and oFono. So make sure you synchronize to other two projects when you make changes to btio.[ch]. --- Makefile.am |8 +- btio/btio.c | 1299 ++ btio/btio.h | 97 + configure.ac |5 + 4 files changed, 1407 insertions(+), 2 deletions(-) create mode 100644 btio/btio.c create mode 100644 btio/btio.h diff --git a/Makefile.am b/Makefile.am index 802e94b..d0be7b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,6 +72,8 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \ gatchat/ppp_auth.c gatchat/ppp_net.c \ gatchat/ppp_ipcp.c +btio_sources = btio/btio.h btio/btio.c + udev_files = plugins/ofono.rules if UDEV @@ -286,7 +288,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) \ src/nettime.c src/stkagent.c src/stkagent.h \ src/simfs.c src/simfs.h -src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl +src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \ + @BLUEZ_LIBS@ -ldl src_ofonod_LDFLAGS = -Wl,--export-dynamic -Wl,--version-script=src/ofono.ver @@ -308,7 +311,8 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ $(builtin_cflags) \ -DPLUGINDIR=\""$(build_plugindir)"\" INCLUDES = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/src \ - -I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat + -I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat \ + -I$(srcdir)/btio doc_files = doc/overview.txt doc/ofono-paper.txt \ doc/manager-api.txt doc/modem-api.txt doc/network-api.txt \ diff --git a/btio/btio.c b/btio/btio.c new file mode 100644 index 000..8b273ca --- /dev/null +++ b/btio/btio.c @@ -0,0 +1,1299 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2009-2010 Marcel Holtmann + * Copyright (C) 2009-2010 Nokia Corporation + * + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "btio.h" + +#define ERROR_FAILED(gerr, str, err) \ + g_set_error(gerr, BT_IO_ERROR, BT_IO_ERROR_FAILED, \ + str ": %s (%d)", strerror(err), err) + +#define DEFAULT_DEFER_TIMEOUT 30 + +struct set_opts { + bdaddr_t src; + bdaddr_t dst; + int defer; + int sec_level; + uint8_t channel; + uint16_t psm; + uint16_t mtu; + uint16_t imtu; + uint16_t omtu; + int master; + uint8_t mode; +}; + +struct connect { + BtIOConnect connect; + gpointer user_data; + GDestroyNotify destroy; +}; + +struct accept { + BtIOConnect connect; + gpointer user_data; + GDestroyNotify destroy; +}; + +struct server { + BtIOConnect connect; + BtIOConfirm confirm; + gpointer user_data; + GDestroyNotify destroy; +}; + +static void server_remove(struct server *server) +{ + if (server->destroy) + server->destroy(server->user_data); + g_free(server); +} + +static void connect_remove(struct connect *conn) +{ + if (conn->destroy) + conn->destroy(conn->user_data); + g_free(conn); +} + +static void accept_remove(struct accept *accept) +{ + if (accept->destroy) + accept->destroy(accept->user_data); + g_free(accept); +} + +static gboolean check_nval(GIOChannel *io) +{ + struct pollfd fds; + + memset(&fds, 0, sizeof(fds)); + fds.fd = g_io_channel_unix_get_fd(io); + fds.events = POLLNVAL; + + if (poll(&fds, 1, 0) > 0 && (fds.revents & POLLNVAL)) + return TRUE; + + return FALSE; +} + +static gboolean accept_cb(GIOChannel *io, GIOCondition cond, + gpointer user_data) +{ + struct accept *accept = user_data; + GError
[PATCH] phonesim: Fix multiple proactive command ind issue
--- src/phonesim.cpp | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/phonesim.cpp b/src/phonesim.cpp index 8210f51..89089b2 100644 --- a/src/phonesim.cpp +++ b/src/phonesim.cpp @@ -1013,11 +1013,13 @@ bool SimRules::simCommand( const QString& cmd ) QSimTerminalResponse resp = QSimTerminalResponse::fromPdu( param.mid(5) ); -if ( toolkitApp->response( resp ) ) -return simCsimOk( QByteArray() ); +/* Incase of successful case, response is sent inside + * the SimApplication::response function. response function + * also handles the notification of new command + */ +if ( !toolkitApp->response( resp ) ) +respond( "+CSIM: 4,6F00\\n\\nOK" ); -/* Response to the wrong type of command. */ -respond( "+CSIM: 4,6F00\\n\\nOK" ); return true; } else if ( param.length() >= 5 && param[1] == (char)0x2c && param[4] == (char)0x10 && param.size() >= 21 ) { -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
phonesim fix for multiple proactive command ind
Hi, This patch fixes the multiple answering of AT+CSIM command and multiple notification of the new proactive command. Regards, jeevaka ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] phonesim: Fix multiple proactive command ind issue
Hi Jeevaka, On 09/14/2010 11:22 AM, Jeevaka Badrappan wrote: > --- > src/phonesim.cpp | 10 ++ > 1 files changed, 6 insertions(+), 4 deletions(-) > This patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/8] smsutil: Add USSD encoding function
Hi Jeevaka, On 09/13/2010 06:00 PM, Jeevaka Badrappan wrote: > --- > src/smsutil.c | 29 + > src/smsutil.h |1 + > 2 files changed, 30 insertions(+), 0 deletions(-) This patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/8] util: Add UCS2 to GSM 7bit converion function
Hi Jeevaka, On 09/13/2010 06:00 PM, Jeevaka Badrappan wrote: > --- > src/util.c | 108 > > src/util.h | 10 + > 2 files changed, 118 insertions(+), 0 deletions(-) This patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 3/8] test-util: Add function for validating UCS2 to GSM bit conversion
Hi Jeevaka, On 09/13/2010 06:00 PM, Jeevaka Badrappan wrote: > --- > unit/test-util.c | 80 > ++ > 1 files changed, 80 insertions(+), 0 deletions(-) This patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 4/8] USSD atom driver changes to read current character setting
Hi Jeevaka, On 09/13/2010 06:00 PM, Jeevaka Badrappan wrote: > --- > drivers/atmodem/ussd.c | 16 > 1 files changed, 16 insertions(+), 0 deletions(-) This patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 5/8] Internal and Driver API changes for Send USSD
Hi Jeevaka, On 09/13/2010 06:00 PM, Jeevaka Badrappan wrote: > --- > drivers/atmodem/ussd.c | 112 > +++ > drivers/isimodem/ussd.c | 42 +++-- > include/ussd.h |8 ++- > src/ussd.c | 61 + > 4 files changed, 120 insertions(+), 103 deletions(-) > > diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c > index 30145ad..bc5690d 100644 > --- a/drivers/atmodem/ussd.c > +++ b/drivers/atmodem/ussd.c > @@ -65,15 +65,17 @@ static void read_charset_cb(gboolean ok, GAtResult > *result, > > static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) > { > + struct ussd_data *data = ofono_ussd_get_data(ussd); > GAtResultIter iter; > int status; > int dcs; > - const char *content; > - char *converted = NULL; > - gboolean udhi; > + const char *content = NULL; > enum sms_charset charset; > - gboolean compressed; > - gboolean iso639; > + unsigned char msg[160]; > + const unsigned char *msg_ptr = NULL; > + unsigned char *converted = NULL; > + long written; > + long msg_len = 0; > > g_at_result_iter_init(&iter, result); > > @@ -86,34 +88,45 @@ static void cusd_parse(GAtResult *result, struct > ofono_ussd *ussd) > if (!g_at_result_iter_next_string(&iter, &content)) > goto out; > > - if (g_at_result_iter_next_number(&iter, &dcs)) { > - if (!cbs_dcs_decode(dcs, &udhi, NULL, &charset, > - &compressed, NULL, &iso639)) > - goto out; > - > - if (udhi || compressed || iso639) > - goto out; > - } else > - charset = SMS_CHARSET_7BIT; > - > - if (charset == SMS_CHARSET_7BIT) > - converted = convert_gsm_to_utf8((const guint8 *) content, > - strlen(content), NULL, NULL, 0); > - > - else if (charset == SMS_CHARSET_8BIT) { > - /* TODO: Figure out what to do with 8 bit data */ > - ofono_error("8-bit coded USSD response received"); > - status = 4; /* Not supported */ > - } else { > - /* No other encoding is mentioned in TS27007 7.15 */ > + if (!g_at_result_iter_next_number(&iter, &dcs)) > + dcs = 0; > + > + cbs_dcs_decode(dcs, NULL, NULL, &charset, NULL, NULL, NULL); > + > + if (charset == SMS_CHARSET_7BIT) { > + if (data->charset == AT_UTIL_CHARSET_GSM) > + msg_ptr = pack_7bit_own_buf((const guint8 *) content, > + strlen(content), 0, TRUE, &msg_len, 0, > msg); > + else if (data->charset == AT_UTIL_CHARSET_UTF8) > + ussd_encode(content, &msg_len, msg); > + else if (data->charset == AT_UTIL_CHARSET_UCS2) { > + msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, > msg); > + > + converted = convert_ucs2_to_gsm(msg_ptr, msg_len, NULL, > + &written, 0); > + if (!converted) { > + msg_ptr = NULL; > + msg_len = 0; > + goto out; > + } > + > + msg_ptr = pack_7bit_own_buf(converted, > + written, 0, TRUE, > + &msg_len, 0, msg); > + > + g_free(converted); > + } > + } else if (charset == SMS_CHARSET_8BIT) > + msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); > + else if (charset == SMS_CHARSET_UCS2) > + msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); > + else { > ofono_error("Unsupported USSD data coding scheme (%02x)", dcs); > status = 4; /* Not supported */ > } Can you do me a favor and convert this if statement to a switch/case? Move the contents of the else clause to the if that checks the DCS. e.g. if (cbs_dcs_decode() == FALSE) { } switch (charset) case SMS_CHARSET_7BIT: case SMS_CHARSET_8BIT: case SMS_CHARSET_UCS2: > > out: > - ofono_ussd_notify(ussd, status, converted); > - > - g_free(converted); > + ofono_ussd_notify(ussd, status, dcs, msg_ptr, msg_len); > } > > static void cusd_request_cb(gboolean ok, GAtResult *result, gpointer > user_data) > @@ -130,39 +143,45 @@ static void cusd_request_cb(gboolean ok, GAtResult > *result, gpointer user_data) > cusd_parse(result, ussd); > } > > -static void at_ussd_request(struct ofono_ussd *ussd, const char *str, > +static void at_ussd_request(struct ofono_ussd *ussd, int dcs, > + const unsigned char *pdu, int len, > ofono_ussd_cb_t
[RFC PATCH 2/2] unit: national to international conversion
--- unit/test-sms.c | 17 + 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/unit/test-sms.c b/unit/test-sms.c index 0ff9cd5..96b9b50 100644 --- a/unit/test-sms.c +++ b/unit/test-sms.c @@ -1316,6 +1316,23 @@ static void test_sr_assembly() g_assert(id == 42); g_assert(delivered == TRUE); + g_assert(g_hash_table_size(sra->assembly_table) == 0); + + /* +* Send sms-message in the national address-format, +* but receive in the international address-format. +*/ + sms_address_from_string(&addr, "9911630"); + status_report_assembly_add_fragment(sra, 42, &addr, 4, time(NULL), 2); + status_report_assembly_add_fragment(sra, 42, &addr, 5, time(NULL), 2); + + g_assert(!status_report_assembly_report(sra, &sr1, &id, &delivered)); + g_assert(status_report_assembly_report(sra, &sr2, &id, &delivered)); + + g_assert(id == 42); + g_assert(delivered == TRUE); + g_assert(g_hash_table_size(sra->assembly_table) == 0); + status_report_assembly_free(sra); } -- 1.6.3.3 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[RFC PATCH 1/2] smsutil: national to international conversion in status report
--- src/smsutil.c | 70 1 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/smsutil.c b/src/smsutil.c index 26c7951..2d47289 100644 --- a/src/smsutil.c +++ b/src/smsutil.c @@ -2826,14 +2826,18 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly, unsigned int offset = status_report->status_report.mr / 32; unsigned int bit = 1 << (status_report->status_report.mr % 32); struct id_table_node *node = NULL; - const char *straddr; + const char *straddr, *sent_addr; + struct sms_address addr; GHashTable *id_table; gpointer key, value; gboolean delivered; - GHashTableIter iter; + GHashTableIter iter_addr, iter; gboolean pending; int i; unsigned int msg_id; + unsigned int n_digits; + unsigned int len_sent_addr; + unsigned int len_rec_addr; /* We ignore temporary or tempfinal status reports */ if (sr_st_to_delivered(status_report->status_report.st, @@ -2841,20 +2845,54 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly, return FALSE; straddr = sms_address_to_string(&status_report->status_report.raddr); - id_table = g_hash_table_lookup(assembly->assembly_table, straddr); - /* key (receiver address) does not exist in assembly */ - if (id_table == NULL) - return FALSE; + g_hash_table_iter_init(&iter_addr, assembly->assembly_table); - g_hash_table_iter_init(&iter, id_table); - while (g_hash_table_iter_next(&iter, &key, &value)) { - node = value; + /* +* Go through all addresses. Each address can relate to +* 1-n msg_ids. +*/ + while (g_hash_table_iter_next(&iter_addr, (gpointer) &sent_addr, + (gpointer) &id_table)) { + /* +* Some networks can change address to international format, +* although address is sent in the national format. +* So notify this special case by checking only +* last six digits. If address contains less than six digits, +* compare only existing digits. +*/ + if ((straddr[0] == '+') && (sent_addr[0] != '+')) { + len_sent_addr = strlen(sent_addr); + len_rec_addr = strlen(straddr); + n_digits = (len_sent_addr > 6) ? 6 : len_sent_addr; - if (node->mrs[offset] & bit) - break; + if (strcmp(&straddr[len_rec_addr - n_digits], + &sent_addr[len_sent_addr - n_digits])) + continue; + } + /* +* In other cases the whole number received in the status report +* should match with the number originally sent. +*/ + else if (strcmp(straddr, sent_addr)) + continue; + + g_hash_table_iter_init(&iter, id_table); + while (g_hash_table_iter_next(&iter, &key, &value)) { + node = value; + + if (node->mrs[offset] & bit) + break; - node = NULL; + node = NULL; + } + + /* +* Received address with MR matched with one of the stored +* addresses and MR, so no need to continue searching. +*/ + if (node) + break; } /* Unable to find a message reference belonging to this address */ @@ -2881,6 +2919,8 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly, msg_id = *(unsigned int *) key; + sms_address_from_string(&addr, sent_addr); + if (pending == TRUE && node->deliverable == TRUE) { /* * More status reports expected, and already received @@ -2888,7 +2928,7 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly, */ sr_assembly_add_fragment_backup( assembly->imsi, node, - &status_report->status_report.raddr, + &addr, msg_id); return FALSE; @@ -2901,14 +2941,14 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly, *out_id = msg_id; sr_assembly_remove_fragment_backup(assembly->imsi, - &status_report->status_report.raddr, + &addr,
Re: [PATCH 6/8] Add __ofono_ussd_initiate internal api for Sending USSD
Hi Jeevaka, On 09/13/2010 06:00 PM, Jeevaka Badrappan wrote: > --- > src/ofono.h |7 + > src/ussd.c | 86 > ++- > 2 files changed, 92 insertions(+), 1 deletions(-) > > diff --git a/src/ofono.h b/src/ofono.h > index f1c0973..8ab6a2e 100644 > --- a/src/ofono.h > +++ b/src/ofono.h > @@ -258,6 +258,9 @@ typedef gboolean (*ofono_ussd_passwd_cb_t)(const char *sc, > const char *old, const char *new, > DBusMessage *msg, void *data); > > +typedef void (*ofono_ussd_request_cb_t)(int error, int dcs, > + const unsigned char *pdu, int len, void > *data); > + > gboolean __ofono_ussd_ssc_register(struct ofono_ussd *ussd, const char *sc, > ofono_ussd_ssc_cb_t cb, void *data, > ofono_destroy_func destroy); > @@ -269,6 +272,10 @@ gboolean __ofono_ussd_passwd_register(struct ofono_ussd > *ussd, const char *sc, > void __ofono_ussd_passwd_unregister(struct ofono_ussd *ussd, const char *sc); > gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd); > > +int __ofono_ussd_initiate(struct ofono_ussd *ussd, int dcs, > + const unsigned char *pdu, int len, > + ofono_ussd_request_cb_t cb, void *user_data); > + Do we need a cancel here as well? In case the SIM cancels the session. > #include > > typedef void (*ofono_netreg_status_notify_cb_t)(int status, int lac, int ci, > diff --git a/src/ussd.c b/src/ussd.c > index 8d9c98d..af0aae1 100644 > --- a/src/ussd.c > +++ b/src/ussd.c > @@ -49,6 +49,15 @@ enum ussd_state { > USSD_STATE_RESPONSE_SENT, > }; > > +struct ussd_request { > + struct ofono_ussd *ussd; > + int dcs; > + unsigned char *pdu; > + int len; > + ofono_ussd_request_cb_t cb; > + void *user_data; > +}; > + > struct ofono_ussd { > int state; > DBusMessage *pending; > @@ -59,6 +68,7 @@ struct ofono_ussd { > const struct ofono_ussd_driver *driver; > void *driver_data; > struct ofono_atom *atom; > + struct ussd_request *req; > }; > > struct ssc_entry { > @@ -73,7 +83,7 @@ gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd) > if (!ussd) > return FALSE; > > - if (ussd->pending || ussd->state != USSD_STATE_IDLE) > + if (ussd->pending || ussd->state != USSD_STATE_IDLE || ussd->req) > return TRUE; You might also want to make sure that initiate / respond / cancel cannot interfere with the SIM request. > > return FALSE; > @@ -320,6 +330,31 @@ static void ussd_change_state(struct ofono_ussd *ussd, > int state) > "State", DBUS_TYPE_STRING, &value); > } > > +static void ussd_request_finish(struct ofono_ussd *ussd, int error, int dcs, > + const unsigned char *pdu, int len) > +{ > + struct ussd_request *req = ussd->req; > + > + if (req && req->cb) { > + req->cb(error, dcs, pdu, len, req->user_data); > + g_free(req->pdu); > + g_free(req); > + ussd->req = NULL; What if req->cb is NULL? > + } > +} > + > +static int ussd_status_to_failure_code(int status) > +{ > + switch (status) { > + case OFONO_USSD_STATUS_TIMED_OUT: > + return -ETIMEDOUT; > + case OFONO_USSD_STATUS_NOT_SUPPORTED: > + return -ENOSYS; > + } > + > + return 0; > +} > + > void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, > const unsigned char *data, int data_len) > { > @@ -332,6 +367,19 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int > status, int dcs, > DBusMessageIter iter; > DBusMessageIter variant; > > + if (ussd->req && > + (status == OFONO_USSD_STATUS_NOTIFY || > + status == OFONO_USSD_STATUS_TERMINATED || > + status == OFONO_USSD_STATUS_TIMED_OUT || > + status == OFONO_USSD_STATUS_NOT_SUPPORTED)) { > + Please check coding style section M4 So what happens if the network sends a ACTION_REQUIRED as a response to the STK ussd? > + ussd_request_finish(ussd, ussd_status_to_failure_code(status), > + dcs, data, data_len); > + > + ussd_change_state(ussd, USSD_STATE_IDLE); > + return; > + } > + > if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) { > ussd_change_state(ussd, USSD_STATE_IDLE); > > @@ -577,6 +625,9 @@ static void ussd_cancel_callback(const struct ofono_error > *error, void *data) > reply = dbus_message_new_method_return(ussd->cancel); > __ofono_dbus_pending_reply(&ussd->cancel, reply); > > + if (ussd->req) > + ussd_request_finish(ussd, -1, -ECANCELED, NULL, -1); > + > ussd_change_state(ussd, USSD_STATE_IDLE); > } > > @@ -775,3 +
Re: [online-impl-v2 PATCH 00/10] implement Online property
Hi, 2010/9/9 Marcel Holtmann : >> Here are 2nd stab at implementing Online property with various modem >> drivers. > > so I pushed most of them, but not all of them. Ok. Cool. > STE version needs testing by the STE guys, but I did run into some SIM > not ready issues with MBM when switching online/offline a few times. So > that needs to be looked into. Please have a peek in your AT log and see if there are some spurious +GCAP: lines? My Dell 5530 branded MBM apparently sends internal AT+GCAP command. Command and its results gets echoed to the serial port which obviously confuses the AT parser. Perhaps most MBMs would benefit from registering dummy "+GCAP:". > The Huawei has more and more issues with SIM not ready now. This needs > fixing anyway. I pushed the patch anymore to make these symptoms more > clear to everybody. I'll try to remember to fish out my Huawei from the junk box and see what it has to offer now. ;) -- Pekka.Pessi mail at nokia.com ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [online-impl-v2 PATCH 00/10] implement Online property
[Marcel] > STE version needs testing by the STE guys, but I did run into some SIM > not ready issues with MBM when switching online/offline a few times. So > that needs to be looked into. OK, I'll put in on our list. Perhaps you could send me thelogs if you still have them around? Regards Sjur ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/4] Internal and Driver API changes for Send USSD
--- drivers/atmodem/ussd.c | 115 --- drivers/isimodem/ussd.c | 42 +++-- include/ussd.h |8 ++- src/ussd.c | 39 +--- 4 files changed, 115 insertions(+), 89 deletions(-) diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c index 30145ad..685bc9b 100644 --- a/drivers/atmodem/ussd.c +++ b/drivers/atmodem/ussd.c @@ -65,15 +65,17 @@ static void read_charset_cb(gboolean ok, GAtResult *result, static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) { + struct ussd_data *data = ofono_ussd_get_data(ussd); GAtResultIter iter; int status; int dcs; - const char *content; - char *converted = NULL; - gboolean udhi; + const char *content = NULL; enum sms_charset charset; - gboolean compressed; - gboolean iso639; + unsigned char msg[160]; + const unsigned char *msg_ptr = NULL; + unsigned char *converted = NULL; + long written; + long msg_len = 0; g_at_result_iter_init(&iter, result); @@ -86,34 +88,50 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) if (!g_at_result_iter_next_string(&iter, &content)) goto out; - if (g_at_result_iter_next_number(&iter, &dcs)) { - if (!cbs_dcs_decode(dcs, &udhi, NULL, &charset, - &compressed, NULL, &iso639)) - goto out; + if (!g_at_result_iter_next_number(&iter, &dcs)) + dcs = 0; - if (udhi || compressed || iso639) - goto out; - } else - charset = SMS_CHARSET_7BIT; - - if (charset == SMS_CHARSET_7BIT) - converted = convert_gsm_to_utf8((const guint8 *) content, - strlen(content), NULL, NULL, 0); - - else if (charset == SMS_CHARSET_8BIT) { - /* TODO: Figure out what to do with 8 bit data */ - ofono_error("8-bit coded USSD response received"); - status = 4; /* Not supported */ - } else { - /* No other encoding is mentioned in TS27007 7.15 */ + if (!cbs_dcs_decode(dcs, NULL, NULL, &charset, NULL, NULL, NULL)) { ofono_error("Unsupported USSD data coding scheme (%02x)", dcs); status = 4; /* Not supported */ + goto out; } -out: - ofono_ussd_notify(ussd, status, converted); + switch (charset) { + case SMS_CHARSET_7BIT: + if (data->charset == AT_UTIL_CHARSET_GSM) + msg_ptr = pack_7bit_own_buf((const guint8 *) content, + strlen(content), 0, TRUE, &msg_len, 0, msg); + else if (data->charset == AT_UTIL_CHARSET_UTF8) + ussd_encode(content, &msg_len, msg); + else if (data->charset == AT_UTIL_CHARSET_UCS2) { + msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); + + converted = convert_ucs2_to_gsm(msg_ptr, msg_len, NULL, + &written, 0); + if (!converted) { + msg_ptr = NULL; + msg_len = 0; + goto out; + } + + msg_ptr = pack_7bit_own_buf(converted, + written, 0, TRUE, + &msg_len, 0, msg); + + g_free(converted); + } + break; + case SMS_CHARSET_8BIT: + msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); + break; + case SMS_CHARSET_UCS2: + msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); + break; + } - g_free(converted); +out: + ofono_ussd_notify(ussd, status, dcs, msg_ptr, msg_len); } static void cusd_request_cb(gboolean ok, GAtResult *result, gpointer user_data) @@ -130,39 +148,45 @@ static void cusd_request_cb(gboolean ok, GAtResult *result, gpointer user_data) cusd_parse(result, ussd); } -static void at_ussd_request(struct ofono_ussd *ussd, const char *str, +static void at_ussd_request(struct ofono_ussd *ussd, int dcs, + const unsigned char *pdu, int len, ofono_ussd_cb_t cb, void *user_data) { struct ussd_data *data = ofono_ussd_get_data(ussd); struct cb_data *cbd = cb_data_new(cb, user_data); - unsigned char *converted = NULL; - int dcs; - int max_len; - long written; char buf[256]; + unsigned char unpacked_buf[182]; + char coded_buf[160]; + char *converted; + long written; +
Re: [online-impl-v2 PATCH 00/10] implement Online property
Hi Sjur, > > STE version needs testing by the STE guys, but I did run into some SIM > > not ready issues with MBM when switching online/offline a few times. So > > that needs to be looked into. > > OK, I'll put in on our list. > Perhaps you could send me thelogs if you still have them around? don't have them with me. But I just did a lot off online-modem, offline-modem, disable-modem, enable-modem executions in random order to see how it behaves. MBM with older F35xx models had some issues. The STE I haven't tested, but it might be similar. Maybe it is just fine actually. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [online-impl-v2 PATCH 00/10] implement Online property
Hi Pekka, > > STE version needs testing by the STE guys, but I did run into some SIM > > not ready issues with MBM when switching online/offline a few times. So > > that needs to be looked into. > > Please have a peek in your AT log and see if there are some spurious > +GCAP: lines? My Dell 5530 branded MBM apparently sends internal > AT+GCAP command. Command and its results gets echoed to the serial > port which obviously confuses the AT parser. Perhaps most MBMs would > benefit from registering dummy "+GCAP:". that is clearly not with mine. I have the MBM original and the Lenovo branded ones which are not branded at all actually. So these behave properly and no +GCAP in between. > > The Huawei has more and more issues with SIM not ready now. This needs > > fixing anyway. I pushed the patch anymore to make these symptoms more > > clear to everybody. > > I'll try to remember to fish out my Huawei from the junk box and see > what it has to offer now. ;) I have like 5 different Huawei models now. I just didn't have the time to dig into this to get it fixed. Basically the online mode support show the same symptoms than plugging in the modem while ofonod is already running. So the SIM ready support needs a bit of re-work I assume. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/4] Add __ofono_ussd_initiate internal api for Sending USSD
--- src/ofono.h |8 + src/ussd.c | 101 --- 2 files changed, 104 insertions(+), 5 deletions(-) diff --git a/src/ofono.h b/src/ofono.h index f1c0973..f64f149 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -258,6 +258,9 @@ typedef gboolean (*ofono_ussd_passwd_cb_t)(const char *sc, const char *old, const char *new, DBusMessage *msg, void *data); +typedef void (*ofono_ussd_request_cb_t)(int error, int dcs, + const unsigned char *pdu, int len, void *data); + gboolean __ofono_ussd_ssc_register(struct ofono_ussd *ussd, const char *sc, ofono_ussd_ssc_cb_t cb, void *data, ofono_destroy_func destroy); @@ -269,6 +272,11 @@ gboolean __ofono_ussd_passwd_register(struct ofono_ussd *ussd, const char *sc, void __ofono_ussd_passwd_unregister(struct ofono_ussd *ussd, const char *sc); gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd); +int __ofono_ussd_initiate(struct ofono_ussd *ussd, int dcs, + const unsigned char *pdu, int len, + ofono_ussd_request_cb_t cb, void *user_data); +void __ofono_ussd_initiate_cancel(struct ofono_ussd *ussd); + #include typedef void (*ofono_netreg_status_notify_cb_t)(int status, int lac, int ci, diff --git a/src/ussd.c b/src/ussd.c index f89345a..cb1d2e1 100644 --- a/src/ussd.c +++ b/src/ussd.c @@ -49,6 +49,15 @@ enum ussd_state { USSD_STATE_RESPONSE_SENT, }; +struct ussd_request { + struct ofono_ussd *ussd; + int dcs; + unsigned char *pdu; + int len; + ofono_ussd_request_cb_t cb; + void *user_data; +}; + struct ofono_ussd { int state; DBusMessage *pending; @@ -59,6 +68,7 @@ struct ofono_ussd { const struct ofono_ussd_driver *driver; void *driver_data; struct ofono_atom *atom; + struct ussd_request *req; }; struct ssc_entry { @@ -73,7 +83,7 @@ gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd) if (!ussd) return FALSE; - if (ussd->pending || ussd->state != USSD_STATE_IDLE) + if (ussd->pending || ussd->state != USSD_STATE_IDLE || ussd->req) return TRUE; return FALSE; @@ -320,6 +330,31 @@ static void ussd_change_state(struct ofono_ussd *ussd, int state) "State", DBUS_TYPE_STRING, &value); } +static void ussd_request_finish(struct ofono_ussd *ussd, int error, int dcs, + const unsigned char *pdu, int len) +{ + struct ussd_request *req = ussd->req; + + if (req && req->cb) + req->cb(error, dcs, pdu, len, req->user_data); + + g_free(req->pdu); + g_free(req); + ussd->req = NULL; +} + +static int ussd_status_to_failure_code(int status) +{ + switch (status) { + case OFONO_USSD_STATUS_TIMED_OUT: + return -ETIMEDOUT; + case OFONO_USSD_STATUS_NOT_SUPPORTED: + return -ENOSYS; + } + + return 0; +} + void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, const unsigned char *data, int data_len) { @@ -332,6 +367,18 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, DBusMessageIter iter; DBusMessageIter variant; + if (ussd->req && + (status == OFONO_USSD_STATUS_NOTIFY || + status == OFONO_USSD_STATUS_TERMINATED || + status == OFONO_USSD_STATUS_TIMED_OUT || + status == OFONO_USSD_STATUS_NOT_SUPPORTED)) { + ussd_request_finish(ussd, ussd_status_to_failure_code(status), + dcs, data, data_len); + + ussd_change_state(ussd, USSD_STATE_IDLE); + return; + } + if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) { ussd_change_state(ussd, USSD_STATE_IDLE); @@ -465,10 +512,7 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg, unsigned char buf[160]; long num_packed; - if (ussd->pending) - return __ofono_error_busy(msg); - - if (ussd->state != USSD_STATE_IDLE) + if (__ofono_ussd_is_busy(ussd)) return __ofono_error_busy(msg); if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, @@ -581,6 +625,9 @@ static void ussd_cancel_callback(const struct ofono_error *error, void *data) reply = dbus_message_new_method_return(ussd->cancel); __ofono_dbus_pending_reply(&ussd->cancel, reply); + if (ussd->req) + ussd_request_finish(ussd, -1, -ECANCELED, NULL, -1); + ussd_change_state(ussd, USSD_STATE_IDLE); } @@ -779,3 +826,47 @@ void *ofono_ussd_get_data(struct ofono_ussd
[PATCH 3/4] stk: Handling of Send USSD proactive command
--- src/stk.c | 173 - 1 files changed, 172 insertions(+), 1 deletions(-) diff --git a/src/stk.c b/src/stk.c index 04bfc65..f94643f 100644 --- a/src/stk.c +++ b/src/stk.c @@ -1590,6 +1590,174 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd, return FALSE; } +static void send_ussd_cancel(struct ofono_stk *stk) +{ + struct ofono_ussd *ussd; + struct ofono_atom *atom; + + atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom), + OFONO_ATOM_TYPE_USSD); + if (!atom) + return; + + ussd = __ofono_atom_get_data(atom); + if (ussd) + __ofono_ussd_initiate_cancel(ussd); + + if (stk->pending_cmd->send_ussd.alpha_id && + stk->pending_cmd->send_ussd.alpha_id[0]) + stk_alpha_id_unset(stk); +} + +static void send_ussd_callback(int error, int dcs, const unsigned char *msg, + int msg_len, void *userdata) +{ + struct ofono_stk *stk = userdata; + struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE }; + struct stk_response rsp; + enum sms_charset charset; + + if (stk->pending_cmd->send_ussd.alpha_id && + stk->pending_cmd->send_ussd.alpha_id[0]) + stk_alpha_id_unset(stk); + + memset(&rsp, 0, sizeof(rsp)); + + switch (error) { + case 0: + if (cbs_dcs_decode(dcs, NULL, NULL, &charset, + NULL, NULL, NULL)) { + if (charset == SMS_CHARSET_7BIT) + rsp.send_ussd.text.dcs = 0x00; + else if (charset == SMS_CHARSET_8BIT) + rsp.send_ussd.text.dcs = 0x04; + else if (charset == SMS_CHARSET_UCS2) + rsp.send_ussd.text.dcs = 0x08; + + rsp.result.type = STK_RESULT_TYPE_SUCCESS; + rsp.send_ussd.text.text = msg; + rsp.send_ussd.text.len = msg_len; + } else { + rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR; + rsp.result.additional = (unsigned char *) &error; + rsp.result.additional_len = 1; + rsp.send_ussd.text.dcs = -1; + } + + if (stk_respond(stk, &rsp, stk_command_cb)) + stk_command_cb(&failure, stk); + + break; + case -ECANCELED: + send_simple_response(stk, + STK_RESULT_TYPE_USSD_OR_SS_USER_TERMINATION); + break; + case -ETIMEDOUT: + send_simple_response(stk, STK_RESULT_TYPE_NETWORK_UNAVAILABLE); + break; + default: + rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR; + rsp.result.additional = (unsigned char *) &error; + rsp.result.additional_len = 1; + rsp.send_ussd.text.dcs = -1; + + if (stk_respond(stk, &rsp, stk_command_cb)) + stk_command_cb(&failure, stk); + + break; + } +} + +static gboolean handle_command_send_ussd(const struct stk_command *cmd, + struct stk_response *rsp, + struct ofono_stk *stk) +{ + struct ofono_modem *modem = __ofono_atom_get_modem(stk->atom); + static unsigned char busy_on_ss_result[] = { 0x03 }; + static unsigned char busy_on_ussd_result[] = { 0x08 }; + struct ofono_atom *atom; + struct ofono_ussd *ussd; + int err; + + atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_CALL_FORWARDING); + if (atom && __ofono_atom_get_registered(atom)) { + struct ofono_call_forwarding *cf = __ofono_atom_get_data(atom); + + if (__ofono_call_forwarding_is_busy(cf)) { + rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY; + rsp->result.additional_len = sizeof(busy_on_ss_result); + rsp->result.additional = busy_on_ss_result; + return TRUE; + } + } + + atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_CALL_BARRING); + if (atom && __ofono_atom_get_registered(atom)) { + struct ofono_call_barring *cb = __ofono_atom_get_data(atom); + + if (__ofono_call_barring_is_busy(cb)) { + rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY; + rsp->result.additional_len = sizeof(busy_on_ss_result); + rsp->result.additional = busy_on_ss_result; + return TRUE; + } + } + + atom = __ofono_modem_find_atom(modem, OFONO
[PATCH] phonesim: simulate language notification in sim app
--- src/qsimcommand.cpp| 11 src/simapplication.cpp | 68 src/simapplication.h |2 + 3 files changed, 81 insertions(+), 0 deletions(-) diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp index 9a9a169..9746592 100644 --- a/src/qsimcommand.cpp +++ b/src/qsimcommand.cpp @@ -3280,6 +3280,17 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const } break; +case LanguageNotification: +{ +if ( qualifier & 0x01 ) { +data += (char)0xAD; +data += (char)0x02; +data += (char)0x73; +data += (char)0x65; +} +} +break; + default: break; } diff --git a/src/simapplication.cpp b/src/simapplication.cpp index 4af510b..a54ec10 100644 --- a/src/simapplication.cpp +++ b/src/simapplication.cpp @@ -281,6 +281,7 @@ const QString DemoSimApplication::getName() #define MainMenu_Browser9 #define MainMenu_DTMF 10 #define MainMenu_SendSS 11 +#define MainMenu_Language 12 #define SportsMenu_Chess1 #define SportsMenu_Painting 2 @@ -329,6 +330,10 @@ const QString DemoSimApplication::getName() #define CoLRMenu_Interrogation2 #define CoLRMenu_Deactivation 3 +#define Language_Specific 1 +#define Language_Non_Specific 2 +#define Language_Main 3 + void DemoSimApplication::mainMenu() { QSimCommand cmd; @@ -381,6 +386,10 @@ void DemoSimApplication::mainMenu() item.setLabel( "Send SS" ); items += item; +item.setIdentifier( MainMenu_Language ); +item.setLabel( "Language Notification" ); +items += item; + cmd.setMenuItems( items ); command( cmd, 0, 0 ); @@ -481,6 +490,12 @@ void DemoSimApplication::mainMenuSelection( int id ) } break; +case MainMenu_Language: +{ +sendLanguageMenu(); +} +break; + default: { // Don't know what this item is, so just re-display the main menu. @@ -1642,3 +1657,56 @@ void DemoSimApplication::CoLRMenu( const QSimTerminalResponse& resp ) endSession(); } } + +void DemoSimApplication::sendLanguageMenu() +{ +QSimCommand cmd; +QSimMenuItem item; +QList items; + +cmd.setType( QSimCommand::SelectItem ); +cmd.setTitle( "Language Notification" ); + +item.setIdentifier( Language_Specific ); +item.setLabel( "Specific Language" ); +items += item; + +item.setIdentifier( Language_Non_Specific ); +item.setLabel( "Non-Specific Language" ); +items += item; + +item.setIdentifier( Language_Main ); +item.setLabel( "Return to main menu" ); +items += item; + +cmd.setMenuItems( items ); + +command( cmd, this, SLOT(languageMenu(QSimTerminalResponse)) ); +} + +void DemoSimApplication::languageMenu( const QSimTerminalResponse& resp ) +{ +QSimCommand cmd; + +if ( resp.result() == QSimTerminalResponse::Success ) { +cmd.setDestinationDevice( QSimCommand::ME ); +cmd.setSourceDevice( QSimCommand::SIM ); +cmd.setType( QSimCommand::LanguageNotification ); + +// Item selected. +switch ( resp.menuItem() ) { +case Language_Specific: +cmd.setQualifier( 1 ); +command( cmd, this, SLOT(sendLanguageMenu()) ); +break; +case Language_Non_Specific: +cmd.setQualifier( 0 ); +command( cmd, this, SLOT(sendLanguageMenu()) ); +break; +default: +endSession(); +break; +} +} else +endSession(); +} diff --git a/src/simapplication.h b/src/simapplication.h index 0f67317..fc57423 100644 --- a/src/simapplication.h +++ b/src/simapplication.h @@ -109,6 +109,8 @@ protected slots: void CoLPMenu( const QSimTerminalResponse& resp ); void sendCoLRMenu(); void CoLRMenu( const QSimTerminalResponse& resp ); +void sendLanguageMenu(); +void languageMenu( const QSimTerminalResponse& resp ); private: int sticksLeft; -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Fix common misspellings
Hi, On Tue, Sep 14, 2010 at 12:21 AM, Gu, Yang wrote: > This is an interesting patch. I guess you must have some tool/script to help > you find all the misspellings against this list. Could you please share the > tool/script? After all, we can check the code in the future as this kind of > mistake may happen from time to time. Yes, I use a script I made based on the format of misspelling corrections available at wikipedia. I've uploaded the 3 files I used to http://people.profusion.mobi/~lucas/playground/ First, and most important: fix-typos.sh. It reads from stdin the words to fix in the following format: word->correction If there is more than 1 possible fix, use a "," in the end of the correction. In that case it will output to stderr the suggestions instead of automatically fixing. The second file, typos.txt, is the dictionary, based on that of wikipedia. I prepared it paying attention to some problematic words and suggestions from other projects (mainly EFL and Linux kernel) The third file is a script to get the changed words in the format I used in commit message. It needs to be in a git repository in order to work. I usually run like this: ~/bin/fix-typos.sh 2>&1 > /tmp/log.txt < ~/tmp/typos.txt | tee /tmp/log2.txt In /tmp/log.txt will be the progress of the substitutions. It will print it word it's searching for. In /tmp/log2.txt will be the fixes made and suggestions about other words that can be manually fixed later. I hope this helps. regards Lucas De Marchi ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH] Fix common misspellings
Hi > >Yes, I use a script I made based on the format of misspelling >corrections available at wikipedia. I've uploaded the 3 files I used >to http://people.profusion.mobi/~lucas/playground/ > >First, and most important: fix-typos.sh. It reads from stdin the words >to fix in the following format: > >word->correction > >If there is more than 1 possible fix, use a "," in the end of the >correction. In that case it will output to stderr the suggestions >instead of automatically fixing. > >The second file, typos.txt, is the dictionary, based on that of >wikipedia. I prepared it paying attention to some problematic words >and suggestions from other projects (mainly EFL and Linux kernel) > >The third file is a script to get the changed words in the format I >used in commit message. It needs to be in a git repository in order to >work. > > >I usually run like this: > >~/bin/fix-typos.sh 2>&1 > /tmp/log.txt < ~/tmp/typos.txt | tee /tmp/log2.txt > >In /tmp/log.txt will be the progress of the substitutions. It will >print it word it's searching for. >In /tmp/log2.txt will be the fixes made and suggestions about other >words that can be manually fixed later. > > >I hope this helps. Thanks for sharing the useful scripts! Regards, -Yang ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono