BDN description update
by Jeevaka Badrappan
Hi,
BDN will not be supported by oFono. When a BDN service enabled SIM is used,
oFono will go into emergency mode.
Regards,
jeevaka
11 years, 8 months
[PATCH] stk: Additional info for failed Send USSD case
by Jeevaka Badrappan
---
src/stk.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/stk.c b/src/stk.c
index bbbc4fd..80b4d23 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1621,6 +1621,7 @@ static void send_ussd_callback(int error, int dcs, const unsigned char *msg,
struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
struct stk_response rsp;
enum sms_charset charset;
+ unsigned char no_cause[] = { 0x00 };
if (stk->pending_cmd->send_ussd.alpha_id &&
stk->pending_cmd->send_ussd.alpha_id[0])
@@ -1661,7 +1662,13 @@ static void send_ussd_callback(int error, int dcs, const unsigned char *msg,
break;
default:
- send_simple_response(stk, STK_RESULT_TYPE_USSD_RETURN_ERROR);
+ rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR;
+ rsp.result.additional_len = sizeof(no_cause);
+ rsp.result.additional = no_cause;
+
+ if (stk_respond(stk, &rsp, stk_command_cb))
+ stk_command_cb(&failure, stk);
+
break;
}
}
--
1.7.0.4
11 years, 8 months
Huawei EC1260 not working
by Debayan Banerjee
I have a Huawei EC1260 modem. It gets detected as a GSM modem without
installing usb_modeswitch on my MeeGo netbook. I started ofono with
debug options. I added a line for this device in ofono.rules and on
plugging in the modem it does print 3 similar lines of text suggesting
that it has detected a modem. However the list-devices script does not
list any modem. I went through
http://ofono.org/wiki/how-enable-modem-ofono . Do I have to wait for
someone to write a driver plugin for ofono?
--
Debayan Banerjee
Software Engineer
11 years, 8 months
[PATCH] sms: Implement text and datagram watch
by Aki Niemi
This patch allows adding a watch for incoming text and datagram
messages on the sms atom.
---
src/ofono.h | 20 +++++++
src/sms.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 162 insertions(+), 17 deletions(-)
diff --git a/src/ofono.h b/src/ofono.h
index 6c7f649..b379a6c 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -229,12 +229,32 @@ enum ofono_sms_submit_flag {
};
typedef void (*ofono_sms_txq_submit_cb_t)(gboolean ok, void *data);
+typedef void (*ofono_sms_text_notify_cb_t)(const char *from, const char *text,
+ time_t when, void *data);
+typedef void (*ofono_sms_datagram_notify_cb_t)(const char *from,
+ int dst, int src,
+ const unsigned char *buffer,
+ unsigned int len,
+ time_t when, void *data);
int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
unsigned int flags, struct ofono_uuid *uuid,
ofono_sms_txq_submit_cb_t cb,
void *data, ofono_destroy_func destroy);
+unsigned int __ofono_sms_text_watch_add(struct ofono_sms *sms,
+ ofono_sms_text_notify_cb_t cb,
+ void *data, ofono_destroy_func destroy);
+gboolean __ofono_sms_text_watch_remove(struct ofono_sms *sms,
+ unsigned int id);
+
+unsigned int __ofono_sms_datagram_watch_add(struct ofono_sms *sms,
+ ofono_sms_datagram_notify_cb_t cb,
+ int dst, int src, void *data,
+ ofono_destroy_func destroy);
+gboolean __ofono_sms_datagram_watch_remove(struct ofono_sms *sms,
+ unsigned int id);
+
#include <ofono/sim.h>
#include <ofono/stk.h>
diff --git a/src/sms.c b/src/sms.c
index b7051b9..0de977d 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -62,6 +62,12 @@ struct message {
enum message_state state;
};
+struct sms_handler {
+ struct ofono_watchlist_item item;
+ int dst;
+ int src;
+};
+
struct ofono_sms {
int flags;
DBusMessage *pending;
@@ -82,6 +88,8 @@ struct ofono_sms {
ofono_bool_t use_delivery_reports;
struct status_report_assembly *sr_assembly;
GHashTable *messages;
+ struct ofono_watchlist *text_handlers;
+ struct ofono_watchlist *datagram_handlers;
};
struct pending_pdu {
@@ -108,6 +116,11 @@ static gboolean uuid_equal(gconstpointer v1, gconstpointer v2)
return memcmp(v1, v2, OFONO_SHA1_UUID_LEN) == 0;
}
+static gboolean port_equal(int received, int expected)
+{
+ return expected == -1 || received == expected;
+}
+
static guint uuid_hash(gconstpointer v)
{
const struct ofono_uuid *uuid = v;
@@ -170,6 +183,77 @@ static void append_message_properties(struct message *m, DBusMessageIter *dict)
ofono_dbus_dict_append(dict, "State", DBUS_TYPE_STRING, &state);
}
+static unsigned int add_sms_handler(struct ofono_watchlist *watchlist,
+ int dst, int src, void *notify,
+ void *data, ofono_destroy_func destroy)
+{
+ struct sms_handler *handler;
+
+ if (!notify)
+ return 0;
+
+ handler = g_try_new0(struct sms_handler, 1);
+ if (!handler)
+ return 0;
+
+ handler->dst = dst;
+ handler->src = src;
+ handler->item.notify = notify;
+ handler->item.notify_data = data;
+ handler->item.destroy = destroy;
+
+ return __ofono_watchlist_add_item(watchlist,
+ (struct ofono_watchlist_item *)handler);
+}
+
+unsigned int __ofono_sms_text_watch_add(struct ofono_sms *sms,
+ ofono_sms_text_notify_cb_t cb,
+ void *data, ofono_destroy_func destroy)
+{
+ if (!sms)
+ return 0;
+
+ DBG("%p", sms);
+
+ return add_sms_handler(sms->text_handlers, -1, -1, cb, data, destroy);
+}
+
+gboolean __ofono_sms_text_watch_remove(struct ofono_sms *sms,
+ unsigned int id)
+{
+ if (!sms)
+ return FALSE;
+
+ DBG("%p", sms);
+
+ return __ofono_watchlist_remove_item(sms->text_handlers, id);
+}
+
+unsigned int __ofono_sms_datagram_watch_add(struct ofono_sms *sms,
+ ofono_sms_datagram_notify_cb_t cb,
+ int dst, int src, void *data,
+ ofono_destroy_func destroy)
+{
+ if (!sms)
+ return 0;
+
+ DBG("%p: dst %d, src %d", sms, dst, src);
+
+ return add_sms_handler(sms->datagram_handlers, dst, src, cb, data,
+ destroy);
+}
+
+gboolean __ofono_sms_datagram_watch_remove(struct ofono_sms *sms,
+ unsigned int id)
+{
+ if (!sms)
+ return FALSE;
+
+ DBG("%p", sms);
+
+ return __ofono_watchlist_remove_item(sms->datagram_handlers, id);
+}
+
static DBusMessage *message_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -1064,12 +1148,31 @@ static gboolean compute_incoming_msgid(GSList *sms_list,
return TRUE;
}
-static void dispatch_app_datagram(struct ofono_sms *sms, int dst, int src,
- unsigned char *buf, long len)
+static void dispatch_app_datagram(struct ofono_sms *sms,
+ const struct ofono_uuid *uuid,
+ int dst, int src,
+ unsigned char *buf, unsigned len,
+ const struct sms_address *addr,
+ const struct sms_scts *scts)
{
- DBG("Got app datagram for dst port: %d, src port: %d",
- dst, src);
- DBG("Contents-Len: %ld", len);
+ const char *sender = sms_address_to_string(addr);
+ time_t ts = sms_scts_to_time(scts, NULL);
+ ofono_sms_datagram_notify_cb_t notify;
+ struct sms_handler *h;
+ GSList *l;
+
+ for (l = sms->datagram_handlers->items; l; l = l->next) {
+ h = l->data;
+ notify = h->item.notify;
+
+ DBG("dst: want %d, have %d", h->dst, dst);
+ DBG("src: want %d, have %d", h->src, src);
+
+ if (!port_equal(dst, h->dst) || !port_equal(src, h->src))
+ continue;
+
+ notify(sender, dst, src, buf, len, ts, h->item.notify_data);
+ }
}
static void dispatch_text_message(struct ofono_sms *sms,
@@ -1091,6 +1194,9 @@ static void dispatch_text_message(struct ofono_sms *sms,
struct tm remote;
struct tm local;
const char *str = buf;
+ ofono_sms_text_notify_cb_t notify;
+ struct sms_handler *h;
+ GSList *l;
if (!message)
return;
@@ -1132,15 +1238,25 @@ static void dispatch_text_message(struct ofono_sms *sms,
g_dbus_send_message(conn, signal);
- if (cls != SMS_CLASS_0)
- __ofono_history_sms_received(modem, uuid, str,
- &remote, &local, message);
+ if (cls == SMS_CLASS_0)
+ return;
+
+ for (l = sms->text_handlers->items; l; l = l->next) {
+ h = l->data;
+ notify = h->item.notify;
+
+ notify(str, message, ts, h->item.notify_data);
+ }
+
+ __ofono_history_sms_received(modem, uuid, str, &remote, &local,
+ message);
}
static void sms_dispatch(struct ofono_sms *sms, GSList *sms_list)
{
GSList *l;
const struct sms *s;
+ struct ofono_uuid uuid;
enum sms_charset uninitialized_var(old_charset);
enum sms_class cls;
int srcport = -1;
@@ -1214,6 +1330,11 @@ static void sms_dispatch(struct ofono_sms *sms, GSList *sms_list)
}
}
+ if (!compute_incoming_msgid(sms_list, &uuid))
+ return;
+
+ s = sms_list->data;
+
/* Handle datagram */
if (old_charset == SMS_CHARSET_8BIT) {
unsigned char *buf;
@@ -1230,23 +1351,18 @@ static void sms_dispatch(struct ofono_sms *sms, GSList *sms_list)
if (!buf)
return;
- dispatch_app_datagram(sms, dstport, srcport, buf, len);
+ dispatch_app_datagram(sms, &uuid, dstport, srcport, buf, len,
+ &s->deliver.oaddr, &s->deliver.scts);
g_free(buf);
} else {
- struct ofono_uuid uuid;
char *message = sms_decode_text(sms_list);
if (!message)
return;
- if (compute_incoming_msgid(sms_list, &uuid)) {
- s = sms_list->data;
-
- dispatch_text_message(sms, &uuid, message, cls,
- &s->deliver.oaddr,
- &s->deliver.scts);
- }
+ dispatch_text_message(sms, &uuid, message, cls,
+ &s->deliver.oaddr, &s->deliver.scts);
g_free(message);
}
@@ -1527,6 +1643,12 @@ static void sms_unregister(struct ofono_atom *atom)
g_hash_table_destroy(sms->messages);
sms->messages = NULL;
}
+
+ __ofono_watchlist_free(sms->text_handlers);
+ sms->text_handlers = NULL;
+
+ __ofono_watchlist_free(sms->datagram_handlers);
+ sms->datagram_handlers = NULL;
}
static void sms_remove(struct ofono_atom *atom)
@@ -1741,6 +1863,9 @@ void ofono_sms_register(struct ofono_sms *sms)
sms->driver->bearer_set(sms, sms->bearer,
bearer_init_callback, sms);
+ sms->text_handlers = __ofono_watchlist_new(g_free);
+ sms->datagram_handlers = __ofono_watchlist_new(g_free);
+
__ofono_atom_register(sms->atom, sms_unregister);
}
--
1.7.0.4
11 years, 8 months
[PATCH] smart_messaging: Remove interface on atom removal
by Aki Niemi
---
plugins/smart_messaging.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/plugins/smart_messaging.c b/plugins/smart_messaging.c
index fb44cc1..27f88e7 100644
--- a/plugins/smart_messaging.c
+++ b/plugins/smart_messaging.c
@@ -99,6 +99,9 @@ static void sms_watch(struct ofono_atom *atom,
g_dbus_unregister_interface(conn,
ofono_modem_get_path(sm->modem),
SMART_MESSAGING_INTERFACE);
+
+ ofono_modem_remove_interface(sm->modem,
+ SMART_MESSAGING_INTERFACE);
return;
}
--
1.7.0.4
11 years, 8 months
Additional info for failed SAT-Send USSD case
by Jeevaka Badrappan
Hi,
Following patch handles the SAT initiated Send USSD failure case.
As per the 3GPP 31.111 specification section 6.4.12, when a SAT initiated
Send USSD fails, error code from the network should be sent as
additional information(part of Result data). If no additional information
can be sent, then 0( No specific cause can be given) should be sent.
Due to the current limitations, this patch sends "No Specific cause can be
givent" to the SAT.
Regards,
jeevaka
11 years, 8 months