[-]
[+]
|
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">296534c</param>
+ <param name="revision">137e504</param>
</service>
</services>
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.17+git20.tar.bz2/ofono/include/oemraw.h
^
|
@@ -1,77 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2013 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.
- *
- * 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_OEM_RAW_H
-#define __OFONO_OEM_RAW_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <dbus/dbus.h>
-#include <ofono/types.h>
-
-struct ofono_oem_raw;
-
-/* Request response from driver to core */
-struct ofono_oem_raw_results {
- char *data;
- int length;
-};
-
-/* Request details from core to driver */
-struct ofono_oem_raw_request {
- char *data;
- int length; /* Number of bytes in data */
- DBusMessage *pending;
-};
-
-typedef void (*ofono_oem_raw_query_cb_t)(const struct ofono_error *error,
- const struct ofono_oem_raw_results *results, void *data);
-
-struct ofono_oem_raw_driver {
- const char *name;
- int (*probe)(struct ofono_oem_raw *raw,
- unsigned int vendor,
- void *data);
- void (*remove)(struct ofono_oem_raw *raw);
- void (*request)(struct ofono_oem_raw *raw,
- const struct ofono_oem_raw_request *request,
- ofono_oem_raw_query_cb_t cb,
- void *data);
-};
-
-struct ofono_oem_raw *ofono_oem_raw_create(struct ofono_modem *modem,
- unsigned int vendor,
- const char *driver,
- void *data);
-void ofono_oem_raw_dbus_register(struct ofono_oem_raw *raw);
-void ofono_oem_raw_remove(struct ofono_oem_raw *raw);
-int ofono_oem_raw_driver_register(struct ofono_oem_raw_driver *driver);
-void ofono_oem_raw_driver_unregister(struct ofono_oem_raw_driver *driver);
-void *ofono_oem_raw_get_data(struct ofono_oem_raw *raw);
-void ofono_oem_raw_set_data(struct ofono_oem_raw *raw, void *cid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __OFONO_OEM_RAW_H */
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.17+git20.tar.bz2/ofono/src/oemraw.c
^
|
@@ -1,265 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2013 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define _GNU_SOURCE
-
-#include <errno.h>
-#include <glib.h>
-#include <gdbus.h>
-#include <dbus/dbus.h>
-#include "ofono.h"
-#include "common.h"
-#include "ofono/oemraw.h"
-
-static GSList *g_drivers;
-
-struct ofono_oem_raw {
- struct ofono_atom *atom;
- const struct ofono_oem_raw_driver *driver;
- void *driver_data;
-};
-
-static void ofono_oem_raw_query_cb(const struct ofono_error *error,
- const struct ofono_oem_raw_results *res, void *data)
-{
- char *ptr;
- char byte;
- int i;
- DBusMessage *reply;
- DBusMessageIter iter;
- DBusMessageIter subiter;
- struct ofono_oem_raw_request *req = data;
-
- if (error && error->type == OFONO_ERROR_TYPE_NO_ERROR) {
- reply = dbus_message_new_method_return(req->pending);
- } else {
- /*
- * Log error messages in driver when completing a request,
- * logging here provides no extra information.
- */
- goto error;
- }
-
- dbus_message_iter_init_append(reply, &iter);
-
- if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- "y", &subiter)) {
- DBG("Failed to open a dbus iterator");
- goto error;
- }
-
- ptr = (char *)res->data;
-
- for (i = 0; i < res->length; i++) {
- byte = ptr[i];
- dbus_message_iter_append_basic(&subiter, DBUS_TYPE_BYTE,
- &byte);
- }
-
- dbus_message_iter_close_container(&iter, &subiter);
-
- goto end;
-
-error:
- reply = __ofono_error_failed(req->pending);
-
-end:
- __ofono_dbus_pending_reply(&req->pending, reply);
- g_free(req);
-
- return;
-}
-
-static DBusMessage *oem_raw_make_request(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- char *array; /* Byte array containing client request*/
- int array_len; /* Length of request byte array */
- DBusMessageIter iter;
- DBusMessageIter subiter;
- struct ofono_oem_raw_request *req;
- struct ofono_oem_raw *raw;
- raw = data;
- req = 0;
-
- if (raw && raw->driver->request == NULL)
- return __ofono_error_not_implemented(msg);
-
- dbus_message_iter_init(msg, &iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY)
- goto error_arg;
-
- if (dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE) {
- DBG("Ignoring request because dbus request element type=%c",
- dbus_message_iter_get_element_type(&iter));
- goto error_arg;
- }
-
- dbus_message_iter_recurse(&iter, &subiter);
-
- dbus_message_iter_get_fixed_array(&subiter, &array, &array_len);
-
- req = g_new0(struct ofono_oem_raw_request, 1);
- req->data = array;
- req->length = array_len;
- /* Store msg to request struct to allow multiple parallel requests */
- req->pending = dbus_message_ref(msg);
- raw->driver->request(raw, req, ofono_oem_raw_query_cb, req);
-
- return NULL;
-
-error_arg:
- DBG("DBus arg type=%c, msg signature: %s",
- dbus_message_iter_get_arg_type(&iter),
- dbus_message_get_signature(msg));
- return __ofono_error_invalid_args(msg);
-}
-
-static const GDBusMethodTable oem_raw_methods[] = {
- { GDBUS_ASYNC_METHOD("Send",
- GDBUS_ARGS({ "req", "ay" }),
- GDBUS_ARGS({ "response", "ay"}),
- oem_raw_make_request) },
- { }
-};
-
-static const GDBusSignalTable oem_raw_signals[] = {
- { }
-};
-
-static void oem_raw_dbus_unregister(struct ofono_atom *atom)
-{
- DBG("");
- struct ofono_oem_raw *oemraw = __ofono_atom_get_data(atom);
- const char *path = __ofono_atom_get_path(oemraw->atom);
- DBusConnection *conn = ofono_dbus_get_connection();
- struct ofono_modem *modem = __ofono_atom_get_modem(oemraw->atom);
-
- ofono_modem_remove_interface(modem, OFONO_OEM_RAW_INTERFACE);
-
- if (!g_dbus_unregister_interface(conn, path, OFONO_OEM_RAW_INTERFACE))
- ofono_error("Failed to unregister interface %s",
- OFONO_OEM_RAW_INTERFACE);
-}
-
-void ofono_oem_raw_dbus_register(struct ofono_oem_raw *oemraw)
-{
- DBusConnection *conn;
- DBG("");
- conn = ofono_dbus_get_connection();
- struct ofono_modem *modem = __ofono_atom_get_modem(oemraw->atom);
- const char *path = __ofono_atom_get_path(oemraw->atom);
-
- if (!g_dbus_register_interface(conn, path,
- OFONO_OEM_RAW_INTERFACE,
- oem_raw_methods,
- oem_raw_signals,
- NULL, oemraw, NULL)) {
- ofono_error("Could not create interface %s",
- OFONO_OEM_RAW_INTERFACE);
- return;
- }
-
- ofono_modem_add_interface(modem, OFONO_OEM_RAW_INTERFACE);
- __ofono_atom_register(oemraw->atom, oem_raw_dbus_unregister);
-}
-
-int ofono_oem_raw_driver_register(struct ofono_oem_raw_driver *driver)
-{
- if (driver->probe == NULL)
- return -EINVAL;
-
- g_drivers = g_slist_prepend(g_drivers, (void *) driver);
- return 0;
-}
-
-void ofono_oem_raw_driver_unregister(struct ofono_oem_raw_driver *driver)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/Makefile.am
^
|
@@ -22,7 +22,7 @@
include/private-network.h include/cdma-netreg.h \
include/cdma-provision.h include/handsfree.h \
include/handsfree-audio.h \
- include/sim-mnclength.h include/oemraw.h \
+ include/sim-mnclength.h \
include/siri.h
nodist_pkginclude_HEADERS = include/version.h
@@ -653,7 +653,7 @@
src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
src/cdma-provision.c src/handsfree.c \
src/handsfree-audio.c src/bluetooth.h \
- src/sim-mnclength.c src/oemraw.c src/voicecallagent.c \
+ src/sim-mnclength.c src/voicecallagent.c \
src/hfp.h src/siri.c
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_cell_info.c
^
|
@@ -15,6 +15,8 @@
#include "ril_cell_info.h"
#include "ril_sim_card.h"
+#include "ril_radio.h"
+#include "ril_util.h"
#include "ril_mce.h"
#include "ril_log.h"
@@ -31,8 +33,10 @@
struct ril_cell_info_priv {
GRilIoChannel *io;
struct ril_mce *mce;
+ struct ril_radio *radio;
struct ril_sim_card *sim_card;
gulong display_state_event_id;
+ gulong radio_state_event_id;
gulong sim_status_event_id;
gboolean sim_card_ready;
char *log_prefix;
@@ -365,16 +369,39 @@
}
}
+static void ril_cell_info_refresh(struct ril_cell_info *self)
+{
+ struct ril_cell_info_priv *priv = self->priv;
+
+ /* RIL_REQUEST_GET_CELL_INFO_LIST fails without SIM card */
+ if (priv->radio->state == RADIO_STATE_ON && priv->sim_card_ready) {
+ ril_cell_info_query(self);
+ } else {
+ ril_cell_info_update_cells(self, NULL);
+ }
+}
+
+static void ril_cell_info_radio_state_cb(struct ril_radio *radio, void *arg)
+{
+ struct ril_cell_info *self = RIL_CELL_INFO(arg);
+
+ DBG_(self, "%s", ril_radio_state_to_string(radio->state));
+ ril_cell_info_refresh(self);
+}
+
static void ril_cell_info_sim_status_cb(struct ril_sim_card *sim, void *arg)
{
struct ril_cell_info *self = RIL_CELL_INFO(arg);
struct ril_cell_info_priv *priv = self->priv;
const gboolean sim_card_was_ready = priv->sim_card_ready;
+ DBG_(self, "%sready", ril_sim_card_ready(sim) ? "" : "not ");
priv->sim_card_ready = ril_sim_card_ready(sim);
- if (priv->sim_card_ready && !sim_card_was_ready) {
- ril_cell_info_query(self);
- ril_cell_info_update_rate(self);
+ if (priv->sim_card_ready != sim_card_was_ready) {
+ ril_cell_info_refresh(self);
+ if (priv->sim_card_ready) {
+ ril_cell_info_update_rate(self);
+ }
}
}
@@ -393,14 +420,15 @@
}
struct ril_cell_info *ril_cell_info_new(GRilIoChannel *io,
- const char *log_prefix, struct ril_mce *mce,
- struct ril_sim_card *sim_card)
+ const char *log_prefix, struct ril_mce *mce,
+ struct ril_radio *radio, struct ril_sim_card *sim_card)
{
struct ril_cell_info *self = g_object_new(RIL_CELL_INFO_TYPE, 0);
struct ril_cell_info_priv *priv = self->priv;
priv->io = grilio_channel_ref(io);
priv->mce = ril_mce_ref(mce);
+ priv->radio = ril_radio_ref(radio);
priv->sim_card = ril_sim_card_ref(sim_card);
priv->log_prefix = (log_prefix && log_prefix[0]) ?
g_strconcat(log_prefix, " ", NULL) : g_strdup("");
@@ -410,6 +438,9 @@
priv->display_state_event_id =
ril_mce_add_display_state_changed_handler(mce,
ril_cell_info_display_state_cb, self);
+ priv->radio_state_event_id =
+ ril_radio_add_state_changed_handler(radio,
+ ril_cell_info_radio_state_cb, self);
priv->sim_status_event_id =
ril_sim_card_add_status_changed_handler(priv->sim_card,
ril_cell_info_sim_status_cb, self);
@@ -463,6 +494,7 @@
ril_mce_remove_handler(priv->mce, priv->display_state_event_id);
priv->display_state_event_id = 0;
}
+ ril_radio_remove_handlers(priv->radio, &priv->radio_state_event_id, 1);
ril_sim_card_remove_handlers(priv->sim_card,
&priv->sim_status_event_id, 1);
G_OBJECT_CLASS(ril_cell_info_parent_class)->dispose(object);
@@ -477,6 +509,7 @@
g_free(priv->log_prefix);
grilio_channel_unref(priv->io);
ril_mce_unref(priv->mce);
+ ril_radio_unref(priv->radio);
ril_sim_card_unref(priv->sim_card);
g_slist_free_full(self->cells, g_free);
G_OBJECT_CLASS(ril_cell_info_parent_class)->finalize(object);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_cell_info.h
^
|
@@ -42,8 +42,8 @@
const struct ril_cell *c2);
struct ril_cell_info *ril_cell_info_new(GRilIoChannel *io,
- const char *log_prefix, struct ril_mce *mce,
- struct ril_sim_card *sim_card);
+ const char *log_prefix, struct ril_mce *mce,
+ struct ril_radio *radio, struct ril_sim_card *sim_card);
struct ril_cell_info *ril_cell_info_ref(struct ril_cell_info *info);
void ril_cell_info_unref(struct ril_cell_info *info);
struct ril_cell *ril_cell_find_cell(struct ril_cell_info *info,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_cell_info_dbus.c
^
|
@@ -38,8 +38,8 @@
};
#define RIL_CELL_INFO_DBUS_INTERFACE "org.nemomobile.ofono.CellInfo"
-#define RIL_CELL_INFO_DBUS_CELL_ADDED_SIGNAL "CellAdded"
-#define RIL_CELL_INFO_DBUS_CELL_REMOVED_SIGNAL "CellRemoved"
+#define RIL_CELL_INFO_DBUS_CELLS_ADDED_SIGNAL "CellsAdded"
+#define RIL_CELL_INFO_DBUS_CELLS_REMOVED_SIGNAL "CellsRemoved"
#define RIL_CELL_DBUS_INTERFACE_VERSION (1)
#define RIL_CELL_DBUS_INTERFACE "org.nemomobile.ofono.Cell"
@@ -144,11 +144,6 @@
}
}
-static void ril_cell_info_destroy_entry_cb(gpointer data)
-{
- ril_cell_info_destroy_entry((struct ril_cell_entry *)data);
-}
-
static DBusMessage *ril_cell_info_dbus_reply(DBusMessage *msg,
const struct ril_cell_entry *entry,
ril_cell_info_dbus_append_fn append)
@@ -317,11 +312,24 @@
return NULL;
}
-static void ril_cell_info_dbus_emit(struct ril_cell_info_dbus *dbus,
- const char *signal, const char *path)
+static void ril_cell_info_dbus_emit_path_list(struct ril_cell_info_dbus *dbus,
+ const char *name, GPtrArray *list)
{
- g_dbus_emit_signal(dbus->conn, dbus->path, RIL_CELL_INFO_DBUS_INTERFACE,
- signal, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
+ guint i;
+ DBusMessageIter it, array;
+ DBusMessage *signal = dbus_message_new_signal(dbus->path,
+ RIL_CELL_INFO_DBUS_INTERFACE, name);
+
+ dbus_message_iter_init_append(signal, &it);
+ dbus_message_iter_open_container(&it, DBUS_TYPE_ARRAY, "o", &array);
+ for (i = 0; i < list->len; i++) {
+ const char* path = list->pdata[i];
+ dbus_message_iter_append_basic(&array, DBUS_TYPE_OBJECT_PATH,
+ &path);
+ }
+ dbus_message_iter_close_container(&it, &array);
+
+ g_dbus_send_message(dbus->conn, signal);
}
static int ril_cell_info_dbus_compare(const struct ril_cell *c1,
@@ -383,6 +391,8 @@
gboolean emit_signals)
{
GSList *l;
+ GPtrArray* added = NULL;
+ GPtrArray* removed = NULL;
/* Remove non-existent cells */
l = dbus->entries;
@@ -400,9 +410,14 @@
g_dbus_unregister_interface(dbus->conn, entry->path,
RIL_CELL_DBUS_INTERFACE);
if (emit_signals) {
- ril_cell_info_dbus_emit(dbus,
- RIL_CELL_INFO_DBUS_CELL_REMOVED_SIGNAL,
- entry->path);
+ if (!removed) {
+ removed =
+ g_ptr_array_new_with_free_func(
+ g_free);
+ }
+ /* Steal the path */
+ g_ptr_array_add(removed, entry->path);
+ entry->path = NULL;
}
ril_cell_info_destroy_entry(entry);
}
@@ -439,12 +454,25 @@
ril_cell_info_dbus_cell_signals, NULL,
entry, NULL);
if (emit_signals) {
- ril_cell_info_dbus_emit(dbus,
- RIL_CELL_INFO_DBUS_CELL_ADDED_SIGNAL,
- entry->path);
+ if (!added) {
+ added = g_ptr_array_new();
+ }
+ g_ptr_array_add(added, entry->path);
}
}
}
+
+ if (removed) {
+ ril_cell_info_dbus_emit_path_list(dbus,
+ RIL_CELL_INFO_DBUS_CELLS_REMOVED_SIGNAL, removed);
+ g_ptr_array_free(removed, TRUE);
+ }
+
+ if (added) {
+ ril_cell_info_dbus_emit_path_list(dbus,
+ RIL_CELL_INFO_DBUS_CELLS_ADDED_SIGNAL, added);
+ g_ptr_array_free(added, TRUE);
+ }
}
static void ril_cell_info_dbus_cells_changed_cb(struct ril_cell_info *info,
@@ -482,10 +510,10 @@
};
static const GDBusSignalTable ril_cell_info_dbus_signals[] = {
- { GDBUS_SIGNAL(RIL_CELL_INFO_DBUS_CELL_ADDED_SIGNAL,
- GDBUS_ARGS({ "path", "o" })) },
- { GDBUS_SIGNAL(RIL_CELL_INFO_DBUS_CELL_REMOVED_SIGNAL,
- GDBUS_ARGS({ "path", "o" })) },
+ { GDBUS_SIGNAL(RIL_CELL_INFO_DBUS_CELLS_ADDED_SIGNAL,
+ GDBUS_ARGS({ "paths", "ao" })) },
+ { GDBUS_SIGNAL(RIL_CELL_INFO_DBUS_CELLS_REMOVED_SIGNAL,
+ GDBUS_ARGS({ "paths", "ao" })) },
{ }
};
@@ -520,18 +548,30 @@
void ril_cell_info_dbus_free(struct ril_cell_info_dbus *dbus)
{
if (dbus) {
+ GSList *l;
+
DBG("%s", dbus->path);
g_dbus_unregister_interface(dbus->conn, dbus->path,
RIL_CELL_INFO_DBUS_INTERFACE);
ofono_modem_remove_interface(dbus->md->ofono,
RIL_CELL_INFO_DBUS_INTERFACE);
+
+ /* Unregister cells */
+ l = dbus->entries;
+ while (l) {
+ struct ril_cell_entry *entry = l->data;
+ g_dbus_unregister_interface(dbus->conn, entry->path,
+ RIL_CELL_DBUS_INTERFACE);
+ ril_cell_info_destroy_entry(entry);
+ l = l->next;
+ }
+ g_slist_free(dbus->entries);
+
dbus_connection_unref(dbus->conn);
ril_cell_info_remove_handler(dbus->info, dbus->handler_id);
ril_cell_info_unref(dbus->info);
- g_slist_free_full(dbus->entries,
- ril_cell_info_destroy_entry_cb);
g_free(dbus->path);
g_free(dbus);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_gprs_context.c
^
|
@@ -141,16 +141,28 @@
if (gcd->active_call) {
ril_gprs_context_free_active_call(gcd);
if (gcd->deactivate.req) {
- /* Complete the deactivate request */
- ofono_gprs_context_cb_t cb = gcd->deactivate.cb;
- gpointer data = gcd->deactivate.data;
+ struct ril_gprs_context_call deact = gcd->deactivate;
- ril_data_request_cancel(gcd->deactivate.req);
+ /*
+ * Complete the deactivate request. We need to
+ * clear gcd->deactivate first because cancelling
+ * the deactivation request will probably result
+ * in ril_gprs_context_deactivate_primary_cb() being
+ * invoked with GRILIO_CANCELLED status. And we don't
+ * want to fail the disconnect request because this
+ * is a success (we wanted to disconnect the data
+ * call and it's gone).
+ *
+ * Additionally, we need to make sure that we don't
+ * complete the same request twice - that would crash
+ * the core.
+ */
memset(&gcd->deactivate, 0, sizeof(gcd->deactivate));
- if (cb) {
+ ril_data_request_cancel(deact.req);
+ if (deact.cb) {
struct ofono_error error;
ofono_info("Deactivated data call");
- cb(ril_error_ok(&error), data);
+ deact.cb(ril_error_ok(&error), deact.data);
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_modem.c
^
|
@@ -300,7 +300,6 @@
ofono_netreg_create(modem, 0, RILMODEM_DRIVER, md);
ofono_ussd_create(modem, 0, RILMODEM_DRIVER, md);
ofono_call_settings_create(modem, 0, RILMODEM_DRIVER, md);
- ofono_oem_raw_create(modem, 0, RILMODEM_DRIVER, md);
}
static void ril_modem_set_online(struct ofono_modem *modem, ofono_bool_t online,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_oem_raw.c
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony - RIL-based devices
*
- * Copyright (C) 2015 Jolla Ltd.
+ * Copyright (C) 2015-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
@@ -16,118 +16,147 @@
#include "ril_plugin.h"
#include "ril_util.h"
#include "ril_log.h"
-#include "ril_constants.h"
+
+#include "gdbus.h"
+#include "ofono.h"
+
+#define RIL_OEM_RAW_INTERFACE "org.ofono.OemRaw"
+#define RIL_OEM_RAW_TIMEOUT (60*1000) /* 60 sec */
struct ril_oem_raw {
+ struct ril_modem *modem;
GRilIoQueue *q;
- guint timer_id;
-};
-
-struct ril_oem_raw_cbd {
- ofono_oem_raw_query_cb_t cb;
- gpointer data;
+ DBusConnection *conn;
+ char *path;
+ char *log_prefix;
};
-#define ril_oem_raw_cbd_free g_free
-
-static inline struct ril_oem_raw *ril_oem_raw_get_data(
- struct ofono_oem_raw *raw)
-{
- return ofono_oem_raw_get_data(raw);
-}
-
-static struct ril_oem_raw_cbd *ril_oem_raw_cbd_new(ofono_oem_raw_query_cb_t cb,
- void *data)
-{
- struct ril_oem_raw_cbd *cbd = g_new0(struct ril_oem_raw_cbd, 1);
-
- cbd->cb = cb;
- cbd->data = data;
- return cbd;
-}
+#define DBG_(oem,fmt,args...) DBG("%s" fmt, (oem)->log_prefix, ##args)
-static void ril_oem_raw_request_cb(GRilIoChannel *io, int status,
+static void ril_oem_raw_send_cb(GRilIoChannel *io, int ril_status,
const void *data, guint len, void *user_data)
{
- struct ofono_error error;
- struct ril_oem_raw_cbd *cbd = user_data;
+ DBusMessage *msg = user_data;
+ DBusMessage *reply;
- if (status == RIL_E_SUCCESS) {
- struct ofono_oem_raw_results result;
-
- result.data = (void *)data;
- result.length = len;
- cbd->cb(ril_error_ok(&error), &result, cbd->data);
+ if (ril_status == RIL_E_SUCCESS) {
+ DBusMessageIter it, array;
+ const guchar* bytes = data;
+ guint i;
+
+ reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &it);
+ dbus_message_iter_open_container(&it, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_BYTE_AS_STRING, &array);
+
+ for (i = 0; i < len; i++) {
+ guchar byte = bytes[i];
+ dbus_message_iter_append_basic(&array, DBUS_TYPE_BYTE,
+ &byte);
+ }
+
+ dbus_message_iter_close_container(&it, &array);
+ } else if (ril_status == GRILIO_STATUS_TIMEOUT) {
+ DBG("Timed out");
+ reply = __ofono_error_timed_out(msg);
} else {
- DBG("error:%d len:%d ", status, len);
- cbd->cb(ril_error_failure(&error), NULL, cbd->data);
+ DBG("Error %s", ril_error_to_string(ril_status));
+ reply = __ofono_error_failed(msg);
}
-}
-static void ril_oem_raw_request(struct ofono_oem_raw *raw,
- const struct ofono_oem_raw_request *request,
- ofono_oem_raw_query_cb_t cb, void *data)
-{
- struct ril_oem_raw *od = ril_oem_raw_get_data(raw);
- GRilIoRequest *req = grilio_request_sized_new(request->length);
-
- grilio_request_append_bytes(req, request->data, request->length);
- grilio_queue_send_request_full(od->q, req, RIL_REQUEST_OEM_HOOK_RAW,
- ril_oem_raw_request_cb, ril_oem_raw_cbd_free,
- ril_oem_raw_cbd_new(cb, data));
- grilio_request_unref(req);
+ __ofono_dbus_pending_reply(&msg, reply);
}
-static gboolean ril_oem_raw_register(gpointer user_data)
+static DBusMessage *ril_oem_raw_send(DBusConnection *conn, DBusMessage *msg,
+ void *user_data)
{
- struct ofono_oem_raw *raw = user_data;
- struct ril_oem_raw *od = ril_oem_raw_get_data(raw);
-
- DBG("");
- GASSERT(od->timer_id);
- od->timer_id = 0;
- ofono_oem_raw_dbus_register(raw);
+ DBusMessageIter it;
+ struct ril_oem_raw *oem = user_data;
- /* Single-shot */
- return FALSE;
+ dbus_message_iter_init(msg, &it);
+ if (dbus_message_iter_get_arg_type(&it) == DBUS_TYPE_ARRAY &&
+ dbus_message_iter_get_element_type(&it) == DBUS_TYPE_BYTE) {
+ char *data;
+ int data_len;
+ DBusMessageIter array;
+ GRilIoRequest *req;
+
+ /* Fetch the data */
+ dbus_message_iter_recurse(&it, &array);
+ dbus_message_iter_get_fixed_array(&array, &data, &data_len);
+ DBG_(oem, "%d bytes", data_len);
+
+ /*
+ * And forward it to rild. Set a timeout because rild may
+ * never respond to invalid requests.
+ */
+ req = grilio_request_sized_new(data_len);
+ grilio_request_set_timeout(req, RIL_OEM_RAW_TIMEOUT);
+ grilio_request_append_bytes(req, data, data_len);
+ grilio_queue_send_request_full(oem->q, req,
+ RIL_REQUEST_OEM_HOOK_RAW, ril_oem_raw_send_cb,
+ NULL, dbus_message_ref(msg));
+ grilio_request_unref(req);
+ return NULL;
+ } else {
+ DBG_(oem, "Unexpected signature");
+ return __ofono_error_invalid_args(msg);
+ }
}
-static int ril_oem_raw_probe(struct ofono_oem_raw *raw, unsigned int vendor,
- void *data)
+static const GDBusMethodTable ril_oem_raw_methods[] = {
+ { GDBUS_ASYNC_METHOD("Send",
+ GDBUS_ARGS({ "request", "ay" }),
+ GDBUS_ARGS({ "response", "ay" }),
+ ril_oem_raw_send) },
+ { }
+};
+
+struct ril_oem_raw *ril_oem_raw_new(struct ril_modem *modem,
+ const char *log_prefix)
{
- struct ril_modem *modem = data;
- struct ril_oem_raw *od = g_new0(struct ril_oem_raw, 1);
+ struct ril_oem_raw *oem = g_new0(struct ril_oem_raw, 1);
- DBG("");
- od->q = grilio_queue_new(ril_modem_io(modem));
- od->timer_id = g_idle_add(ril_oem_raw_register, raw);
- ofono_oem_raw_set_data(raw, od);
- return 0;
+ DBG("%s", ril_modem_get_path(modem));
+ oem->modem = modem;
+ oem->path = g_strdup(ril_modem_get_path(modem));
+ oem->conn = dbus_connection_ref(ofono_dbus_get_connection());
+ oem->q = grilio_queue_new(ril_modem_io(modem));
+ oem->log_prefix = (log_prefix && log_prefix[0]) ?
+ g_strconcat(log_prefix, " ", NULL) : g_strdup("");
+
+ /* Register D-Bus interface */
+ if (g_dbus_register_interface(oem->conn, oem->path,
+ RIL_OEM_RAW_INTERFACE, ril_oem_raw_methods,
+ NULL, NULL, oem, NULL)) {
+ ofono_modem_add_interface(modem->ofono, RIL_OEM_RAW_INTERFACE);
+ return oem;
+ } else {
+ ofono_error("OemRaw D-Bus register failed");
+ ril_oem_raw_free(oem);
+ return NULL;
+ }
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_phonebook.c
^
|
@@ -153,6 +153,7 @@
struct ofono_sim *sim;
struct ofono_sim_context *sim_context;
const unsigned char *df_path;
+ guint register_id;
size_t df_size;
};
@@ -1017,7 +1018,9 @@
static gboolean ril_delayed_register(gpointer user_data)
{
struct ofono_phonebook *pb = user_data;
+ struct pb_data *pbd = ofono_phonebook_get_data(pb);
+ pbd->register_id = 0;
ofono_phonebook_register(pb);
return FALSE;
}
@@ -1040,7 +1043,7 @@
ofono_phonebook_set_data(pb, pd);
- g_idle_add(ril_delayed_register, pb);
+ pd->register_id = g_idle_add(ril_delayed_register, pb);
return 0;
}
@@ -1049,6 +1052,10 @@
{
struct pb_data *pbd = ofono_phonebook_get_data(pb);
+ if (pbd->register_id) {
+ g_source_remove(pbd->register_id);
+ }
+
ofono_phonebook_set_data(pb, NULL);
ofono_sim_context_free(pbd->sim_context);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_plugin.c
^
|
@@ -122,6 +122,7 @@
struct ril_sim_settings *sim_settings;
struct ril_cell_info *cell_info;
struct ril_cell_info_dbus *cell_info_dbus;
+ struct ril_oem_raw *oem_raw;
struct ril_data *data;
GRilIoChannel *io;
gulong io_event_id[IO_EVENT_COUNT];
@@ -673,6 +674,11 @@
GASSERT(slot->modem);
GASSERT(slot->modem == modem);
+ if (slot->oem_raw) {
+ ril_oem_raw_free(slot->oem_raw);
+ slot->oem_raw = NULL;
+ }
+
if (slot->sim_info_dbus) {
ril_sim_info_dbus_free(slot->sim_info_dbus);
slot->sim_info_dbus = NULL;
@@ -804,6 +810,9 @@
slot->cell_info);
}
+ slot->oem_raw = ril_oem_raw_new(slot->modem,
+ ril_plugin_log_prefix(slot));
+
ril_modem_set_removed_cb(modem, ril_plugin_modem_removed, slot);
ril_modem_set_online_cb(modem, ril_plugin_modem_online, slot);
} else {
@@ -946,7 +955,7 @@
GASSERT(!slot->cell_info);
if (slot->io->ril_version > 8) {
slot->cell_info = ril_cell_info_new(slot->io, log_prefix,
- plugin->mce, slot->sim_card);
+ plugin->mce, slot->radio, slot->sim_card);
}
ril_plugin_send_screen_state(slot);
@@ -1633,7 +1642,6 @@
ofono_phonebook_driver_register(&ril_phonebook_driver);
ofono_ussd_driver_register(&ril_ussd_driver);
ofono_cbs_driver_register(&ril_cbs_driver);
- ofono_oem_raw_driver_register(&ril_oem_raw_driver);
ofono_stk_driver_register(&ril_stk_driver);
/* This will create the modems (those that are enabled) */
@@ -1677,7 +1685,6 @@
ofono_phonebook_driver_unregister(&ril_phonebook_driver);
ofono_ussd_driver_unregister(&ril_ussd_driver);
ofono_cbs_driver_unregister(&ril_cbs_driver);
- ofono_oem_raw_driver_unregister(&ril_oem_raw_driver);
ofono_stk_driver_unregister(&ril_stk_driver);
if (ril_plugin) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/drivers/ril/ril_plugin.h
^
|
@@ -28,7 +28,6 @@
#include <ofono/gprs-context.h>
#include <ofono/gprs.h>
#include <ofono/netreg.h>
-#include <ofono/oemraw.h>
#include <ofono/phonebook.h>
#include <ofono/radio-settings.h>
#include <ofono/sim.h>
@@ -99,6 +98,11 @@
void ril_plugin_set_default_data_imsi(struct ril_plugin *plugin,
const char *imsi);
+struct ril_oem_raw;
+struct ril_oem_raw *ril_oem_raw_new(struct ril_modem *md,
+ const char *log_prefix);
+void ril_oem_raw_free(struct ril_oem_raw *raw);
+
struct ril_sim_info_dbus;
struct ril_sim_info_dbus *ril_sim_info_dbus_new(struct ril_modem *md,
struct ril_sim_info *info);
@@ -149,7 +153,6 @@
extern const struct ofono_gprs_driver ril_gprs_driver;
extern const struct ofono_modem_driver ril_modem_driver;
extern const struct ofono_netreg_driver ril_netreg_driver;
-extern /* const */ struct ofono_oem_raw_driver ril_oem_raw_driver;
extern const struct ofono_phonebook_driver ril_phonebook_driver;
extern const struct ofono_radio_settings_driver ril_radio_settings_driver;
extern const struct ofono_sim_driver ril_sim_driver;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/include/dbus.h
^
|
@@ -3,7 +3,7 @@
* oFono - Open Telephony stack for Linux
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-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
@@ -61,7 +61,6 @@
#define OFONO_GNSS_POSR_AGENT_INTERFACE "org.ofono.PositioningRequestAgent"
#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"
#define OFONO_NETWORK_TIME_INTERFACE OFONO_SERVICE ".NetworkTime"
-#define OFONO_OEM_RAW_INTERFACE "org.ofono.OemRaw"
#define OFONO_SIRI_INTERFACE OFONO_SERVICE ".Siri"
/* CDMA Interfaces */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/plugins/mbpi.c
^
|
@@ -44,6 +44,16 @@
#include "mbpi.h"
+const char *mbpi_database = MBPI_DATABASE;
+
+/*
+ * Use IPv4 for MMS contexts because gprs.c assumes that MMS proxy
+ * address is IPv4.
+ */
+enum ofono_gprs_proto mbpi_default_internet_proto = OFONO_GPRS_PROTO_IPV4V6;
+enum ofono_gprs_proto mbpi_default_mms_proto = OFONO_GPRS_PROTO_IP;
+enum ofono_gprs_proto mbpi_default_proto = OFONO_GPRS_PROTO_IP;
+
#define _(x) case x: return (#x)
enum MBPI_ERROR {
@@ -111,7 +121,7 @@
va_end(ap);
- g_prefix_error(error, "%s:%d ", MBPI_DATABASE, line_number);
+ g_prefix_error(error, "%s:%d ", mbpi_database, line_number);
}
static void text_handler(GMarkupParseContext *context,
@@ -120,7 +130,7 @@
{
char **string = userdata;
- g_free(*string);
+ g_free(*string);
*string = g_strndup(text, text_len);
}
@@ -166,7 +176,7 @@
static void usage_start(GMarkupParseContext *context,
const gchar **attribute_names,
const gchar **attribute_values,
- enum ofono_gprs_context_type *type, GError **error)
+ struct ofono_gprs_provision_data *apn, GError **error)
{
const char *text = NULL;
int i;
@@ -182,12 +192,14 @@
return;
}
- if (strcmp(text, "internet") == 0)
- *type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
- else if (strcmp(text, "mms") == 0)
- *type = OFONO_GPRS_CONTEXT_TYPE_MMS;
- else if (strcmp(text, "wap") == 0)
- *type = OFONO_GPRS_CONTEXT_TYPE_WAP;
+ if (strcmp(text, "internet") == 0) {
+ apn->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
+ apn->proto = mbpi_default_internet_proto;
+ } else if (strcmp(text, "mms") == 0) {
+ apn->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
+ apn->proto = mbpi_default_mms_proto;
+ } else if (strcmp(text, "wap") == 0)
+ apn->type = OFONO_GPRS_CONTEXT_TYPE_WAP;
else
mbpi_g_set_error(context, error, G_MARKUP_ERROR,
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
@@ -220,7 +232,7 @@
&apn->message_proxy);
else if (g_str_equal(element_name, "usage"))
usage_start(context, attribute_names, attribute_values,
- &apn->type, error);
+ apn, error);
}
static void apn_end(GMarkupParseContext *context, const gchar *element_name,
@@ -331,7 +343,7 @@
ap->apn = g_strdup(apn);
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
- ap->proto = OFONO_GPRS_PROTO_IP;
+ ap->proto = mbpi_default_proto;
ap->auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
g_markup_parse_context_push(context, &apn_parser, ap);
@@ -611,11 +623,11 @@
GMarkupParseContext *context;
gboolean ret;
- fd = open(MBPI_DATABASE, O_RDONLY);
+ fd = open(mbpi_database, O_RDONLY);
if (fd < 0) {
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
- "open(%s) failed: %s", MBPI_DATABASE,
+ "open(%s) failed: %s", mbpi_database,
g_strerror(errno));
return FALSE;
}
@@ -624,7 +636,7 @@
close(fd);
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
- "fstat(%s) failed: %s", MBPI_DATABASE,
+ "fstat(%s) failed: %s", mbpi_database,
g_strerror(errno));
return FALSE;
}
@@ -634,7 +646,7 @@
close(fd);
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
- "mmap(%s) failed: %s", MBPI_DATABASE,
+ "mmap(%s) failed: %s", mbpi_database,
g_strerror(errno));
return FALSE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/plugins/mbpi.h
^
|
@@ -19,6 +19,11 @@
*
*/
+extern const char *mbpi_database;
+extern enum ofono_gprs_proto mbpi_default_internet_proto;
+extern enum ofono_gprs_proto mbpi_default_mms_proto;
+extern enum ofono_gprs_proto mbpi_default_proto;
+
const char *mbpi_ap_type(enum ofono_gprs_context_type type);
void mbpi_ap_free(struct ofono_gprs_provision_data *data);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git23.tar.bz2/ofono/src/ofono.h
^
|
@@ -152,7 +152,6 @@
OFONO_ATOM_TYPE_CDMA_SMS,
OFONO_ATOM_TYPE_CDMA_NETREG,
OFONO_ATOM_TYPE_HANDSFREE,
- OFONO_ATOM_TYPE_OEM_RAW,
OFONO_ATOM_TYPE_SIRI,
};
|