[PATCH -v2 1/7] bluetooth: Add bluetooth server support
by Gustavo F. Padovan
From: Frédéric Danis <frederic.danis(a)linux.intel.com>
---
Makefile.am | 1 +
plugins/bluetooth.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++-
plugins/bluetooth.h | 9 ++
3 files changed, 288 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 758fb10..e402de4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,7 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
builtin_modules += hfp
builtin_sources += plugins/hfp.c plugins/bluetooth.h
+builtin_sources += $(btio_sources)
builtin_cflags += @BLUEZ_CFLAGS@
builtin_libadd += @BLUEZ_LIBS@
endif
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 93dd7a1..b489dad 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -35,12 +35,30 @@
#include <ofono/dbus.h>
+#include <btio.h>
#include "bluetooth.h"
static DBusConnection *connection;
static GHashTable *uuid_hash = NULL;
static GHashTable *adapter_address_hash = NULL;
static gint bluetooth_refcount;
+static GSList *server_list = NULL;
+
+struct server {
+ guint8 channel;
+ char *sdp_record;
+ GIOChannel *io;
+ GHashTable *adapter_hash;
+ ConnectFunc connect_cb;
+ gpointer user_data;
+ GSList *client_list;
+};
+
+struct cb_data {
+ struct server *server;
+ char *path;
+ guint source;
+};
void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
char *buf, int size)
@@ -409,6 +427,202 @@ done:
dbus_message_unref(reply);
}
+static void get_adapter_properties(const char *path, const char *handle,
+ gpointer user_data)
+{
+ bluetooth_send_with_reply(path, BLUEZ_ADAPTER_INTERFACE,
+ "GetProperties", adapter_properties_cb,
+ g_strdup(path), g_free, -1, DBUS_TYPE_INVALID);
+}
+
+static void remove_record(char *path, guint handle, struct server *server)
+{
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE, path,
+ BLUEZ_SERVICE_INTERFACE,
+ "RemoveRecord");
+ if (msg == NULL) {
+ ofono_error("Unable to allocate D-Bus RemoveRecord message");
+ return;
+ }
+
+ dbus_message_append_args(msg, DBUS_TYPE_UINT32, &handle,
+ DBUS_TYPE_INVALID);
+ g_dbus_send_message(connection, msg);
+
+ ofono_info("Unregistered handle for %s, channel %d: 0x%x", path,
+ server->channel, handle);
+}
+
+static void server_stop(struct server *server)
+{
+ /* Remove all client sources related to server */
+ while (server->client_list) {
+ g_source_remove(GPOINTER_TO_UINT(server->client_list->data));
+ server->client_list = g_slist_remove(server->client_list,
+ server->client_list->data);
+ }
+
+ g_hash_table_foreach_remove(server->adapter_hash,
+ (GHRFunc) remove_record, server);
+
+ if (server->io != NULL) {
+ g_io_channel_shutdown(server->io, TRUE, NULL);
+ g_io_channel_unref(server->io);
+ server->io = NULL;
+ }
+}
+
+static void cb_data_destroy(gpointer data)
+{
+ struct cb_data *cb_data = data;
+
+ if (cb_data->path != NULL)
+ g_free(cb_data->path);
+ g_free(cb_data);
+}
+
+static gboolean client_event(GIOChannel *chan, GIOCondition cond, gpointer data)
+{
+ struct cb_data *cb_data = data;
+ struct server *server = cb_data->server;
+
+ server->client_list = g_slist_remove(server->client_list,
+ GUINT_TO_POINTER(cb_data->source));
+
+ cb_data_destroy(cb_data);
+
+ return FALSE;
+}
+
+static void confirm_event(GIOChannel *io, gpointer user_data)
+{
+ struct server *server = user_data;
+ struct cb_data *client_data;
+ GError *err = NULL;
+ char laddress[18], raddress[18];
+ guint8 channel;
+
+ bt_io_get(io, BT_IO_RFCOMM, &err, BT_IO_OPT_SOURCE, laddress,
+ BT_IO_OPT_DEST, raddress,
+ BT_IO_OPT_CHANNEL, &channel,
+ BT_IO_OPT_INVALID);
+ if (err) {
+ ofono_error("%s", err->message);
+ g_error_free(err);
+ return;
+ }
+
+ ofono_info("New connection for %s on channel %u from: %s,", laddress,
+ channel, raddress);
+
+ if (!bt_io_accept(io, server->connect_cb, server->user_data,
+ NULL, &err)) {
+ ofono_error("%s", err->message);
+ g_error_free(err);
+ g_io_channel_unref(io);
+ return;
+ }
+
+ client_data = g_try_new0(struct cb_data, 1);
+ if (client_data == NULL) {
+ ofono_error("Unable to allocate client cb_data structure");
+ return;
+ }
+
+ client_data->server = server;
+ client_data->source = g_io_add_watch(io,
+ G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ client_event, client_data);
+ server->client_list = g_slist_prepend(server->client_list,
+ GUINT_TO_POINTER(client_data->source));
+}
+
+static void add_record_cb(DBusPendingCall *call, gpointer user_data)
+{
+ struct cb_data *cb_data = user_data;
+ DBusMessage *reply = dbus_pending_call_steal_reply(call);
+ DBusError derr;
+ guint32 handle;
+
+ dbus_error_init(&derr);
+
+ if (dbus_set_error_from_message(&derr, reply)) {
+ ofono_error("Replied with an error: %s, %s",
+ derr.name, derr.message);
+ dbus_error_free(&derr);
+ g_free(cb_data->path);
+ goto done;
+ }
+
+ dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32, &handle,
+ DBUS_TYPE_INVALID);
+
+ g_hash_table_insert(cb_data->server->adapter_hash, cb_data->path,
+ GUINT_TO_POINTER(handle));
+
+ ofono_info("Registered handle for %s, channel %d: 0x%x", cb_data->path,
+ cb_data->server->channel, handle);
+
+done:
+ /* Do not free cb_data->path, it is used in adapter_hash */
+ g_free(cb_data);
+ dbus_message_unref(reply);
+}
+
+static void server_add_record(const char *path, const char *handle,
+ struct server *server)
+{
+ struct cb_data *cb_data;
+
+ cb_data = g_try_new0(struct cb_data, 1);
+ if (cb_data == NULL) {
+ ofono_error("Unable to allocate cb_data structure");
+ return;
+ }
+
+ cb_data->server = server;
+ cb_data->path = g_strdup(path);
+
+ bluetooth_send_with_reply(path, BLUEZ_SERVICE_INTERFACE, "AddRecord",
+ add_record_cb, cb_data, NULL, -1,
+ DBUS_TYPE_STRING, &server->sdp_record,
+ DBUS_TYPE_INVALID);
+}
+
+static void server_start(struct server *server, char *path)
+{
+ GError *err = NULL;
+
+ if (server->io != NULL)
+ goto out;
+
+ server->io = bt_io_listen(BT_IO_RFCOMM, NULL, confirm_event,
+ server, NULL, &err,
+ BT_IO_OPT_CHANNEL, server->channel,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
+ BT_IO_OPT_INVALID);
+ if (server->io == NULL) {
+ ofono_error("Bluetooth channel %d register failed: %s",
+ server->channel, err->message);
+ g_error_free(err);
+ server_stop(server);
+ return;
+ }
+
+out:
+ if (server->sdp_record == NULL)
+ return;
+
+ if (path != NULL)
+ server_add_record(path, NULL, server);
+ else
+ g_hash_table_foreach(adapter_address_hash,
+ (GHFunc) server_add_record, server);
+
+}
+
static gboolean adapter_added(DBusConnection *connection, DBusMessage *message,
void *user_data)
{
@@ -422,6 +636,10 @@ static gboolean adapter_added(DBusConnection *connection, DBusMessage *message,
"GetProperties", adapter_properties_cb, g_strdup(path),
g_free, -1, DBUS_TYPE_INVALID);
+ if (server_list)
+ g_slist_foreach(server_list, (GFunc) server_start,
+ (gpointer) path);
+
return TRUE;
}
@@ -429,11 +647,19 @@ static gboolean adapter_removed(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
const char *path;
+ GSList *l;
if (dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID) == TRUE)
g_hash_table_remove(adapter_address_hash, path);
+ for (l = server_list; l; l = l->next) {
+ struct server *server = l->data;
+
+ /* Handle have already been removed, so removing related path */
+ g_hash_table_remove(server->adapter_hash, path);
+ }
+
return TRUE;
}
@@ -460,6 +686,10 @@ static void parse_adapters(DBusMessageIter *array, gpointer user_data)
"GetProperties", adapter_properties_cb,
g_strdup(path), g_free, -1, DBUS_TYPE_INVALID);
+ if (server_list)
+ g_slist_foreach(server_list, (GFunc) server_start,
+ (gpointer) path);
+
dbus_message_iter_next(&value);
}
}
@@ -541,6 +771,10 @@ static void bluetooth_ref(void)
adapter_address_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
+ bluetooth_send_with_reply("/", BLUEZ_MANAGER_INTERFACE, "GetProperties",
+ manager_properties_cb, NULL, NULL, -1,
+ DBUS_TYPE_INVALID);
+
increment:
g_atomic_int_inc(&bluetooth_refcount);
@@ -576,9 +810,8 @@ int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile)
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);
+ g_hash_table_foreach(adapter_address_hash,
+ (GHFunc) get_adapter_properties, NULL);
return 0;
}
@@ -590,5 +823,47 @@ void bluetooth_unregister_uuid(const char *uuid)
bluetooth_unref();
}
+struct server *bluetooth_register_server(guint8 channel, const char *sdp_record,
+ ConnectFunc cb, gpointer user_data)
+{
+ struct server *server;
+
+ server = g_try_new0(struct server, 1);
+ if (!server)
+ return NULL;
+
+ bluetooth_ref();
+
+ if (bluetooth_refcount == 0) {
+ g_free(server);
+ return NULL;
+ }
+
+ server->channel = channel;
+ if (sdp_record != NULL)
+ server->sdp_record = g_strdup(sdp_record);
+ server->connect_cb = cb;
+ server->user_data = user_data;
+ server->adapter_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, NULL);
+
+ server_start(server, NULL);
+
+ server_list = g_slist_prepend(server_list, server);
+
+ return server;
+}
+
+void bluetooth_unregister_server(struct server *server)
+{
+ server_list = g_slist_remove(server_list, server);
+ server_stop(server);
+ g_hash_table_destroy(server->adapter_hash);
+ g_free(server->sdp_record);
+ g_free(server);
+
+ bluetooth_unref();
+}
+
OFONO_PLUGIN_DEFINE(bluetooth, "Bluetooth Utils Plugins", VERSION,
OFONO_PLUGIN_PRIORITY_DEFAULT, NULL, NULL)
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index 42b0d13..505d908 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -23,6 +23,7 @@
#define BLUEZ_MANAGER_INTERFACE BLUEZ_SERVICE ".Manager"
#define BLUEZ_ADAPTER_INTERFACE BLUEZ_SERVICE ".Adapter"
#define BLUEZ_DEVICE_INTERFACE BLUEZ_SERVICE ".Device"
+#define BLUEZ_SERVICE_INTERFACE BLUEZ_SERVICE ".Service"
#define DBUS_TIMEOUT 15
@@ -39,10 +40,18 @@ struct bluetooth_profile {
void (*set_alias)(const char *device, const char *);
};
+struct server;
+
+typedef void (*ConnectFunc)(GIOChannel *io, GError *err, gpointer user_data);
+
int bluetooth_register_uuid(const char *uuid,
struct bluetooth_profile *profile);
void bluetooth_unregister_uuid(const char *uuid);
+struct server *bluetooth_register_server(guint8 channel, const char *sdp_record,
+ ConnectFunc cb, gpointer user_data);
+void bluetooth_unregister_server(struct server *server);
+
void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
char *buf, int size);
--
1.7.4.rc3
11 years, 7 months
[PATCH v4 0/1] Refactor call status handling
by Jeevaka Badrappan
Hi,
Since XCALLSTAT reports the voice call status information and call id,
creation of the call is moved inside xcallstat_notify function.
Regards,
Jeevaka
Jeevaka Badrappan (1):
ifxmodem: move call creation to xcallstat_notify
drivers/ifxmodem/voicecall.c | 172 ++++++++++++++++++++++++------------------
1 files changed, 98 insertions(+), 74 deletions(-)
11 years, 7 months
[PATCH] sim: enable usage of SIM pass codes longer than 8 digits
by Jussi Kangas
---
Hi,
On Tue, 2011-02-08 at 06:17 +0200, Denis Kenzior wrote:
Why don't we keep things simple. Modify is_valid_pin to take a pin and
> a min and max number of digits.
>
> gboolean is_valid_pin_with_limits(const char *pin, int min, int max)
> (feel free to pick some better name)
>
> Then just add two functions:
>
> __ofono_valid_net_pin(const char *pin)
> __ofono_valid_sim_pin(const char *pin, enum ofono_sim_password_type type)
>
> Stick both in ofono.h / sim.c somewhere
>
Right. Here it is.
Br,
Jussi
src/call-barring.c | 12 ++++----
src/call-meter.c | 4 +-
src/common.c | 37 -------------------------
src/common.h | 9 ------
src/ofono.h | 5 +++
src/sim.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++----
6 files changed, 83 insertions(+), 60 deletions(-)
diff --git a/src/call-barring.c b/src/call-barring.c
index 649826e..384eb43 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -402,7 +402,7 @@ static gboolean cb_ss_control(int type, const char *sc,
if (strlen(dn) > 0)
goto bad_format;
- if (type != SS_CONTROL_TYPE_QUERY && !is_valid_pin(sia, PIN_TYPE_NET))
+ if (type != SS_CONTROL_TYPE_QUERY && !__ofono_is_valid_net_pin(sia))
goto bad_format;
switch (type) {
@@ -524,7 +524,7 @@ static gboolean cb_ss_passwd(const char *sc,
if (fac == NULL)
return FALSE;
- if (!is_valid_pin(old, PIN_TYPE_NET) || !is_valid_pin(new, PIN_TYPE_NET))
+ if (!__ofono_is_valid_net_pin(old) || !__ofono_is_valid_net_pin(new))
goto bad_format;
cb->pending = dbus_message_ref(msg);
@@ -862,7 +862,7 @@ static DBusMessage *cb_set_property(DBusConnection *conn, DBusMessage *msg,
return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &passwd);
- if (!is_valid_pin(passwd, PIN_TYPE_NET))
+ if (!__ofono_is_valid_net_pin(passwd))
return __ofono_error_invalid_format(msg);
}
@@ -909,7 +909,7 @@ static DBusMessage *cb_disable_all(DBusConnection *conn, DBusMessage *msg,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
- if (!is_valid_pin(passwd, PIN_TYPE_NET))
+ if (!__ofono_is_valid_net_pin(passwd))
return __ofono_error_invalid_format(msg);
cb_set_query_bounds(cb, fac, FALSE);
@@ -957,10 +957,10 @@ static DBusMessage *cb_set_passwd(DBusConnection *conn, DBusMessage *msg,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
- if (!is_valid_pin(old_passwd, PIN_TYPE_NET))
+ if (!__ofono_is_valid_net_pin(old_passwd))
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(new_passwd, PIN_TYPE_NET))
+ if (!__ofono_is_valid_net_pin(new_passwd))
return __ofono_error_invalid_format(msg);
cb->pending = dbus_message_ref(msg);
diff --git a/src/call-meter.c b/src/call-meter.c
index d483e2e..0789935 100644
--- a/src/call-meter.c
+++ b/src/call-meter.c
@@ -549,7 +549,7 @@ static DBusMessage *cm_set_property(DBusConnection *conn, DBusMessage *msg,
dbus_message_iter_get_basic(&iter, &passwd);
- if (!is_valid_pin(passwd, PIN_TYPE_PIN))
+ if (!__ofono_is_valid_sim_pin(passwd, OFONO_SIM_PASSWORD_SIM_PIN2))
return __ofono_error_invalid_format(msg);
for (property = cm_properties; property->name; property++) {
@@ -621,7 +621,7 @@ static DBusMessage *cm_acm_reset(DBusConnection *conn, DBusMessage *msg,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
- if (!is_valid_pin(pin2, PIN_TYPE_PIN))
+ if (!__ofono_is_valid_sim_pin(pin2, OFONO_SIM_PASSWORD_SIM_PIN2))
return __ofono_error_invalid_format(msg);
cm->pending = dbus_message_ref(msg);
diff --git a/src/common.c b/src/common.c
index f25f105..247fff0 100644
--- a/src/common.c
+++ b/src/common.c
@@ -649,43 +649,6 @@ const char *bearer_class_to_string(enum bearer_class cls)
return NULL;
}
-gboolean is_valid_pin(const char *pin, enum pin_type type)
-{
- unsigned int i;
-
- /* Pin must not be empty */
- if (pin == NULL || pin[0] == '\0')
- return FALSE;
-
- i = strlen(pin);
- if (i != strspn(pin, "0123456789"))
- return FALSE;
-
- switch (type) {
- case PIN_TYPE_PIN:
- /* 11.11 Section 9.3 ("CHV"): 4..8 IA-5 digits */
- if (4 <= i && i <= 8)
- return TRUE;
- break;
- case PIN_TYPE_PUK:
- /* 11.11 Section 9.3 ("UNBLOCK CHV"), 8 IA-5 digits */
- if (i == 8)
- return TRUE;
- break;
- case PIN_TYPE_NET:
- /* 22.004 Section 5.2, 4 IA-5 digits */
- if (i == 4)
- return TRUE;
- break;
- case PIN_TYPE_NONE:
- if (i < 8)
- return TRUE;
- break;
- }
-
- return FALSE;
-}
-
const char *registration_status_to_string(int status)
{
switch (status) {
diff --git a/src/common.h b/src/common.h
index 09f2deb..6dc7bff 100644
--- a/src/common.h
+++ b/src/common.h
@@ -122,13 +122,6 @@ enum ss_cssu {
SS_MT_CALL_DEFLECTED = 9,
};
-enum pin_type {
- PIN_TYPE_NONE,
- PIN_TYPE_PIN,
- PIN_TYPE_PUK,
- PIN_TYPE_NET,
-};
-
/* 27.007 Section 10.1.10 */
enum context_status {
CONTEXT_STATUS_DEACTIVATED = 0,
@@ -162,8 +155,6 @@ const char *ss_control_type_to_string(enum ss_control_type type);
const char *bearer_class_to_string(enum bearer_class cls);
-gboolean is_valid_pin(const char *pin, enum pin_type type);
-
const char *registration_status_to_string(int status);
const char *registration_tech_to_string(int tech);
const char *packet_bearer_to_string(int bearer);
diff --git a/src/ofono.h b/src/ofono.h
index 6ba0187..4f0b7c2 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -299,6 +299,11 @@ ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim,
int ust_service,
int sst_service);
+ofono_bool_t __ofono_is_valid_sim_pin(const char *pin,
+ enum ofono_sim_password_type type);
+
+ofono_bool_t __ofono_is_valid_net_pin(const char *pin);
+
#include <ofono/stk.h>
typedef void (*__ofono_sms_sim_download_cb_t)(ofono_bool_t ok,
diff --git a/src/sim.c b/src/sim.c
index 3350166..3462608 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -676,7 +676,7 @@ static DBusMessage *sim_lock_or_unlock(struct ofono_sim *sim, int lock,
type == OFONO_SIM_PASSWORD_SIM_PIN2)
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(pin, PIN_TYPE_PIN))
+ if (!__ofono_is_valid_sim_pin(pin, type))
return __ofono_error_invalid_format(msg);
sim->pending = dbus_message_ref(msg);
@@ -748,10 +748,10 @@ static DBusMessage *sim_change_pin(DBusConnection *conn, DBusMessage *msg,
if (password_is_pin(type) == FALSE)
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(old, PIN_TYPE_PIN))
+ if (!__ofono_is_valid_sim_pin(old, type))
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(new, PIN_TYPE_PIN))
+ if (!__ofono_is_valid_sim_pin(new, type))
return __ofono_error_invalid_format(msg);
if (!strcmp(new, old))
@@ -803,7 +803,7 @@ static DBusMessage *sim_enter_pin(DBusConnection *conn, DBusMessage *msg,
if (type == OFONO_SIM_PASSWORD_NONE || type != sim->pin_type)
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(pin, PIN_TYPE_PIN))
+ if (!__ofono_is_valid_sim_pin(pin, type))
return __ofono_error_invalid_format(msg);
sim->pending = dbus_message_ref(msg);
@@ -1013,10 +1013,12 @@ static DBusMessage *sim_reset_pin(DBusConnection *conn, DBusMessage *msg,
if (type == OFONO_SIM_PASSWORD_NONE || type != sim->pin_type)
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(puk, PIN_TYPE_PUK))
+ if (!__ofono_is_valid_sim_pin(puk, type))
return __ofono_error_invalid_format(msg);
- if (!is_valid_pin(pin, PIN_TYPE_PIN))
+ type = puk2pin(type);
+
+ if (!__ofono_is_valid_sim_pin(pin, type))
return __ofono_error_invalid_format(msg);
sim->pending = dbus_message_ref(msg);
@@ -2378,3 +2380,65 @@ void *ofono_sim_get_data(struct ofono_sim *sim)
{
return sim->driver_data;
}
+
+ofono_bool_t is_valid_pin(const char *pin, int min, int max)
+{
+ unsigned int i;
+
+ /* Pin must not be empty */
+ if (pin == NULL || pin[0] == '\0')
+ return FALSE;
+
+ i = strlen(pin);
+ if (i != strspn(pin, "0123456789"))
+ return FALSE;
+
+ if (min <= i && i <= max)
+ return TRUE;
+
+ return FALSE;
+}
+
+ofono_bool_t __ofono_is_valid_sim_pin(const char *pin,
+ enum ofono_sim_password_type type)
+{
+ switch (type) {
+ case OFONO_SIM_PASSWORD_SIM_PIN:
+ case OFONO_SIM_PASSWORD_SIM_PIN2:
+ /* 11.11 Section 9.3 ("CHV"): 4..8 IA-5 digits */
+ return is_valid_pin(pin, 4, 8);
+ break;
+ case OFONO_SIM_PASSWORD_PHSIM_PIN:
+ case OFONO_SIM_PASSWORD_PHFSIM_PIN:
+ case OFONO_SIM_PASSWORD_PHNET_PIN:
+ case OFONO_SIM_PASSWORD_PHNETSUB_PIN:
+ case OFONO_SIM_PASSWORD_PHSP_PIN:
+ case OFONO_SIM_PASSWORD_PHCORP_PIN:
+ /* 22.022 Section 14 4..16 IA-5 digits */
+ return is_valid_pin(pin, 4, 16);
+ break;
+ case OFONO_SIM_PASSWORD_SIM_PUK:
+ case OFONO_SIM_PASSWORD_SIM_PUK2:
+ case OFONO_SIM_PASSWORD_PHFSIM_PUK:
+ case OFONO_SIM_PASSWORD_PHNET_PUK:
+ case OFONO_SIM_PASSWORD_PHNETSUB_PUK:
+ case OFONO_SIM_PASSWORD_PHSP_PUK:
+ case OFONO_SIM_PASSWORD_PHCORP_PUK:
+ /* 11.11 Section 9.3 ("UNBLOCK CHV"), 8 IA-5 digits */
+ return is_valid_pin(pin, 8, 8);
+ break;
+ case OFONO_SIM_PASSWORD_NONE:
+ return is_valid_pin(pin, 0, 8);
+ break;
+ case OFONO_SIM_PASSWORD_INVALID:
+ break;
+ }
+
+ return FALSE;
+}
+
+ofono_bool_t __ofono_is_valid_net_pin(const char *pin)
+{
+ return is_valid_pin(pin, 4, 4);
+}
+
--
1.7.1
11 years, 7 months
[PATCH 0/4 v4] Network Time Plugin
by Antti Paila
This series of patches introduces the network time part of
the NITZ feature as outlined in 3GPP spec 22.042.
The plugin is for delivering network indicated time information
to timed process which is responsible for maintaining the system
time. The delivery is achieved by timed implementing an interface
with a method that is called by the nettime plugin with time related
info as a parameter of the method.
Antti Paila (4):
nettime: Network time plugin implementation
nettime: Makefile.am modification
nettime: Documentation
nettime: Mock Timed for testing
Makefile.am | 9 +-
doc/network-time-api.txt | 36 +++++
plugins/nettime.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++
test/test-nettime | 35 +++++
4 files changed, 404 insertions(+), 2 deletions(-)
create mode 100644 doc/network-time-api.txt
create mode 100644 plugins/nettime.c
create mode 100755 test/test-nettime
11 years, 7 months
[PATCH 0/13] IPv6 support (take 2)
by Mika Liljeberg
Hi All,
Here's another go at IPv6 with latest comments hopefully
addressed.
Regards,
MikaL
[PATCH 01/13] gprs: factor out common code
[PATCH 02/13] gprs: Update documentation for IPv6
[PATCH 03/13] gprs: driver interface changes for IPv6
[PATCH 04/13] gprs: core support for IPv6
[PATCH 05/13] test: modify test scripts for IPv6
[PATCH 06/13] isimodem: IPv6 support
[PATCH 07/13] atmodem: update to new gprs context interface
[PATCH 08/13] huaweimodem: update to new gprs context interface
[PATCH 09/13] mbmmodem: update to new gprs context interface
[PATCH 10/13] hsomodem: update to new gprs context interface
[PATCH 11/13] ifxmodem: update to new gprs context interface
[PATCH 12/13] stemodem: update to new gprs context interface
[PATCH 13/13] phonesim: add IPv6 support
Makefile.am | 3 +-
doc/connman-api.txt | 9 +-
drivers/atmodem/gprs-context.c | 41 ++--
drivers/hsomodem/gprs-context.c | 48 +++--
drivers/huaweimodem/gprs-context.c | 43 +++--
drivers/ifxmodem/gprs-context.c | 36 ++--
drivers/isimodem/gprs-context.c | 119 +++++++-----
drivers/mbmmodem/gprs-context.c | 65 ++++---
drivers/stemodem/gprs-context.c | 31 ++-
include/gprs-context.h | 27 ++-
plugins/phonesim.c | 32 +++-
src/gprs.c | 390 ++++++++++++++++++++++++------------
test/list-contexts | 6 +-
test/set-context-property | 38 ++++
14 files changed, 583 insertions(+), 305 deletions(-)
11 years, 7 months
[PATCH v2 0/3] ISI modem version detection with plugin
by Jessica Nilsson
The same patch as before, but split up in three parts as per your suggestion.
As before, please note that this does not build unless the gisi patch
"gisi: Updated subscriptions and pipe handling to accomodate additional
isimodem versions" is added first. We are currently looking at your comments on
that one and will send in an update as soon as we can.
Best Regards,
Jessica Nilsson
u8500: add plugin for u8500
udev: u8500 support and style fix
isimodem: header updates for ISI2.5
Makefile.am | 4 +
drivers/isimodem/debug.c | 132 ++++++++++++
drivers/isimodem/debug.h | 9 +
drivers/isimodem/mtc.h | 38 ++++
drivers/isimodem/version.h | 26 +++
plugins/ofono.rules | 3 +
plugins/u8500.c | 507 ++++++++++++++++++++++++++++++++++++++++++++
plugins/udev.c | 5 +-
8 files changed, 723 insertions(+), 1 deletions(-)
create mode 100644 drivers/isimodem/version.h
create mode 100644 plugins/u8500.c
--
1.7.3.5
11 years, 7 months
[RFC 0/1] use fsync in storage
by Kai Vehmanen
Hi,
this is potentially a bit controversial, so sending as RFC.
Storage write_file() is used for SMS spooling (both in core for fragments and
in e.g. Marcel's history plugin patches). As we want to be sure we don't ack
SMS'es to network until we have succesfully stored them on device, I think we
need to use fsync() when storing the data. I know this is strictly not needed in
all systems (e.g. with ext3), and can be expensive on some systems (again
ext3), but I still think this is the right thing to do (especially with btrfs,
ext4, xfs, et al now commonly used).
I know there's been a lot of discussion around fsync() usage (especially
related to pre-2.6.30 ext4), but I think this specific case of SMS
delivery is one where fsync definitely makes sense (similar to MTA usage).
I'm also aware this is not bullet proof (e.g. there are still hardware
caches not covered by fsync at all), but this is just one easy step
to increase system reliability and predictability.
A few questions:
1) Do we agree that fsync should be used?
2) Should storage provide also the old variant of write_file (e.g.
transactionally safe, but not syncing). I see at least simfs
is using write_file a lot as well. With this patch I just modified
write_file semantics for simplicity, but I could add a variant
as well.
3) Is it ok, build-wise, for ofono to require availability fdatasync()
(which I think would be sufficient in this case and slightly
less expensive).
Kai Vehmanen (1):
storage: make write_file synchronous with fsync
src/storage.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
11 years, 7 months
[PATCH v3 0/4] Add handling of XCOLP and refactor call status handling
by Jeevaka Badrappan
Hi,
Incase of ifxmodem, COLP is not an intermediate status for ATD. Vendor
specific AT command XCOLP is used for the connected line presentation.
Since XCALLSTAT reports the voice call status information and call id,
creation of the call is moved inside xcallstat_notify function. This also
fixes the issue with gatchat usage.
Regards,
Jeevaka
Jeevaka Badrappan (4):
ifxmodem: fix issue with gatchat usage
ifxmodem: add handling of XCOLP notification
ifxmodem: remove colp handling done inside atd_cb
ifxmodem: move call creation to xcallstat_notify
drivers/ifxmodem/voicecall.c | 253 +++++++++++++++++++++++++-----------------
1 files changed, 153 insertions(+), 100 deletions(-)
11 years, 7 months
[RFC] voice call API changes (proposal)
by Andras Domokos
Here is a proposal for expanding the VoiceCallManager interface with
call related Supplementary Services signals, and the VoiceCall
interface with new properties.
---
doc/call-barring-api.txt | 10 ----------
doc/voicecall-api.txt | 15 +++++++++++++++
doc/voicecallmanager-api.txt | 21 +++++++++++++++++++++
3 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/doc/call-barring-api.txt b/doc/call-barring-api.txt
index 41ae4b1..1534494 100644
--- a/doc/call-barring-api.txt
+++ b/doc/call-barring-api.txt
@@ -37,16 +37,6 @@ Signals PropertyChanged(string property, variant value)
Signal is emitted whenever a property has changed.
The new value is passed as the signal argument.
- IncomingBarringInEffect()
-
- Signal is emitted when a call is made and an
- incoming call barring supplementary service is in use.
-
- OutgoingBarringInEffect()
-
- Signal is emitted when a call is made and an
- outgoing call barring supplementary service is in use.
-
Properties string VoiceIncoming [readwrite]
Contains the value of the barrings for the incoming
diff --git a/doc/voicecall-api.txt b/doc/voicecall-api.txt
index 047b8cb..e7276a3 100644
--- a/doc/voicecall-api.txt
+++ b/doc/voicecall-api.txt
@@ -145,3 +145,18 @@ Properties string LineIdentification [readonly]
Contains the indication if the voice call is an
emergency call or not.
+
+ boolean Forwarded
+
+ Contains the indication whether the voice call is a
+ forwarded call or not.
+
+ boolean RemoteHold
+
+ Contains the indication whether the voice call has been
+ put on hold by the remote party or not.
+
+ boolean Waiting
+
+ Contains the indication whether the outgoing voice call
+ is waiting or not.
diff --git a/doc/voicecallmanager-api.txt b/doc/voicecallmanager-api.txt
index 2bf9ded..bbd80db 100644
--- a/doc/voicecallmanager-api.txt
+++ b/doc/voicecallmanager-api.txt
@@ -144,6 +144,27 @@ Signals CallAdded(object path, dict properties)
Signal is emitted whenever a property has changed.
The new value is passed as the signal argument.
+ UnconditionalForwardingInEffect
+
+ Signal is emitted when a call is made and unconditional
+ call forwarding supplementary service is active.
+
+ ConditionalForwardingInEffect
+
+ Signal is emitted when a call is made and some of the
+ conditional call forwarding supplementary services are
+ active.
+
+ IncomingBarringInEffect()
+
+ Signal is emitted when a call is made and an
+ incoming call barring supplementary service is in use.
+
+ OutgoingBarringInEffect()
+
+ Signal is emitted when a call is made and an
+ outgoing call barring supplementary service is in use.
+
Properties array{string} EmergencyNumbers [readonly]
Contains the list of emergency numbers recognized
--
1.7.0.4
11 years, 7 months
[PATCH 0/12] IPv6 support
by Mika Liljeberg
Hi All,
Here a set of patches with IPv6 support for oFono. Based on
feedback to the RFC patches, I've taken out the emulated ipv4v6
context support for modems conforming to 3GPP rel7 or older.
This simplifies the patches quite a bit and hopefully makes
them more accetable at this stage. As a result, only a single
network interface and a single set of interface configuration
parameters is exposed via each oFono gprs context.
It should be noted that the operator requirements I have seen so
far state that IPv6 capable UEs should fall back to parallel
IPv4 and IPv6 contexts if either the network or the UE does
not support the rel8 IPv4v6 combined context.
This has implications to any IPv6 capable product using a rel7
(or older) modem. Either connman will have to support parallel
IPv4 and IPv6 connections, or the specific oFono modem driver
will have to fake it by providing an emulated ipv4v6 context
underneath oFono.
Whether oFono will be used in any IPv6 capable products with
a rel7 modem is a topic for other forums. People should be aware
of the limitation, though.
Br,
MikaL
[PATCH 01/12] gprs: Update documentation for IPv6
[PATCH 02/12] gprs: driver interface changes for IPv6
[PATCH 03/12] gprs: core support for IPv6
[PATCH 04/12] test: modify test scripts for IPv6
[PATCH 05/12] isimodem: IPv6 support
[PATCH 06/12] atmodem: update to new gprs context interface
[PATCH 07/12] huaweimodem: update to new gprs context interface
[PATCH 08/12] mbmmodem: update to new gprs context interface
[PATCH 09/12] hsomodem: update to new gprs context interface
[PATCH 10/12] ifxmodem: update to new gprs context interface
[PATCH 11/12] stemodem: update to new gprs context interface
[PATCH 12/12] phonesim: add IPv6 support
Makefile.am | 3 +-
doc/connman-api.txt | 9 +-
drivers/atmodem/gprs-context.c | 41 +++---
drivers/hsomodem/gprs-context.c | 48 ++++---
drivers/huaweimodem/gprs-context.c | 43 +++---
drivers/ifxmodem/gprs-context.c | 36 +++--
drivers/isimodem/gprs-context.c | 119 +++++++++------
drivers/mbmmodem/gprs-context.c | 65 +++++---
drivers/stemodem/gprs-context.c | 31 +++--
include/gprs-context.h | 23 +++-
plugins/phonesim.c | 32 +++-
src/gprs.c | 296 +++++++++++++++++++++++-------------
test/list-contexts | 6 +-
test/set-context-property | 38 +++++
14 files changed, 514 insertions(+), 276 deletions(-)
11 years, 7 months