Compare commits

..

18 Commits

Author SHA1 Message Date
Slava Monich
d65bbc3236 Merge branch 'jb35249' into 'master'
Fix crash on exit if data call setup is pending

See merge request !65
2016-05-17 13:57:18 +00:00
Slava Monich
655544be45 [ril] Fix crash on exit if data call setup is pending. Fixes JB#35249
When context is being removed, the core has already completed its
pending D-Bus request, invoking the completion callback causes
libdbus to panic.
2016-05-16 18:04:34 +03:00
Slava Monich
50a544a191 Merge branch 'default-proto' into 'master'
Use the right data protocol for default context settings

Follow-up to mer-core/ofono!60

See merge request !64
2016-05-14 08:42:27 +00:00
Slava Monich
9e7a4a4d72 [ofono] Use the right data protocol for default context settings. Contributes to JB#32750 2016-05-14 11:40:38 +03:00
Slava Monich
c5b5e3109d Merge branch 'ackretry' into 'master'
Retry RIL_REQUEST_SMS_ACKNOWLEDGE

People report seeing `SMS acknowledgement failed: Further SMS
reception is not guaranteed` message in the log, when they have
some sort of trouble with SMS. Let's see if retry helps.

See merge request !63
2016-04-23 15:48:20 +00:00
Slava Monich
deb106343a [ril] Retry RIL_REQUEST_SMS_ACKNOWLEDGE. Contributes to JB#34851
People report seeing "SMS acknowledgement failed: Further SMS reception
is not guaranteed" message in the log, when they have some sort of trouble
with SMS. Let's see if retry helps.
2016-04-23 12:21:23 +03:00
Slava Monich
771e8becf2 Merge branch 'imei' into 'master'
Fix IMEI query at startup.

See merge request !62
2016-04-22 08:56:45 +00:00
Slava Monich
a0b69f974a [ril] Fixed IMEI query at startup. Fixes JB#34937
IMEI related queries were being completed too early.
2016-04-21 12:25:58 +03:00
Slava Monich
b3a4aaea95 [ofono] Silence "Interface xxx not found on the interface_list" messages
Attempt to remove a modem interface already removed (internally) by ofono
is not an error.
2016-04-20 12:22:33 +03:00
Slava Monich
137e504e10 Merge branch 'jb34928' into 'master'
Prevent crash in ril_delayed_register

See merge request !61
2016-04-19 12:18:32 +00:00
Slava Monich
2de3e445f0 Merge branch 'ipv4v6' into 'master'
Use IPV4V6 for internet contexts by default

Once the packet data protocol is configured, it's saved in the
config file and can be changed via UI. In other words, default
value only affects first-time configuration (i.e. provisioning)
and "Reset to default" function.

See merge request !60
2016-04-19 12:17:57 +00:00
Slava Monich
1cd0d60768 [ril] Prevent crash in ril_delayed_register. Fixes JB#34928
Delayed registration needs to be cancelled by ril_phonebook_remove
if it (registration) hasn't been done yet.
2016-04-19 00:41:33 +03:00
Slava Monich
d1f1f16355 [ofono] Use IPV4V6 (dual) for internet context by default. Fixes JB#32750 2016-04-18 18:59:09 +03:00
Slava Monich
4df72c9376 [ofono] mbpi: Make default packet data protocol configurable. Contributes to JB#32750
Note that according to TS 23.401, UE which is IPv6 and IPv4 capable
should request IPv4v6.
2016-04-18 18:53:50 +03:00
Slava Monich
a35ca2bbd9 [ofono] mbpi: Make MBPI database file configurable at runtime
Useful for provisioning unit tests, if nothing else.
2016-04-18 18:53:28 +03:00
Slava Monich
8376174c76 Merge branch 'oemraw' into 'master'
See merge request !59
2016-04-15 16:12:38 +00:00
Slava Monich
b6f5befcac [ril] Simplify OemRaw D-Bus interface implementation
Since support for this interface has never been merged upstream (and
most likely never will) there is no need to touch ofono core at all.
Moving everything into RIL plugin simplifies the implementation and
allows to delete a few hundred lines of unnecessary code.
2016-04-14 19:03:57 +03:00
Slava Monich
403f29320c [mbpi] Housekeeping 2016-04-13 17:51:32 +03:00
14 changed files with 169 additions and 458 deletions

View File

@@ -22,7 +22,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
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_ofonod_SOURCES = $(builtin_sources) src/ofono.ver \
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) \

View File

@@ -434,8 +434,6 @@ static void ril_gprs_context_activate_primary_cb(struct ril_data *data,
ofono_gprs_context_cb_t cb;
gpointer cb_data;
ofono_info("setting up data call");
ril_error_init_failure(&error);
if (ril_status != RIL_E_SUCCESS) {
ofono_error("GPRS context: Reply failure: %s",
@@ -456,6 +454,8 @@ static void ril_gprs_context_activate_primary_cb(struct ril_data *data,
goto done;
}
ofono_info("setting up data call");
/* Check the ip address */
ril_gprs_split_ip_by_protocol(call->addresses, &split_ip_addr,
&split_ipv6_addr);
@@ -636,7 +636,15 @@ static void ril_gprs_context_remove(struct ofono_gprs_context *gc)
DBG("");
ofono_gprs_context_set_data(gc, NULL);
ril_data_request_cancel(gcd->activate.req);
if (gcd->activate.req) {
/*
* The core has already completed its pending D-Bus
* request, invoking the completion callback will
* cause libdbus to panic.
*/
ril_data_request_detach(gcd->activate.req);
ril_data_request_cancel(gcd->activate.req);
}
if (gcd->deactivate.req) {
/* Let it complete but we won't be around to be notified. */

View File

@@ -300,7 +300,6 @@ static void ril_modem_post_online(struct ofono_modem *modem)
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,

View File

@@ -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;
DBusConnection *conn;
char *path;
char *log_prefix;
};
struct ril_oem_raw_cbd {
ofono_oem_raw_query_cb_t cb;
gpointer data;
};
#define DBG_(oem,fmt,args...) DBG("%s" fmt, (oem)->log_prefix, ##args)
#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;
}
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;
if (ril_status == RIL_E_SUCCESS) {
DBusMessageIter it, array;
const guchar* bytes = data;
guint i;
result.data = (void *)data;
result.length = len;
cbd->cb(ril_error_ok(&error), &result, cbd->data);
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);
}
__ofono_dbus_pending_reply(&msg, reply);
}
static DBusMessage *ril_oem_raw_send(DBusConnection *conn, DBusMessage *msg,
void *user_data)
{
DBusMessageIter it;
struct ril_oem_raw *oem = user_data;
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 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);
}
static gboolean ril_oem_raw_register(gpointer 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);
/* Single-shot */
return FALSE;
}
static int ril_oem_raw_probe(struct ofono_oem_raw *raw, unsigned int vendor,
void *data)
{
struct ril_modem *modem = data;
struct ril_oem_raw *od = 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;
}
static void ril_oem_raw_remove(struct ofono_oem_raw *raw)
{
struct ril_oem_raw *od = ril_oem_raw_get_data(raw);
DBG("");
grilio_queue_cancel_all(od->q, TRUE);
ofono_oem_raw_set_data(raw, NULL);
if (od->timer_id) {
g_source_remove(od->timer_id);
}
grilio_queue_unref(od->q);
g_free(od);
}
/* const */ struct ofono_oem_raw_driver ril_oem_raw_driver = {
.name = RILMODEM_DRIVER,
.probe = ril_oem_raw_probe,
.remove = ril_oem_raw_remove,
.request = ril_oem_raw_request,
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_oem_raw *oem = g_new0(struct ril_oem_raw, 1);
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;
}
}
void ril_oem_raw_free(struct ril_oem_raw *oem)
{
if (oem) {
DBG("%s", oem->path);
g_dbus_unregister_interface(oem->conn, oem->path,
RIL_OEM_RAW_INTERFACE);
ofono_modem_remove_interface(oem->modem->ofono,
RIL_OEM_RAW_INTERFACE);
dbus_connection_unref(oem->conn);
grilio_queue_cancel_all(oem->q, TRUE);
grilio_queue_unref(oem->q);
g_free(oem->log_prefix);
g_free(oem->path);
g_free(oem);
}
}
/*
* Local Variables:
* mode: C

View File

@@ -122,6 +122,7 @@ struct ril_slot {
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];
@@ -674,6 +675,11 @@ static void ril_plugin_modem_removed(struct ril_modem *modem, void *data)
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;
@@ -805,6 +811,9 @@ static void ril_plugin_create_modem(struct ril_slot *slot)
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 {
@@ -1621,7 +1630,6 @@ static int ril_plugin_init(void)
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) */
@@ -1665,7 +1673,6 @@ static void ril_plugin_exit(void)
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) {

View File

@@ -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_voice_imsi(struct ril_plugin *plugin,
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_context_driver ril_gprs_context_driver;
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;

View File

@@ -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
@@ -22,6 +22,9 @@
#include "util.h"
#include "simutil.h"
#define RIL_SMS_ACK_RETRY_MS 1000
#define RIL_SMS_ACK_RETRY_COUNT 10
#define SIM_EFSMS_FILEID 0x6F3C
#define EFSMS_LENGTH 176
@@ -278,6 +281,8 @@ static void ril_ack_delivery(struct ril_sms *sd, gboolean error)
grilio_request_append_int32(req, code); /* error code */
/* ACK the incoming NEW_SMS */
grilio_request_set_retry(req, RIL_SMS_ACK_RETRY_MS,
RIL_SMS_ACK_RETRY_COUNT);
grilio_queue_send_request_full(sd->q, req,
RIL_REQUEST_SMS_ACKNOWLEDGE, ril_ack_delivery_cb, NULL, NULL);
grilio_request_unref(req);

View File

@@ -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 @@ extern "C" {
#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 */

View File

@@ -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 */

View File

@@ -130,7 +130,7 @@ static void text_handler(GMarkupParseContext *context,
{
char **string = userdata;
g_free(*string);
g_free(*string);
*string = g_strndup(text, text_len);
}

View File

@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* 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
@@ -86,6 +86,7 @@ static gint provision_compare_ap(gconstpointer a, gconstpointer b, gpointer data
/* Picks best ap, deletes the rest. Creates one if necessary */
static GSList *provision_pick_best_ap(GSList *list, const char* spn,
const enum ofono_gprs_proto default_proto,
const struct provision_ap_defaults *defaults)
{
/* Sort the list */
@@ -101,6 +102,7 @@ static GSList *provision_pick_best_ap(GSList *list, const char* spn,
struct ofono_gprs_provision_data *ap =
g_new0(struct ofono_gprs_provision_data, 1);
ap->proto = default_proto;
ap->type = defaults->type;
ap->name = g_strdup(defaults->name);
ap->apn = g_strdup(defaults->apn);
@@ -136,8 +138,10 @@ static GSList *provision_normalize_apn_list(GSList *apns, const char* spn)
/* Pick the best ap of each type and concatenate them */
return g_slist_concat(
provision_pick_best_ap(internet_apns, spn, &internet_defaults),
provision_pick_best_ap(mms_apns, spn, &mms_defaults));
provision_pick_best_ap(internet_apns, spn,
mbpi_default_internet_proto, &internet_defaults),
provision_pick_best_ap(mms_apns, spn,
mbpi_default_mms_proto, &mms_defaults));
}
int provision_get_settings(const char *mcc, const char *mnc,

View File

@@ -1326,7 +1326,7 @@ void ofono_modem_remove_interface(struct ofono_modem *modem,
found = g_slist_find_custom(modem->interface_list, interface,
(GCompareFunc) strcmp);
if (found == NULL) {
ofono_error("Interface %s not found on the interface_list",
DBG("Interface %s not found on the interface_list",
interface);
return;
}

View File

@@ -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)
{
g_drivers = g_slist_remove(g_drivers, (void *) driver);
}
void ofono_oem_raw_remove(struct ofono_oem_raw *oemraw)
{
__ofono_atom_free(oemraw->atom);
}
void *ofono_oem_raw_get_data(struct ofono_oem_raw *raw)
{
return raw->driver_data;
}
void ofono_oem_raw_set_data(struct ofono_oem_raw *raw, void *cid)
{
raw->driver_data = cid;
}
static void oem_raw_remove(struct ofono_atom *atom)
{
struct ofono_oem_raw *oemraw = __ofono_atom_get_data(atom);
if (oemraw == NULL)
return;
if (oemraw->driver && oemraw->driver->remove)
oemraw->driver->remove(oemraw);
g_free(oemraw);
}
struct ofono_oem_raw *ofono_oem_raw_create(struct ofono_modem *modem,
unsigned int vendor,
const char *driver,
void *data)
{
struct ofono_oem_raw *oemraw = 0;
GSList *l;
if (driver == NULL)
return NULL;
oemraw = g_try_new0(struct ofono_oem_raw, 1);
if (oemraw == NULL)
return NULL;
oemraw->atom = __ofono_modem_add_atom(modem,
OFONO_ATOM_TYPE_OEM_RAW,
oem_raw_remove, oemraw);
for (l = g_drivers; l; l = l->next) {
const struct ofono_oem_raw_driver *drv = l->data;
if (g_strcmp0(drv->name, driver))
continue;
if (drv->probe(oemraw, vendor, data) < 0)
continue;
oemraw->driver = drv;
break;
}
return oemraw;
}

View File

@@ -152,7 +152,6 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_CDMA_SMS,
OFONO_ATOM_TYPE_CDMA_NETREG,
OFONO_ATOM_TYPE_HANDSFREE,
OFONO_ATOM_TYPE_OEM_RAW,
OFONO_ATOM_TYPE_SIRI,
};