[-]
[+]
|
Changed |
_service:tar_git:ofono.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:ofono.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://git.merproject.org/slava/ofono.git</param>
<param name="branch">master</param>
- <param name="revision">88013ff6</param>
+ <param name="revision">1025a6c</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/Makefile.am
^
|
@@ -128,6 +128,7 @@
drivers/ril/ril_cbs.c \
drivers/ril/ril_data.c \
drivers/ril/ril_devinfo.c \
+ drivers/ril/ril_ecclist.c \
drivers/ril/ril_gprs.c \
drivers/ril/ril_gprs_context.c \
drivers/ril/ril_mce.c \
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_ecclist.c
^
|
@@ -0,0 +1,258 @@
+/*
+ * oFono - Open Source Telephony - RIL-based devices
+ *
+ * Copyright (C) 2016 Jolla Ltd.
+ *
+ * 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.
+ */
+
+#include "ril_ecclist.h"
+#include "ril_log.h"
+
+#include <gutil_strv.h>
+#include <gutil_inotify.h>
+
+#include <sys/inotify.h>
+
+typedef GObjectClass RilEccListClass;
+typedef struct ril_ecclist RilEccList;
+
+struct ril_ecclist_priv {
+ struct ofono_sim *sim;
+ GUtilInotifyWatchCallback *dir_watch;
+ GUtilInotifyWatchCallback *file_watch;
+ char *dir;
+ char *path;
+ char *name;
+};
+
+enum ril_ecclist_signal {
+ SIGNAL_LIST_CHANGED,
+ SIGNAL_COUNT
+};
+
+#define SIGNAL_LIST_CHANGED_NAME "ril-sim-settings-imsi-changed"
+
+static guint ril_ecclist_signals[SIGNAL_COUNT] = { 0 };
+
+G_DEFINE_TYPE(RilEccList, ril_ecclist, G_TYPE_OBJECT)
+#define RIL_ECCLIST_TYPE (ril_ecclist_get_type())
+#define RIL_ECCLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
+ RIL_ECCLIST_TYPE, RilEccList))
+
+static char **ril_ecclist_read(struct ril_ecclist *self)
+{
+ struct ril_ecclist_priv *priv = self->priv;
+ char **list = NULL;
+
+ if (g_file_test(priv->path, G_FILE_TEST_EXISTS)) {
+ gsize len = 0;
+ gchar *content = NULL;
+ GError *error = NULL;
+
+ if (g_file_get_contents(priv->path, &content, &len, &error)) {
+ char **ptr;
+
+ DBG("%s = %s", priv->name, content);
+ list = g_strsplit(content, ",", 0);
+ for (ptr = list; *ptr; ptr++) {
+ *ptr = g_strstrip(*ptr);
+ }
+
+ gutil_strv_sort(list, TRUE);
+ } else if (error) {
+ DBG("%s: %s", priv->path, GERRMSG(error));
+ g_error_free(error);
+ }
+
+ g_free (content);
+ } else {
+ DBG("%s doesn't exist", priv->path);
+ }
+
+ return list;
+}
+
+static void ril_ecclist_update(struct ril_ecclist *self)
+{
+ struct ril_ecclist_priv *priv = self->priv;
+ char **list = ril_ecclist_read(self);
+
+ if (!gutil_strv_equal(self->list, list)) {
+ DBG("%s changed", priv->name);
+ g_strfreev(self->list);
+ self->list = list;
+ g_signal_emit(self, ril_ecclist_signals[SIGNAL_LIST_CHANGED], 0);
+ } else {
+ g_strfreev(list);
+ }
+}
+
+static void ril_ecclist_changed(GUtilInotifyWatch *watch, guint mask,
+ guint cookie, const char *name, void *user_data)
+{
+ struct ril_ecclist *self = RIL_ECCLIST(user_data);
+ struct ril_ecclist_priv *priv = self->priv;
+
+ ril_ecclist_update(self);
+
+ if (mask & IN_IGNORED) {
+ DBG("file %s is gone", priv->path);
+ gutil_inotify_watch_callback_free(priv->file_watch);
+ priv->file_watch = NULL;
+ }
+}
+
+static void ril_ecclist_dir_changed(GUtilInotifyWatch *watch, guint mask,
+ guint cookie, const char *name, void *user_data)
+{
+ struct ril_ecclist *self = RIL_ECCLIST(user_data);
+ struct ril_ecclist_priv *priv = self->priv;
+
+ DBG("0x%04x %s", mask, name);
+ if (!priv->file_watch && !g_strcmp0(name, priv->name)) {
+ priv->file_watch = gutil_inotify_watch_callback_new(priv->path,
+ IN_MODIFY | IN_CLOSE_WRITE,
+ ril_ecclist_changed, self);
+ if (priv->file_watch) {
+ DBG("watching %s", priv->path);
+ ril_ecclist_update(self);
+ }
+ }
+
+ if (mask & IN_IGNORED) {
+ DBG("%s is gone", priv->dir);
+ gutil_inotify_watch_callback_free(priv->dir_watch);
+ priv->dir_watch = NULL;
+ }
+}
+
+gulong ril_ecclist_add_list_changed_handler(struct ril_ecclist *self,
+ ril_ecclist_cb_t cb, void *arg)
+{
+ return (G_LIKELY(self) && G_LIKELY(cb)) ? g_signal_connect(self,
+ SIGNAL_LIST_CHANGED_NAME, G_CALLBACK(cb), arg) : 0;
+}
+
+void ril_ecclist_remove_handler(struct ril_ecclist *self, gulong id)
+{
+ if (G_LIKELY(self) && G_LIKELY(id)) {
+ g_signal_handler_disconnect(self, id);
+ }
+}
+
+struct ril_ecclist *ril_ecclist_new(const char *path)
+{
+ if (path) {
+ struct ril_ecclist *self = g_object_new(RIL_ECCLIST_TYPE, 0);
+ struct ril_ecclist_priv *priv = self->priv;
+
+ DBG("%s", path);
+ priv->path = g_strdup(path);
+ priv->name = g_path_get_basename(path);
+ priv->dir = g_path_get_dirname(path);
+ priv->dir_watch = gutil_inotify_watch_callback_new(priv->dir,
+ IN_MODIFY|IN_MOVED_FROM|IN_MOVED_TO|IN_DELETE|
+ IN_CREATE|IN_DELETE_SELF|IN_CLOSE_WRITE,
+ ril_ecclist_dir_changed, self);
+ if (priv->dir_watch) {
+ DBG("watching %s", priv->dir);
+ }
+
+ self->list = ril_ecclist_read(self);
+ priv->file_watch = gutil_inotify_watch_callback_new(priv->path,
+ IN_MODIFY | IN_CLOSE_WRITE,
+ ril_ecclist_changed, self);
+ if (priv->file_watch) {
+ DBG("watching %s", priv->path);
+ }
+
+ return self;
+ }
+
+ return NULL;
+}
+
+struct ril_ecclist *ril_ecclist_ref(struct ril_ecclist *self)
+{
+ if (G_LIKELY(self)) {
+ g_object_ref(RIL_ECCLIST(self));
+ return self;
+ } else {
+ return NULL;
+ }
+}
+
+void ril_ecclist_unref(struct ril_ecclist *self)
+{
+ if (G_LIKELY(self)) {
+ g_object_unref(RIL_ECCLIST(self));
+ }
+}
+
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_ecclist.h
^
|
@@ -0,0 +1,46 @@
+/*
+ * oFono - Open Source Telephony - RIL-based devices
+ *
+ * Copyright (C) 2016 Jolla Ltd.
+ *
+ * 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.
+ */
+
+#ifndef RIL_ECCLIST_H
+#define RIL_ECCLIST_H
+
+#include "ril_types.h"
+
+struct ril_ecclist_priv;
+
+struct ril_ecclist {
+ GObject object;
+ struct ril_ecclist_priv *priv;
+ char **list;
+};
+
+typedef void (*ril_ecclist_cb_t)(struct ril_ecclist *ecc, void *arg);
+
+struct ril_ecclist *ril_ecclist_new(const char *path);
+struct ril_ecclist *ril_ecclist_ref(struct ril_ecclist *ecc);
+void ril_ecclist_unref(struct ril_ecclist *ecc);
+gulong ril_ecclist_add_list_changed_handler(struct ril_ecclist *ecc,
+ ril_ecclist_cb_t cb, void *arg);
+void ril_ecclist_remove_handler(struct ril_ecclist *ecc, gulong id);
+
+#endif /* RIL_ECCLIST_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 8
+ * indent-tabs-mode: t
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_modem.c
^
|
@@ -52,6 +52,7 @@
GRilIoQueue *q;
struct ofono_radio_settings *radio_settings;
char *imei;
+ char *ecclist_file;
gboolean pre_sim_done;
gboolean devinfo_created;
gboolean allow_data;
@@ -424,6 +425,7 @@
grilio_channel_unref(modem->io);
grilio_queue_cancel_all(md->q, FALSE);
grilio_queue_unref(md->q);
+ g_free(md->ecclist_file);
g_free(md->imei);
g_free(md);
}
@@ -445,6 +447,8 @@
modem->config = *slot->config;
modem->imei = md->imei = g_strdup(slot->imei);
modem->log_prefix = log_prefix;
+ modem->ecclist_file =
+ md->ecclist_file = g_strdup(slot->ecclist_file);
modem->ofono = ofono;
modem->radio = ril_radio_ref(radio);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_plugin.c
^
|
@@ -62,6 +62,7 @@
#define RILCONF_TIMEOUT "timeout"
#define RILCONF_4G "enable4G"
#define RILCONF_UICC_WORKAROUND "uiccWorkaround"
+#define RILCONF_ECCLIST_FILE "ecclistFile"
#define RIL_STORE "ril"
#define RIL_STORE_GROUP "Settings"
@@ -100,6 +101,7 @@
char *name;
char *sockpath;
char *sub;
+ char *ecclist_file;
gint timeout; /* RIL timeout, in milliseconds */
int index;
int sim_flags;
@@ -1080,6 +1082,16 @@
DBG("%s: UICC workaround %s", group, (slot->sim_flags &
RIL_SIM_CARD_V9_UICC_SUBSCRIPTION_WORKAROUND) ?
"on" : "off");
+
+ slot->ecclist_file = g_key_file_get_string(file, group,
+ RILCONF_ECCLIST_FILE, NULL);
+ if (slot->ecclist_file && slot->ecclist_file[0]) {
+ DBG("%s: ecclist file %s", group, slot->ecclist_file);
+ slot->pub.ecclist_file = slot->ecclist_file;
+ } else {
+ g_free(slot->ecclist_file);
+ slot->ecclist_file = NULL;
+ }
} else {
DBG("no socket path in %s", group);
}
@@ -1097,6 +1109,7 @@
g_free(slot->name);
g_free(slot->sockpath);
g_free(slot->sub);
+ g_free(slot->ecclist_file);
g_free(slot);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_plugin.h
^
|
@@ -48,6 +48,7 @@
struct ril_slot_info {
const char *path;
const char *imei;
+ const char *ecclist_file;
gboolean enabled;
gboolean sim_present;
const struct ril_slot_config *config;
@@ -68,6 +69,7 @@
GRilIoChannel *io;
const char *imei;
const char *log_prefix;
+ const char *ecclist_file;
struct ofono_modem *ofono;
struct ril_radio *radio;
struct ril_data *data;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_subscription.conf
^
|
@@ -69,3 +69,17 @@
# Default is true (select SET_UICC_SUBSCRIPTION based on the RIL version)
#
#uiccWorkaround=true
+
+# Points to the file containing comma-separated ECC (Emergency List Codes)
+# list, e.g. 911,112,*911,#911. The file is tracked by ofono and when its
+# contents changes, it's reflected in the EmergencyNumbers property of
+# org.ofono.VoiceCallManager.
+#
+# If necessary, the contents of the file can be synchronized with the
+# Android system property by adding something like this to /init.rc:
+#
+# on property:ril.ecclist=*
+# write /var/lib/ofono/ril.ecclist ${ril.ecclist}
+# chmod 0644 /var/lib/ofono/ril.ecclist
+#
+#ecclistFile=/var/lib/ofono/ril.ecclist
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git17.tar.bz2/ofono/drivers/ril/ril_voicecall.c
^
|
@@ -15,6 +15,7 @@
#include "ril_plugin.h"
#include "ril_constants.h"
+#include "ril_ecclist.h"
#include "ril_util.h"
#include "ril_log.h"
@@ -36,6 +37,7 @@
GRilIoChannel *io;
GRilIoQueue *q;
struct ofono_voicecall *vc;
+ struct ril_ecclist *ecclist;
unsigned int local_release;
unsigned char flags;
ofono_voicecall_cb_t cb;
@@ -47,6 +49,7 @@
gulong event_id[VOICECALL_EVENT_COUNT];
gulong supp_svc_notification_id;
gulong ringback_tone_event_id;
+ gulong ecclist_change_id;
};
struct release_id_req {
@@ -760,6 +763,13 @@
ofono_voicecall_ringback_tone_notify(vd->vc, playTone);
}
+static void ril_voicecall_ecclist_changed(struct ril_ecclist *list, void *data)
+{
+ struct ril_voicecall *vd = data;
+
+ ofono_voicecall_en_list_notify(vd->vc, vd->ecclist->list);
+}
+
static gboolean ril_delayed_register(gpointer user_data)
{
struct ril_voicecall *vd = user_data;
@@ -768,6 +778,14 @@
vd->timer_id = 0;
ofono_voicecall_register(vd->vc);
+ /* Emergency Call Codes */
+ if (vd->ecclist) {
+ ofono_voicecall_en_list_notify(vd->vc, vd->ecclist->list);
+ vd->ecclist_change_id =
+ ril_ecclist_add_list_changed_handler(vd->ecclist,
+ ril_voicecall_ecclist_changed, vd);
+ }
+
/* Initialize call list */
ril_voicecall_clcc_poll(vd);
@@ -808,6 +826,9 @@
vd->q = grilio_queue_new(vd->io);
vd->vc = vc;
vd->timer_id = g_idle_add(ril_delayed_register, vd);
+ if (modem->ecclist_file) {
+ vd->ecclist = ril_ecclist_new(modem->ecclist_file);
+ }
ril_voicecall_clear_dtmf_queue(vd);
ofono_voicecall_set_data(vc, vd);
return 0;
@@ -831,6 +852,9 @@
g_source_remove(vd->timer_id);
}
+ ril_ecclist_remove_handler(vd->ecclist, vd->ecclist_change_id);
+ ril_ecclist_unref(vd->ecclist);
+
grilio_channel_unref(vd->io);
grilio_queue_cancel_all(vd->q, FALSE);
grilio_queue_unref(vd->q);
|