[-]
[+]
|
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/mer-core/ofono.git</param>
<param name="branch">master</param>
- <param name="revision">1482748</param>
+ <param name="revision">5fb35d5</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/.gitignore
^
|
@@ -44,6 +44,7 @@
unit/test-cdmasms
unit/test-rilmodem-cb
unit/test-rilmodem-cs
+unit/test-rilmodem-gprs
unit/test-rilmodem-sms
unit/test-*.log
unit/test-*.trs
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/AUTHORS
^
|
@@ -113,3 +113,6 @@
Nishanth V <nishanth.v@intel.com>
Antara Borwankar <antara.borwankar@gmail.com>
Martin Chaplet <m.chaplet@kerlink.fr>
+Suman Mallela <suman.m@intel.com>
+Rajagopal Aravindan <rajagopalx.aravindan@intel.com>
+Antoine Aubert <a.aubert@overkiz.com>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/ChangeLog
^
|
@@ -1,3 +1,13 @@
+ver 1.19:
+ Fix issue with DHCP parsing and Huawei modems.
+ Fix issue with detecting Huawei E3372 modem.
+ Fix issue with handling serving cell info.
+ Fix issue with handling SIM SC facility lock.
+ Fix issue with Android RIL PIN retry logic.
+ Fix issue with Android RIL and RAT handling.
+ Add support for Android RIL cell broadcast.
+ Add support for SoFIA 3GR thermal management.
+
ver 1.18:
Fix issue with cell broadcast and use-after-fee.
Fix issue with repeated held call indicator.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/Makefile.am
^
|
@@ -197,6 +197,7 @@
drivers/rilmodem/call-barring.c \
drivers/rilmodem/netmon.c \
drivers/rilmodem/stk.c \
+ drivers/rilmodem/cbs.c \
drivers/infineonmodem/infineon_constants.h
endif
endif
@@ -758,6 +759,7 @@
test/receive-sms \
test/remove-contexts \
test/send-sms \
+ test/cancel-sms \
test/set-mic-volume \
test/set-speaker-volume \
test/test-stk-menu \
@@ -828,7 +830,9 @@
test/set-sms-smsc \
test/set-sms-bearer \
test/get-serving-cell-info \
- test/list-allowed-access-points
+ test/list-allowed-access-points \
+ test/enable-throttling \
+ test/disable-throttling
if TEST
testdir = $(pkglibdir)/test
@@ -854,7 +858,8 @@
unit_tests += unit/test-rilmodem-cs \
unit/test-rilmodem-cs \
unit/test-rilmodem-sms \
- unit/test-rilmodem-cb
+ unit/test-rilmodem-cb \
+ unit/test-rilmodem-gprs
endif
endif
@@ -916,14 +921,14 @@
unit_test_provision_LDADD = @GLIB_LIBS@ -ldl
unit_objects += $(unit_test_provision_OBJECTS)
-if RILMODEM
-if JOLLA_RILMODEM
-
test_rilmodem_sources = $(gril_sources) src/log.c src/common.c src/util.c \
gatchat/ringbuffer.h gatchat/ringbuffer.c \
unit/rilmodem-test-server.h \
unit/rilmodem-test-server.c \
- src/simutil.c
+ unit/rilmodem-test-engine.h \
+ unit/rilmodem-test-engine.c \
+ src/simutil.c \
+ drivers/rilmodem/rilutil.c
unit_test_rilmodem_cs_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-cs.c \
@@ -946,8 +951,12 @@
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
unit_objects += $(unit_test_rilmodem_cb_OBJECTS)
-endif
-endif
+unit_test_rilmodem_gprs_SOURCES = $(test_rilmodem_sources) \
+ unit/test-rilmodem-gprs.c \
+ drivers/rilmodem/gprs.c
+unit_test_rilmodem_gprs_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
+ @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+unit_objects += $(unit_test_rilmodem_gprs_OBJECTS)
TESTS = $(unit_tests)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/configure.ac
^
|
@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
-AC_INIT(ofono, 1.18)
+AC_INIT(ofono, 1.19)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/huaweimodem/gprs-context.c
^
|
@@ -80,7 +80,7 @@
if (g_at_result_iter_next_unquoted_string(iter, &str) == FALSE)
return FALSE;
- val = strtol(str, NULL, 16);
+ val = strtoul(str, NULL, 16);
if (addr)
*addr = g_strdup_printf("%u.%u.%u.%u",
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/ril/ril_cbs.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,60 +16,152 @@
#include "ril_plugin.h"
#include "ril_util.h"
#include "ril_log.h"
-#include "ril_constants.h"
+
+#include <gutil_strv.h>
struct ril_cbs {
struct ofono_cbs *cbs;
GRilIoChannel *io;
- guint timer_id;
+ GRilIoQueue *q;
+ char *log_prefix;
gulong event_id;
};
-static void ril_set_topics(struct ofono_cbs *cbs, const char *topics,
+struct ril_cbs_cbd {
+ struct ril_cbs *cd;
+ ofono_cbs_set_cb_t cb;
+ gpointer data;
+};
+
+#define DBG_(cd,fmt,args...) DBG("%s" fmt, (cd)->log_prefix, ##args)
+
+#define ril_cbs_cbd_free g_free
+
+static struct ril_cbs_cbd *ril_cbs_cbd_new(struct ril_cbs *cd,
+ ofono_cbs_set_cb_t cb, void *data)
+{
+ struct ril_cbs_cbd *cbd = g_new(struct ril_cbs_cbd, 1);
+
+ cbd->cd = cd;
+ cbd->cb = cb;
+ cbd->data = data;
+ return cbd;
+}
+
+static void ril_cbs_request_activation(struct ril_cbs *cd,
+ gboolean activate, GRilIoChannelResponseFunc response,
+ GDestroyNotify destroy, void* user_data)
+{
+ GRilIoRequest* req = grilio_request_sized_new(8);
+
+ grilio_request_append_int32(req, 1);
+ grilio_request_append_int32(req, activate ? 0 :1);
+
+ DBG_(cd, "%sactivating CB", activate ? "" : "de");
+ grilio_queue_send_request_full(cd->q, req,
+ RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION,
+ response, destroy, user_data);
+ grilio_request_unref(req);
+}
+
+static void ril_cbs_set_config(struct ril_cbs *cd, const char *topics,
+ GRilIoChannelResponseFunc response,
+ GDestroyNotify destroy, void* user_data)
+{
+ char **list = topics ? g_strsplit(topics, ",", 0) : NULL;
+ int i, n = gutil_strv_length(list);
+ GRilIoRequest* req = grilio_request_new();
+
+ grilio_request_append_int32(req, n);
+ for (i = 0; i < n; i++) {
+ const char *entry = list[i];
+ const char *delim = strchr(entry, '-');
+ int from, to;
+ if (delim) {
+ char **range = g_strsplit(topics, "-", 0);
+ from = atoi(range[0]);
+ to = atoi(range[1]);
+ g_strfreev(range);
+ } else {
+ from = to = atoi(entry);
+ }
+
+ grilio_request_append_int32(req, from);
+ grilio_request_append_int32(req, to);
+ grilio_request_append_int32(req, 0);
+ grilio_request_append_int32(req, 0xff);
+ grilio_request_append_int32(req, 1);
+ }
+
+ DBG_(cd, "configuring CB");
+ grilio_queue_send_request_full(cd->q, req,
+ RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG,
+ response, destroy, user_data);
+ grilio_request_unref(req);
+ g_strfreev(list);
+}
+
+static void ril_cbs_cb(GRilIoChannel *io, int ril_status,
+ const void *data, guint len, void *user_data)
+{
+ struct ril_cbs_cbd *cbd = user_data;
+
+ if (cbd->cb) {
+ struct ofono_error error;
+
+ if (ril_status == RIL_E_SUCCESS) {
+ cbd->cb(ril_error_ok(&error), cbd->data);
+ } else {
+ cbd->cb(ril_error_failure(&error), cbd->data);
+ }
+ }
+}
+
+static void ril_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
ofono_cbs_set_cb_t cb, void *data)
{
- struct ofono_error error;
- cb(ril_error_ok(&error), data);
+ struct ril_cbs *cd = ofono_cbs_get_data(cbs);
+
+ DBG_(cd, "%s", topics);
+ ril_cbs_set_config(cd, topics, ril_cbs_cb, ril_cbs_cbd_free,
+ ril_cbs_cbd_new(cd, cb, data));
}
-static void ril_clear_topics(struct ofono_cbs *cbs,
+static void ril_cbs_clear_topics(struct ofono_cbs *cbs,
ofono_cbs_set_cb_t cb, void *data)
{
- struct ofono_error error;
- cb(ril_error_ok(&error), data);
+ struct ril_cbs *cd = ofono_cbs_get_data(cbs);
+
+ DBG_(cd, "");
+ ril_cbs_request_activation(cd, FALSE, ril_cbs_cb, ril_cbs_cbd_free,
+ ril_cbs_cbd_new(cd, cb, data));
}
static void ril_cbs_notify(GRilIoChannel *io, guint code,
const void *data, guint len, void *user_data)
{
struct ril_cbs *cd = user_data;
- GRilIoParser rilp;
- char* pdu;
- GASSERT(code == RIL_UNSOL_ON_USSD);
- grilio_parser_init(&rilp, data, len);
- pdu = grilio_parser_get_utf8(&rilp);
- DBG("%s", pdu);
- if (pdu) {
- ofono_cbs_notify(cd->cbs, (const guchar *)pdu, strlen(pdu));
- g_free(pdu);
- }
+ GASSERT(code == RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS);
+ DBG_(cd, "%u bytes", len);
+ ofono_cbs_notify(cd->cbs, data, len);
}
-static gboolean ril_cbs_register(gpointer user_data)
+static void ril_cbs_probe_done_cb(GRilIoChannel *io, int status,
+ const void *data, guint len, void *user_data)
{
struct ril_cbs *cd = user_data;
- DBG("");
- GASSERT(cd->timer_id);
- cd->timer_id = 0;
- ofono_cbs_register(cd->cbs);
-
- cd->event_id = grilio_channel_add_unsol_event_handler(cd->io,
- ril_cbs_notify, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, cd);
-
- /* Single-shot */
- return FALSE;
+ if (status == RIL_E_SUCCESS) {
+ DBG_(cd, "registering for CB");
+ cd->event_id = grilio_channel_add_unsol_event_handler(cd->io,
+ ril_cbs_notify, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS,
+ cd);
+ ofono_cbs_register(cd->cbs);
+ } else {
+ DBG_(cd, "failed to query CB config");
+ ofono_cbs_remove(cd->cbs);
+ }
}
static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
@@ -78,11 +170,17 @@
struct ril_modem *modem = data;
struct ril_cbs *cd = g_try_new0(struct ril_cbs, 1);
- DBG("");
+ ofono_cbs_set_data(cbs, cd);
+ cd->log_prefix = (modem->log_prefix && modem->log_prefix[0]) ?
+ g_strconcat(modem->log_prefix, " ", NULL) : g_strdup("");
cd->cbs = cbs;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/ril/ril_data.c
^
|
@@ -36,6 +36,7 @@
#define PROTO_IPV4V6_STR "IPV4V6"
enum ril_data_priv_flags {
+ RIL_DATA_FLAG_NONE = 0x00,
RIL_DATA_FLAG_ALLOWED = 0x01,
RIL_DATA_FLAG_MAX_SPEED = 0x02,
RIL_DATA_FLAG_ON = 0x04
@@ -100,6 +101,7 @@
struct ril_data_request *pending_req;
struct ril_data_options options;
+ guint slot;
char *log_prefix;
guint query_id;
gulong io_event_id;
@@ -1058,9 +1060,20 @@
ril_data_manager_check_network_mode(RIL_DATA(user_data)->priv->dm);
}
+static gint ril_data_compare_cb(gconstpointer a, gconstpointer b)
+{
+ const struct ril_data *d1 = a;
+ const struct ril_data *d2 = b;
+ const struct ril_data_priv *p1 = d1->priv;
+ const struct ril_data_priv *p2 = d2->priv;
+
+ return p1->slot < p2->slot ? (-1) : p1->slot > p2->slot ? 1 : 0;
+}
+
struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
struct ril_radio *radio, struct ril_network *network,
- GRilIoChannel *io, const struct ril_data_options *options)
+ GRilIoChannel *io, const struct ril_data_options *options,
+ const struct ril_slot_config *config)
{
GASSERT(dm);
if (G_LIKELY(dm)) {
@@ -1087,6 +1100,7 @@
priv->log_prefix = (name && name[0]) ?
g_strconcat(name, " ", NULL) : g_strdup("");
+ priv->slot = config->slot;
priv->q = grilio_queue_new(io);
priv->io = grilio_channel_ref(io);
priv->dm = ril_data_manager_ref(dm);
@@ -1111,7 +1125,9 @@
NULL, self);
grilio_request_unref(req);
- dm->data_list = g_slist_append(dm->data_list, self);
+ /* Order data contexts according to slot numbers */
+ dm->data_list = g_slist_insert_sorted(dm->data_list, self,
+ ril_data_compare_cb);
ril_data_manager_check_network_mode(dm);
return self;
}
@@ -1444,53 +1460,54 @@
GSList *l;
if (ril_data_manager_handover(self)) {
- gboolean need_fast_access = FALSE;
+ struct ril_network *lte_network = NULL;
int non_gsm_count = 0;
/*
- * Count number of SIMs for which GSM is selected
+ * Count number of SIMs for which non-GSM mode is selected
*/
for (l= self->data_list; l; l = l->next) {
struct ril_data *data = l->data;
struct ril_data_priv *priv = data->priv;
- struct ril_sim_settings *sim = priv->network->settings;
+ struct ril_network *network = priv->network;
+ struct ril_sim_settings *sim = network->settings;
- if (sim->pref_mode != OFONO_RADIO_ACCESS_MODE_GSM &&
- sim->imsi) {
+ if (sim->pref_mode != OFONO_RADIO_ACCESS_MODE_GSM) {
non_gsm_count++;
- if (priv->flags & RIL_DATA_FLAG_MAX_SPEED) {
- need_fast_access = TRUE;
+ if ((priv->flags & RIL_DATA_FLAG_MAX_SPEED) &&
+ !lte_network) {
+ lte_network = network;
}
}
}
/*
- * If the SIM selected for internet access has non-GSM mode
- * enabled and non-GSM mode is enabled for more than one SIM,
- * then we need to limit other SIMs to GSM. Otherwise, turn
- * all limits off.
+ * If there's no SIM selected for internet access
+ * then choose the first slot for LTE.
*/
- if (need_fast_access && non_gsm_count > 1) {
- for (l= self->data_list; l; l = l->next) {
- struct ril_data *data = l->data;
- struct ril_data_priv *priv = data->priv;
-
- ril_network_set_max_pref_mode(priv->network,
- (priv->flags & RIL_DATA_FLAG_MAX_SPEED) ?
- OFONO_RADIO_ACCESS_MODE_ANY :
- OFONO_RADIO_ACCESS_MODE_GSM,
- FALSE);
- }
+ if (!lte_network) {
+ struct ril_data *data = self->data_list->data;
+ lte_network = data->priv->network;
+ }
+
+ for (l= self->data_list; l; l = l->next) {
+ struct ril_data *data = l->data;
+ struct ril_network *network = data->priv->network;
- return;
+ ril_network_set_max_pref_mode(network,
+ (network == lte_network) ?
+ OFONO_RADIO_ACCESS_MODE_ANY :
+ OFONO_RADIO_ACCESS_MODE_GSM,
+ FALSE);
}
- }
- /* Otherwise there's no reason to limit anything */
- for (l= self->data_list; l; l = l->next) {
- struct ril_data *data = l->data;
- ril_network_set_max_pref_mode(data->priv->network,
+ } else {
+ /* Otherwise there's no reason to limit anything */
+ for (l= self->data_list; l; l = l->next) {
+ struct ril_data *data = l->data;
+ ril_network_set_max_pref_mode(data->priv->network,
OFONO_RADIO_ACCESS_MODE_ANY, FALSE);
+ }
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/ril/ril_data.h
^
|
@@ -94,7 +94,8 @@
struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
struct ril_radio *radio, struct ril_network *network,
- GRilIoChannel *io, const struct ril_data_options *options);
+ GRilIoChannel *io, const struct ril_data_options *options,
+ const struct ril_slot_config *config);
struct ril_data *ril_data_ref(struct ril_data *data);
void ril_data_unref(struct ril_data *data);
gboolean ril_data_allowed(struct ril_data *data);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/ril/ril_modem.c
^
|
@@ -311,6 +311,7 @@
ofono_call_forwarding_create(modem, 0, RILMODEM_DRIVER, md);
ofono_call_barring_create(modem, 0, RILMODEM_DRIVER, md);
ofono_stk_create(modem, 0, RILMODEM_DRIVER, md);
+ ofono_cbs_create(modem, 0, RILMODEM_DRIVER, md);
ofono_message_waiting_register(ofono_message_waiting_create(modem));
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/ril/ril_plugin.c
^
|
@@ -975,7 +975,8 @@
GASSERT(!slot->data);
slot->data = ril_data_new(slot->plugin->data_manager, log_prefix,
- slot->radio, slot->network, slot->io, &slot->data_opt);
+ slot->radio, slot->network, slot->io, &slot->data_opt,
+ &slot->config);
GASSERT(!slot->cell_info);
if (slot->io->ril_version > 8) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/ril/ril_sim.c
^
|
@@ -379,20 +379,11 @@
DBG_(sd, "");
-
- /*
- * In case sim card has been removed prior to this callback has been
- * called we must not call the core call back method as otherwise the
- * core will crash.
- */
- if (!sd->inserted) {
- ofono_error("No SIM card");
- return;
- }
-
ril_error_init_failure(&error);
res = ril_sim_parse_io_response(data, len);
- if (ril_sim_io_response_ok(res) && status == RIL_E_SUCCESS) {
+ if (!sd->inserted) {
+ DBG_(sd, "No SIM card");
+ } else if (ril_sim_io_response_ok(res) && status == RIL_E_SUCCESS) {
gboolean ok = FALSE;
guchar access[3] = { 0x00, 0x00, 0x00 };
guchar file_status = EF_STATUS_VALID;
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/rilmodem/cbs.c
^
|
@@ -0,0 +1,213 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2016 Intel Corporation. All rights reserved.
+ *
+ * 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 <string.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/cbs.h>
+#include "util.h"
+
+#include <gril.h>
+#include <parcel.h>
+
+#include "rilmodem.h"
+#include "vendor.h"
+
+struct cbs_data {
+ GRil *ril;
+ unsigned int vendor;
+};
+
+static void ril_cbs_set_cb(struct ril_msg *message, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_cbs_set_cb_t cb = cbd->cb;
+ struct cbs_data *cd = cbd->user;
+
+ if (message->error == RIL_E_SUCCESS) {
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ } else {
+ ofono_error("%s RILD reply failure: %s",
+ g_ril_request_id_to_string(cd->ril, message->req),
+ ril_error_to_string(message->error));
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+ }
+}
+
+static void ril_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
+ ofono_cbs_set_cb_t cb, void *user_data)
+{
+ struct cbs_data *cd = ofono_cbs_get_data(cbs);
+ struct cb_data *cbd = cb_data_new(cb, user_data, cd);
+ int i = 0, from, to;
+ const char *p, *pto;
+ char **segments;
+ struct parcel rilp;
+
+ segments = g_strsplit(topics, ",", 0);
+
+ while (segments[i])
+ i++;
+
+ parcel_init(&rilp);
+ parcel_w_int32(&rilp, i);
+
+ i = 0;
+ while (segments[i]) {
+ p = segments[i++];
+ from = atoi(p);
+ to = from;
+
+ pto = strchr(p, '-');
+ if (pto)
+ to = atoi(pto + 1);
+
+ parcel_w_int32(&rilp, from);
+ parcel_w_int32(&rilp, to);
+
+ parcel_w_int32(&rilp, 0);
+ parcel_w_int32(&rilp, 0xFF);
+
+ parcel_w_int32(&rilp, 1);
+ }
+
+ g_strfreev(segments);
+
+ if (g_ril_send(cd->ril, RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, &rilp,
+ ril_cbs_set_cb, cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, user_data);
+}
+
+static void ril_cbs_clear_topics(struct ofono_cbs *cbs,
+ ofono_cbs_set_cb_t cb, void *user_data)
+{
+ ril_cbs_set_topics(cbs, "", cb, user_data);
+}
+
+static void ril_cbs_received(struct ril_msg *message, gpointer user_data)
+{
+ struct ofono_cbs *cbs = user_data;
+ struct cbs_data *cd = ofono_cbs_get_data(cbs);
+ struct parcel rilp;
+ int pdulen;
+ unsigned char *pdu;
+
+ g_ril_print_unsol_no_args(cd->ril, message);
+
+ DBG("req: %d; data_len: %d", message->req, (int) message->buf_len);
+
+ g_ril_init_parcel(message, &rilp);
+ pdu = parcel_r_raw(&rilp, &pdulen);
+
+ if (!pdu || pdulen != 88) {
+ ofono_error("%s: it isn't a gsm cell broadcast msg", __func__);
+ return;
+ }
+
+ ofono_cbs_notify(cbs, pdu, pdulen);
+ g_free(pdu);
+}
+
+static void ril_cbs_register(const struct ofono_error *error, void *data)
+{
+ struct ofono_cbs *cbs = data;
+ struct cbs_data *cd = ofono_cbs_get_data(cbs);
+
+ g_ril_register(cd->ril, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS,
+ ril_cbs_received, cbs);
+
+ ofono_cbs_register(cbs);
+}
+
+static void get_cbs_config_cb(struct ril_msg *message,
+ gpointer user_data)
+{
+ struct ofono_cbs *cbs = user_data;
+
+ if (message->error != RIL_E_SUCCESS) {
+ ofono_error("%s: RIL error %s", __func__,
+ ril_error_to_string(message->error));
+ ofono_cbs_remove(cbs);
+ return;
+ }
+
+ ril_cbs_clear_topics(cbs, ril_cbs_register, cbs);
+}
+
+static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
+ void *user)
+{
+ GRil *ril = user;
+ struct cbs_data *data;
+
+ data = g_new0(struct cbs_data, 1);
+ data->ril = g_ril_clone(ril);
+ data->vendor = vendor;
+
+ ofono_cbs_set_data(cbs, data);
+
+ if (g_ril_send(ril, RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, NULL,
+ get_cbs_config_cb, cbs, NULL) == 0)
+ ofono_error("%s: send failed", __func__);
+
+ return 0;
+}
+
+static void ril_cbs_remove(struct ofono_cbs *cbs)
+{
+ struct cbs_data *data = ofono_cbs_get_data(cbs);
+
+ ofono_cbs_set_data(cbs, NULL);
+
+ g_ril_unref(data->ril);
+ g_free(data);
+}
+
+static struct ofono_cbs_driver driver = {
+ .name = RILMODEM,
+ .probe = ril_cbs_probe,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/rilmodem/radio-settings.c
^
|
@@ -198,6 +198,7 @@
* capabilities, so it is sort of the default for MTK modems.
*/
switch (net_type) {
+ case PREF_NET_TYPE_WCDMA:
case PREF_NET_TYPE_GSM_WCDMA:
case PREF_NET_TYPE_GSM_WCDMA_AUTO:
mode = OFONO_RADIO_ACCESS_MODE_UMTS;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/rilmodem/rilmodem.c
^
|
@@ -53,6 +53,7 @@
ril_call_barring_init();
ril_netmon_init();
ril_stk_init();
+ ril_cbs_init();
return 0;
}
@@ -76,6 +77,7 @@
ril_call_barring_exit();
ril_netmon_exit();
ril_stk_exit();
+ ril_cbs_exit();
}
OFONO_PLUGIN_DEFINE(rilmodem, "RIL modem driver", VERSION,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/rilmodem/rilmodem.h
^
|
@@ -75,3 +75,6 @@
extern void ril_stk_init(void);
extern void ril_stk_exit(void);
+
+extern void ril_cbs_init(void);
+extern void ril_cbs_exit(void);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/drivers/rilmodem/sim.c
^
|
@@ -79,7 +79,7 @@
* The same applies to the app_type.
*/
-static void ril_pin_change_state(struct ofono_sim *sim,
+static void ril_set_facility_lock(struct ofono_sim *sim,
enum ofono_sim_password_type passwd_type,
int enable, const char *passwd,
ofono_sim_lock_unlock_cb_t cb, void *data);
@@ -1083,7 +1083,7 @@
CALLBACK_WITH_SUCCESS(cb, sd->passwd_state, data);
}
-static void ril_pin_change_state_cb(struct ril_msg *message, gpointer user_data)
+static void ril_enter_sim_pin_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_sim_lock_unlock_cb_t cb = cbd->cb;
@@ -1101,36 +1101,17 @@
g_ril_init_parcel(message, &rilp);
- /* maguro/infineon: no data is returned */
- if (parcel_data_avail(&rilp) == 0)
- goto done;
-
parcel_r_int32(&rilp);
- switch (g_ril_vendor(sd->ril)) {
- case OFONO_RIL_VENDOR_AOSP:
- case OFONO_RIL_VENDOR_QCOM_MSIM:
- /*
- * The number of retries is valid only when a wrong password has
- * been introduced in Nexus 4. TODO: check Nexus 5 behaviour.
- */
- if (message->error == RIL_E_PASSWORD_INCORRECT)
- sd->retries[sd->passwd_type] = parcel_r_int32(&rilp);
-
- g_ril_append_print_buf(sd->ril, "{%d}",
- sd->retries[sd->passwd_type]);
- g_ril_print_response(sd->ril, message);
+ if (message->error == RIL_E_SUCCESS)
+ sd->retries[sd->passwd_type] = -1;
+ else
+ sd->retries[sd->passwd_type] = parcel_r_int32(&rilp);
- break;
- /* Taken care of elsewhere */
- case OFONO_RIL_VENDOR_INFINEON:
- case OFONO_RIL_VENDOR_MTK:
- break;
- default:
- break;
- }
+ g_ril_append_print_buf(sd->ril, "{%d}",
+ sd->retries[sd->passwd_type]);
+ g_ril_print_response(sd->ril, message);
-done:
if (message->error == RIL_E_SUCCESS) {
CALLBACK_WITH_SUCCESS(cb, cbd->data);
return;
@@ -1167,30 +1148,13 @@
g_ril_append_print_buf(sd->ril, "(%s,aid=%s)", passwd, sd->aid_str);
if (g_ril_send(sd->ril, RIL_REQUEST_ENTER_SIM_PIN, &rilp,
- ril_pin_change_state_cb, cbd, g_free) > 0)
+ ril_enter_sim_pin_cb, cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
-static void enter_pin_done(const struct ofono_error *error, void *data)
-{
- struct change_state_cbd *csd = data;
- struct sim_data *sd = ofono_sim_get_data(csd->sim);
-
- if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
- ofono_error("%s: wrong password", __func__);
- sd->unlock_pending = FALSE;
- CALLBACK_WITH_FAILURE(csd->cb, csd->data);
- } else {
- ril_pin_change_state(csd->sim, csd->passwd_type, csd->enable,
- csd->passwd, csd->cb, csd->data);
- }
-
- g_free(csd);
-}
-
static const char *const clck_cpwd_fac[] = {
[OFONO_SIM_PASSWORD_SIM_PIN] = "SC",
[OFONO_SIM_PASSWORD_SIM_PIN2] = "P2",
@@ -1204,38 +1168,55 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-static void ril_pin_change_state(struct ofono_sim *sim,
- enum ofono_sim_password_type passwd_type,
- int enable, const char *passwd,
- ofono_sim_lock_unlock_cb_t cb, void *data)
+static void ril_set_facility_lock_cb(struct ril_msg *message,
+ gpointer user_data)
{
+ struct cb_data *cbd = user_data;
+ ofono_sim_lock_unlock_cb_t cb = cbd->cb;
+ struct ofono_sim *sim = cbd->user;
struct sim_data *sd = ofono_sim_get_data(sim);
- struct cb_data *cbd;
struct parcel rilp;
/*
- * If we want to unlock a password that has not been entered yet,
- * we enter it before trying to unlock. We need sd->unlock_pending as
- * the password still has not yet been refreshed when this function is
- * called from enter_pin_done().
+ * There is no reason to ask SIM status until
+ * unsolicited sim status change indication
+ * Looks like state does not change before that.
*/
- if (ofono_sim_get_password_type(sim) == passwd_type
- && enable == FALSE && sd->unlock_pending == FALSE) {
- struct change_state_cbd *csd = g_malloc0(sizeof(*csd));
- csd->sim = sim;
- csd->passwd_type = passwd_type;
- csd->enable = enable;
- csd->passwd = passwd;
- csd->cb = cb;
- csd->data = data;
- sd->unlock_pending = TRUE;
+ DBG("Enter password: type %d, result %d",
+ sd->passwd_type, message->error);
- ril_pin_send(sim, passwd, enter_pin_done, csd);
+ g_ril_init_parcel(message, &rilp);
+
+ parcel_r_int32(&rilp);
+
+ if (message->error == RIL_E_SUCCESS)
+ sd->retries[sd->passwd_type] = -1;
+ else
+ sd->retries[sd->passwd_type] = parcel_r_int32(&rilp);
+ g_ril_append_print_buf(sd->ril, "{%d}",
+ sd->retries[sd->passwd_type]);
+ g_ril_print_response(sd->ril, message);
+
+ if (message->error == RIL_E_SUCCESS) {
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
return;
}
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+}
+
+static void ril_set_facility_lock(struct ofono_sim *sim,
+ enum ofono_sim_password_type passwd_type,
+ int enable, const char *passwd,
+ ofono_sim_lock_unlock_cb_t cb, void *data)
+{
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ struct cb_data *cbd;
+ struct parcel rilp;
+
sd->unlock_pending = FALSE;
+ sd->passwd_type = passwd_type;
if (passwd_type >= ARRAY_SIZE(clck_cpwd_fac) ||
clck_cpwd_fac[passwd_type] == NULL)
@@ -1257,7 +1238,7 @@
sd->aid_str);
if (g_ril_send(sd->ril, RIL_REQUEST_SET_FACILITY_LOCK, &rilp,
- ril_pin_change_state_cb, cbd, g_free) > 0)
+ ril_set_facility_lock_cb, cbd, g_free) > 0)
return;
g_free(cbd);
@@ -1265,6 +1246,37 @@
CALLBACK_WITH_FAILURE(cb, data);
}
+static void ril_enter_sim_puk_cb(struct ril_msg *message, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_sim_lock_unlock_cb_t cb = cbd->cb;
+ struct ofono_sim *sim = cbd->user;
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ struct parcel rilp;
+
+ g_ril_init_parcel(message, &rilp);
+
+ parcel_r_int32(&rilp);
+
+ if (message->error != RIL_E_SUCCESS) {
+ sd->retries[OFONO_SIM_PASSWORD_SIM_PUK] = parcel_r_int32(&rilp);
+ } else {
+ sd->retries[OFONO_SIM_PASSWORD_SIM_PIN] = -1;
+ sd->retries[OFONO_SIM_PASSWORD_SIM_PUK] = -1;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/gatchat/gatmux.c
^
|
@@ -598,6 +598,13 @@
}
}
+static void read_watcher_destroy_notify(gpointer user_data)
+{
+ GAtMux *mux = user_data;
+
+ mux->read_watch = 0;
+}
+
gboolean g_at_mux_start(GAtMux *mux)
{
if (mux->channel == NULL)
@@ -611,7 +618,8 @@
mux->read_watch = g_io_add_watch_full(mux->channel, G_PRIORITY_DEFAULT,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- received_data, mux, NULL);
+ received_data, mux,
+ read_watcher_destroy_notify);
mux->shutdown = FALSE;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/gril/gril.c
^
|
@@ -374,6 +374,12 @@
if (req->callback)
req->callback(message, req->user_data);
+ /* gril may have been destroyed in the request callback */
+ if (p->destroyed) {
+ ril_request_destroy(req);
+ return;
+ }
+
len = g_queue_get_length(p->out_queue);
for (i = 0; i < len; i++) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/gril/gril.h
^
|
@@ -75,7 +75,8 @@
#define g_ril_print_request(gril, token, req) \
G_RIL_TRACE(gril, "[%d,%04d]> %s %s", \
g_ril_get_slot(gril), token, \
- g_ril_request_id_to_string(gril, req), print_buf)
+ g_ril_request_id_to_string(gril, req), print_buf); \
+ print_buf[0] = '\0';
#define g_ril_print_request_no_args(gril, token, req) \
G_RIL_TRACE(gril, "[%d,%04d]> %s", \
g_ril_get_slot(gril), token, \
@@ -85,7 +86,8 @@
g_ril_get_slot(gril), \
message->serial_no, \
g_ril_request_id_to_string(gril, message->req), \
- print_buf)
+ print_buf); \
+ print_buf[0] = '\0';
#define g_ril_print_response_no_args(gril, message) \
G_RIL_TRACE(gril, "[%d,%04d]< %s", \
g_ril_get_slot(gril), message->serial_no, \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/include/gprs-context.h
^
|
@@ -55,7 +55,6 @@
struct ofono_gprs_primary_context {
unsigned int cid;
- int direction;
char apn[OFONO_GPRS_MAX_APN_LENGTH + 1];
char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/plugins/ril.c
^
|
@@ -239,6 +239,7 @@
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+ ofono_cbs_create(modem, rd->vendor, RILMODEM, rd->ril);
ofono_netreg_create(modem, rd->vendor, RILMODEM, rd->ril);
ofono_ussd_create(modem, rd->vendor, RILMODEM, rd->ril);
ofono_call_settings_create(modem, rd->vendor, RILMODEM, rd->ril);
@@ -409,15 +410,30 @@
return -EINPROGRESS;
}
+static void power_off_cb(struct ril_msg *message, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ struct ril_data *rd = cbd->user;
+ struct ofono_modem *modem = cbd->data;
+
+ if (rd) {
+ g_ril_unref(rd->ril);
+ rd->ril = NULL;
+ }
+
+ ofono_modem_set_powered(modem, FALSE);
+}
+
int ril_disable(struct ofono_modem *modem)
{
struct ril_data *rd = ofono_modem_get_data(modem);
+ struct cb_data *cbd = cb_data_new(NULL, modem, rd);
DBG("%p", modem);
- ril_send_power(rd, FALSE, NULL, NULL);
+ ril_send_power(rd, FALSE, power_off_cb, cbd);
- return 0;
+ return -EINPROGRESS;
}
static struct ofono_modem_driver ril_driver = {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/plugins/ril_sofia3gr.c
^
|
@@ -29,6 +29,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#include <unistd.h>
#include <glib.h>
@@ -52,11 +53,22 @@
#include "drivers/rilmodem/rilmodem.h"
#include "drivers/rilmodem/vendor.h"
+#include "gdbus.h"
+
+#include "ofono.h"
+
+#define THERMAL_MANAGEMENT_INTERFACE OFONO_SERVICE ".sofia3gr.ThermalManagement"
struct ril_data {
GRil *ril;
};
+struct ril_thermal_management {
+ DBusMessage *pending;
+ struct ofono_modem *modem;
+ dbus_bool_t throttling;
+};
+
static int ril_send_power(GRil *ril, ofono_bool_t online,
GRilResponseFunc func,
gpointer user_data,
@@ -129,7 +141,14 @@
static void ril_remove(struct ofono_modem *modem)
{
+ DBusConnection *conn = ofono_dbus_get_connection();
struct ril_data *rd = ofono_modem_get_data(modem);
+ const char *path = ofono_modem_get_path(modem);
+
+ if (g_dbus_unregister_interface(conn, path,
+ THERMAL_MANAGEMENT_INTERFACE))
+ ofono_modem_remove_interface(modem,
+ THERMAL_MANAGEMENT_INTERFACE);
ofono_modem_set_data(modem, NULL);
@@ -137,6 +156,270 @@
g_free(rd);
}
+static void set_rf_power_status_cb(struct ril_msg *message, gpointer user_data)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ril_thermal_management *tm = user_data;
+ struct ril_data *rd = ofono_modem_get_data(tm->modem);
+ const char *path = ofono_modem_get_path(tm->modem);
+
+ DBG("");
+
+ if (message->error != RIL_E_SUCCESS) {
+ ofono_error("%s RILD reply failure: %s",
+ g_ril_request_id_to_string(rd->ril, message->req),
+ ril_error_to_string(message->error));
+
+ __ofono_dbus_pending_reply(&tm->pending,
+ __ofono_error_failed(tm->pending));
+ return;
+ }
+
+ /* Change the throttling state */
+ tm->throttling = tm->throttling ? false : true;
+
+ __ofono_dbus_pending_reply(&tm->pending,
+ dbus_message_new_method_return(tm->pending));
+
+ ofono_dbus_signal_property_changed(conn, path,
+ THERMAL_MANAGEMENT_INTERFACE,
+ "TransmitPowerThrottling",
+ DBUS_TYPE_BOOLEAN,
+ &tm->throttling);
+}
+
+static DBusMessage *set_rf_power_status(DBusMessage *msg,
+ dbus_bool_t enable,
+ void *data)
+{
+ struct ril_thermal_management *tm = data;
+ struct ril_data *rd = ofono_modem_get_data(tm->modem);
+ struct parcel rilp;
+
+ int cmd_id;
+ char buf[4];
+
+ DBG("");
+
+ if (tm->pending)
+ return __ofono_error_busy(msg);
+
+ parcel_init(&rilp);
+ parcel_w_int32(&rilp, 2);
+ /* RIL_OEM_HOOK_STRING_SET_RF_POWER_STATUS = 0x000000AC */
+ cmd_id = 0x000000AC;
+ sprintf(buf, "%d", cmd_id);
+ parcel_w_string(&rilp, buf);
+
+ memset(buf, 0, sizeof(buf));
+ sprintf(buf, "%d", enable ? 1 : 0);
+ parcel_w_string(&rilp, buf);
+
+ g_ril_append_print_buf(rd->ril, "{cmd_id=0x%02X,arg=%s}", cmd_id, buf);
+
+ if (g_ril_send(rd->ril, RIL_REQUEST_OEM_HOOK_STRINGS, &rilp,
+ set_rf_power_status_cb, tm, NULL) == 0)
+ return __ofono_error_failed(msg);
+
+ tm->pending = dbus_message_ref(msg);
+
+ return NULL;
+}
+
+static DBusMessage *thermal_management_set_property(DBusConnection *conn,
+ DBusMessage *msg,
+ void *data)
+{
+ struct ril_thermal_management *tm = data;
+ DBusMessageIter iter;
+ DBusMessageIter var;
+ const char *name;
+ dbus_bool_t throttling;
+
+ DBG("");
+
+ if (!ofono_modem_get_online(tm->modem))
+ return __ofono_error_not_available(msg);
+
+ if (!dbus_message_iter_init(msg, &iter))
+ return __ofono_error_invalid_args(msg);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&iter, &name);
+
+ if (!strcmp(name, "TransmitPowerThrottling")) {
+ dbus_message_iter_next(&iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_recurse(&iter, &var);
+
+ if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&var, &throttling);
+
+ if (tm->throttling == throttling)
+ /* Ignore set request if new state == current state */
+ return dbus_message_new_method_return(msg);
+
+ return set_rf_power_status(msg, throttling, tm);
+ }
+
+ return __ofono_error_invalid_args(msg);
+}
+
+static DBusMessage *thermal_management_get_properties(DBusConnection *conn,
+ DBusMessage *msg,
+ void *data)
+{
+ struct ril_thermal_management *tm = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+
+ DBG("");
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ ofono_dbus_dict_append(&dict, "TransmitPowerThrottling",
+ DBUS_TYPE_BOOLEAN,
+ &tm->throttling);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
+static const GDBusMethodTable thermal_management_methods[] = {
+ { GDBUS_METHOD("GetProperties",
+ NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
+ thermal_management_get_properties) },
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/plugins/udevng.c
^
|
@@ -325,11 +325,14 @@
if (g_strcmp0(info->label, "modem") == 0 ||
g_strcmp0(info->interface, "255/1/1") == 0 ||
g_strcmp0(info->interface, "255/2/1") == 0 ||
+ g_strcmp0(info->interface, "255/3/1") == 0 ||
g_strcmp0(info->interface, "255/1/49") == 0) {
mdm = info->devnode;
} else if (g_strcmp0(info->label, "pcui") == 0 ||
g_strcmp0(info->interface, "255/1/2") == 0 ||
g_strcmp0(info->interface, "255/2/2") == 0 ||
+ g_strcmp0(info->interface, "255/2/18") == 0 ||
+ g_strcmp0(info->interface, "255/3/18") == 0 ||
g_strcmp0(info->interface, "255/1/50") == 0) {
pcui = info->devnode;
} else if (g_strcmp0(info->label, "diag") == 0 ||
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/src/handsfree-audio.c
^
|
@@ -203,7 +203,7 @@
send_new_connection(card->path, nsk, card->selected_codec);
close(nsk);
- if (card->driver->sco_connected_hint)
+ if (card->driver && card->driver->sco_connected_hint)
card->driver->sco_connected_hint(card);
return TRUE;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/src/sim.c
^
|
@@ -2511,13 +2511,6 @@
static void sim_free_main_state(struct ofono_sim *sim)
{
- int i;
-
- for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
- sim->pin_retries[i] = -1;
-
- memset(sim->locked_pins, 0, sizeof(sim->locked_pins));
-
if (sim->imsi) {
g_free(sim->imsi);
sim->imsi = NULL;
@@ -2607,31 +2600,50 @@
g_strfreev(locked_pins);
}
-static void sim_query_fac_imsilock_cb(const struct ofono_error *error,
+static void sim_query_fac_pinlock_cb(const struct ofono_error *error,
ofono_bool_t status, void *data)
{
+ struct ofono_sim *sim = data;
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
- return;
+ goto done;
- sim_set_locked_pin(data, OFONO_SIM_PASSWORD_PHSIM_PIN, status);
+ sim_set_locked_pin(data, OFONO_SIM_PASSWORD_SIM_PIN, status);
+
+done:
+ sim_initialize(sim);
}
static void sim_query_fac_networklock_cb(const struct ofono_error *error,
ofono_bool_t status, void *data)
{
+ struct ofono_sim *sim = data;
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
- return;
+ goto done;
sim_set_locked_pin(data, OFONO_SIM_PASSWORD_PHNET_PIN, status);
+
+done:
+ sim->driver->query_facility_lock(sim,
+ OFONO_SIM_PASSWORD_SIM_PIN,
+ sim_query_fac_pinlock_cb, sim);
}
-static void sim_query_fac_pinlock_cb(const struct ofono_error *error,
+static void sim_query_fac_imsilock_cb(const struct ofono_error *error,
ofono_bool_t status, void *data)
{
+ struct ofono_sim *sim = data;
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
- return;
+ goto done;
- sim_set_locked_pin(data, OFONO_SIM_PASSWORD_SIM_PIN, status);
+ sim_set_locked_pin(data, OFONO_SIM_PASSWORD_PHSIM_PIN, status);
+
+done:
+ sim->driver->query_facility_lock(sim,
+ OFONO_SIM_PASSWORD_PHNET_PIN,
+ sim_query_fac_networklock_cb, sim);
}
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
@@ -2665,18 +2677,28 @@
OFONO_SIM_PASSWORD_PHSIM_PIN,
sim_query_fac_imsilock_cb, sim);
- sim->driver->query_facility_lock(sim,
- OFONO_SIM_PASSWORD_PHNET_PIN,
- sim_query_fac_networklock_cb, sim);
-
- sim->driver->query_facility_lock(sim,
- OFONO_SIM_PASSWORD_SIM_PIN,
- sim_query_fac_pinlock_cb, sim);
+ } else {
+ sim_initialize(sim);
}
-
- sim_initialize(sim);
} else {
- sim->pin_type = OFONO_SIM_PASSWORD_NONE;
+ switch (sim->pin_type) {
+ case OFONO_SIM_PASSWORD_SIM_PIN:
+ case OFONO_SIM_PASSWORD_SIM_PUK:
+ case OFONO_SIM_PASSWORD_SIM_PIN2:
+ case OFONO_SIM_PASSWORD_SIM_PUK2:
+ sim->pin_type = OFONO_SIM_PASSWORD_NONE;
+ break;
+ default:
+ break;
+ }
+
+ sim->locked_pins[OFONO_SIM_PASSWORD_SIM_PIN] = FALSE;
+ sim->locked_pins[OFONO_SIM_PASSWORD_SIM_PIN2] = FALSE;
+
+ sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PIN] = -1;
+ sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PUK] = -1;
+ sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PIN2] = -1;
+ sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PUK2] = -1;
sim_free_state(sim);
}
@@ -3282,8 +3304,6 @@
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;
}
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/test/cancel-sms
^
|
@@ -0,0 +1,15 @@
+#!/usr/bin/python3
+
+import sys
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+
+path = sys.argv[1]
+message = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.Message')
+
+message.Cancel()
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/test/disable-throttling
^
|
@@ -0,0 +1,18 @@
+#!/usr/bin/python3
+
+import dbus, sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+ path = sys.argv[1]
+else:
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+ modems = manager.GetModems()
+ path = modems[0][0]
+
+print("Disabling transmit power throttling of modem %s ..." % path)
+thermal_management = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.sofia3gr.ThermalManagement')
+thermal_management.SetProperty("TransmitPowerThrottling", dbus.Boolean(0), timeout = 30)
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/test/enable-throttling
^
|
@@ -0,0 +1,18 @@
+#!/usr/bin/python3
+
+import dbus, sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+ path = sys.argv[1]
+else:
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+ modems = manager.GetModems()
+ path = modems[0][0]
+
+print("Enabling transmit power throttling of modem %s ..." % path)
+thermal_management = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.sofia3gr.ThermalManagement')
+thermal_management.SetProperty("TransmitPowerThrottling", dbus.Boolean(1), timeout = 30)
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/unit/rilmodem-test-engine.c
^
|
@@ -0,0 +1,280 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2016 Canonical 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 <stdio.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+#include <ofono/types.h>
+
+#include <gril.h>
+
+#include "rilmodem-test-engine.h"
+
+#define MAX_REQUEST_SIZE 4096
+#define RIL_SERVER_SOCK_PATH "/tmp/unittestril"
+
+static GMainLoop *mainloop;
+
+struct engine_data {
+ int server_sk;
+ int connected_sk;
+ guint connection_watch;
+ rilmodem_test_engine_cb_t connect_func;
+ GIOChannel *server_io;
+ char *sock_name;
+ struct rilmodem_test_data rtd;
+ int step_i;
+ void *user_data;
+};
+
+static void send_parcel(struct engine_data *ed)
+{
+ GIOStatus status;
+ gsize wbytes;
+ const struct rilmodem_test_step *step = &ed->rtd.steps[ed->step_i];
+
+ status = g_io_channel_write_chars(ed->server_io,
+ step->parcel_data,
+ step->parcel_size,
+ &wbytes, NULL);
+
+ g_assert(wbytes == step->parcel_size);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ status = g_io_channel_flush(ed->server_io, NULL);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ rilmodem_test_engine_next_step(ed);
+}
+
+static gboolean on_rx_data(GIOChannel *chan, GIOCondition cond, gpointer data)
+{
+ struct engine_data *ed = data;
+ GIOStatus status;
+ gsize rbytes;
+ gchar *buf;
+ const struct rilmodem_test_step *step;
+
+ /* We have closed the socket */
+ if (cond == G_IO_NVAL)
+ return FALSE;
+
+ buf = g_malloc0(MAX_REQUEST_SIZE);
+
+ status = g_io_channel_read_chars(ed->server_io, buf, MAX_REQUEST_SIZE,
+ &rbytes, NULL);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ /* Check this is the expected step */
+ step = &ed->rtd.steps[ed->step_i];
+ g_assert(step->type == TST_EVENT_RECEIVE);
+
+ g_assert(rbytes == step->parcel_size);
+
+ /* validate received parcel */
+ g_assert(!memcmp(buf, step->parcel_data, rbytes));
+
+ rilmodem_test_engine_next_step(ed);
+
+ return TRUE;
+}
+
+static gboolean on_socket_connected(GIOChannel *chan, GIOCondition cond,
+ gpointer data)
+{
+ struct engine_data *ed = data;
+ struct sockaddr saddr;
+ unsigned int len = sizeof(saddr);
+ GIOStatus status;
+
+ g_assert(cond == G_IO_IN);
+
+ ed->connected_sk = accept(ed->server_sk, &saddr, &len);
+ g_assert(ed->connected_sk != -1);
+
+ ed->server_io = g_io_channel_unix_new(ed->connected_sk);
+ g_assert(ed->server_io != NULL);
+
+ status = g_io_channel_set_encoding(ed->server_io, NULL, NULL);
+ g_assert(status == G_IO_STATUS_NORMAL);
+
+ g_io_channel_set_buffered(ed->server_io, FALSE);
+ g_io_channel_set_close_on_unref(ed->server_io, TRUE);
+
+ if (ed->connect_func)
+ ed->connect_func(ed->user_data);
+
+ ed->connection_watch =
+ g_io_add_watch_full(ed->server_io, G_PRIORITY_DEFAULT,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ on_rx_data, ed, NULL);
+ g_io_channel_unref(ed->server_io);
+
+ return FALSE;
+}
+
+void rilmodem_test_engine_remove(struct engine_data *ed)
+{
+ if (ed->connection_watch)
+ g_source_remove(ed->connection_watch);
+
+ g_assert(ed->server_sk);
+ close(ed->server_sk);
+ remove(ed->sock_name);
+ g_free(ed->sock_name);
+ g_free(ed);
+}
+
+struct engine_data *rilmodem_test_engine_create(
+ rilmodem_test_engine_cb_t connect,
+ const struct rilmodem_test_data *test_data,
+ void *data)
+{
+ GIOChannel *io;
+ struct sockaddr_un addr;
+ int retval;
+ struct engine_data *ed;
+
+ ed = g_new0(struct engine_data, 1);
+
+ ed->connect_func = connect;
+ ed->user_data = data;
+ ed->rtd = *test_data;
+
+ ed->server_sk = socket(AF_UNIX, SOCK_STREAM, 0);
+ g_assert(ed->server_sk);
+
+ ed->sock_name =
+ g_strdup_printf(RIL_SERVER_SOCK_PATH"%u", (unsigned) getpid());
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, ed->sock_name, sizeof(addr.sun_path) - 1);
+
+ /* Unlink any existing socket for this session */
+ unlink(addr.sun_path);
+
+ retval = bind(ed->server_sk, (struct sockaddr *) &addr, sizeof(addr));
+ g_assert(retval >= 0);
+
+ retval = listen(ed->server_sk, 0);
+ g_assert(retval >= 0);
+
+ io = g_io_channel_unix_new(ed->server_sk);
+ g_assert(io != NULL);
+
+ g_io_channel_set_close_on_unref(io, TRUE);
+ g_io_add_watch_full(io, G_PRIORITY_DEFAULT,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ on_socket_connected, ed, NULL);
+
+ g_io_channel_unref(io);
+
+ return ed;
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/unit/rilmodem-test-engine.h
^
|
@@ -0,0 +1,74 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2016 Canonical 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
+ *
+ */
+
+struct engine_data;
+
+enum test_step_type {
+ TST_ACTION_SEND,
+ TST_ACTION_CALL,
+ TST_EVENT_RECEIVE,
+ TST_EVENT_CALL,
+};
+
+typedef void (*rilmodem_test_engine_cb_t)(void *data);
+
+struct rilmodem_test_step {
+ enum test_step_type type;
+
+ union {
+ /* For TST_ACTION_CALL */
+ rilmodem_test_engine_cb_t call_action;
+ /* For TST_ACTION_SEND or TST_EVENT_RECEIVE */
+ struct {
+ const char *parcel_data;
+ const size_t parcel_size;
+ };
+ /* For TST_EVENT_CALL */
+ struct {
+ void (*call_func)(void);
+ void (*check_func)(void);
+ };
+ };
+};
+
+struct rilmodem_test_data {
+ const struct rilmodem_test_step *steps;
+ int num_steps;
+};
+
+void rilmodem_test_engine_remove(struct engine_data *ed);
+
+struct engine_data *rilmodem_test_engine_create(
+ rilmodem_test_engine_cb_t connect,
+ const struct rilmodem_test_data *test_data,
+ void *data);
+
+void rilmodem_test_engine_write_socket(struct engine_data *ed,
+ const unsigned char *buf,
+ const size_t buf_len);
+
+const char *rilmodem_test_engine_get_socket_name(struct engine_data *ed);
+
+void rilmodem_test_engine_next_step(struct engine_data *ed);
+const struct rilmodem_test_step *rilmodem_test_engine_get_current_step(
+ struct engine_data *ed);
+
+void rilmodem_test_engine_start(struct engine_data *ed);
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.19+git1.tar.bz2/ofono/unit/test-rilmodem-gprs.c
^
|
@@ -0,0 +1,750 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2016 Canonical 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 <assert.h>
+#include <errno.h>
+#include <glib.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+#include <ofono/modem.h>
+#include <ofono/types.h>
+#include <ofono/gprs.h>
+#include <gril.h>
+#include <drivers/rilmodem/rilutil.h>
+
+#include "common.h"
+#include "ril_constants.h"
+#include "rilmodem-test-engine.h"
+
+static const struct ofono_gprs_driver *gprs_drv;
+
+/* Declarations && Re-implementations of core functions. */
+void ril_gprs_exit(void);
+void ril_gprs_init(void);
+
+struct ofono_modem;
+
+struct ofono_gprs {
+ void *driver_data;
+ GRil *ril;
+ struct ofono_modem *modem;
+ struct engine_data *engined;
+};
+
+struct ofono_modem {
+ struct ofono_gprs *gprs;
+};
+
+int ofono_gprs_driver_register(const struct ofono_gprs_driver *d)
+{
+ if (gprs_drv == NULL)
+ gprs_drv = d;
+
+ return 0;
+}
+
+void ofono_gprs_driver_unregister(const struct ofono_gprs_driver *d)
+{
+ gprs_drv = NULL;
+}
+
+void ofono_gprs_register(struct ofono_gprs *gprs)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_register);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_set_data(struct ofono_gprs *gprs, void *data)
+{
+ gprs->driver_data = data;
+}
+
+void *ofono_gprs_get_data(struct ofono_gprs *gprs)
+{
+ return gprs->driver_data;
+}
+
+void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_status_notify);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_gprs *, int)) step->check_func)(
+ gprs, status);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func ==
+ (void (*)(void)) ofono_gprs_detached_notify);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_bearer_notify(struct ofono_gprs *gprs, int bearer)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_bearer_notify);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_gprs *, int)) step->check_func)(
+ gprs, bearer);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
+ unsigned int min, unsigned int max)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_set_cid_range);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_gprs *, unsigned int, unsigned int))
+ step->check_func)(gprs, min, max);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+struct ofono_modem *ofono_gprs_get_modem(struct ofono_gprs *gprs)
+{
+ return gprs->modem;
+}
+
+int ofono_modem_set_integer(struct ofono_modem *modem,
+ const char *key, int value)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(modem->gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_modem_set_integer);
+
+ if (step->check_func != NULL)
+ ((void (*)(struct ofono_modem *, const char *, int))
+ step->check_func)(modem, key, value);
+
+ rilmodem_test_engine_next_step(modem->gprs->engined);
+
+ return 0;
+}
+
+void ofono_gprs_remove(struct ofono_gprs *gprs)
+{
+ const struct rilmodem_test_step *step;
+
+ step = rilmodem_test_engine_get_current_step(gprs->engined);
+
+ g_assert(step->type == TST_EVENT_CALL);
+ g_assert(step->call_func == (void (*)(void)) ofono_gprs_remove);
+
+ rilmodem_test_engine_next_step(gprs->engined);
+}
+
+/*
+ * As all our architectures are little-endian except for
|