mirror of
https://github.com/sailfishos/ofono
synced 2025-11-24 03:19:44 +08:00
Compare commits
21 Commits
mer/1.23+g
...
mer/1.23+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f56c8a33b0 | ||
|
|
ed2f625b8b | ||
|
|
ed62d38632 | ||
|
|
3f433c97c5 | ||
|
|
86d8149c79 | ||
|
|
f3eb9b868b | ||
|
|
4e067fa827 | ||
|
|
2ee5e4c827 | ||
|
|
1366e426be | ||
|
|
586c9b9262 | ||
|
|
83554e071a | ||
|
|
dc41c2d003 | ||
|
|
550d41ae37 | ||
|
|
60e4246d93 | ||
|
|
50619607b0 | ||
|
|
98b357f365 | ||
|
|
56c488d10c | ||
|
|
944cd603e8 | ||
|
|
77be0d5e98 | ||
|
|
d8dd20092c | ||
|
|
c7faa21172 |
@@ -24,6 +24,7 @@ struct ril_cbs {
|
|||||||
GRilIoChannel *io;
|
GRilIoChannel *io;
|
||||||
GRilIoQueue *q;
|
GRilIoQueue *q;
|
||||||
char *log_prefix;
|
char *log_prefix;
|
||||||
|
guint register_id;
|
||||||
gulong event_id;
|
gulong event_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,6 +52,12 @@ static struct ril_cbs_cbd *ril_cbs_cbd_new(struct ril_cbs *cd,
|
|||||||
return cbd;
|
return cbd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean ril_cbs_retry(GRilIoRequest *request, int ril_status,
|
||||||
|
const void *resp_data, guint resp_len, void *user_data)
|
||||||
|
{
|
||||||
|
return ril_status == RIL_E_INVALID_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
static void ril_cbs_request_activation(struct ril_cbs *cd,
|
static void ril_cbs_request_activation(struct ril_cbs *cd,
|
||||||
gboolean activate, GRilIoChannelResponseFunc response,
|
gboolean activate, GRilIoChannelResponseFunc response,
|
||||||
GDestroyNotify destroy, void* user_data)
|
GDestroyNotify destroy, void* user_data)
|
||||||
@@ -61,6 +68,9 @@ static void ril_cbs_request_activation(struct ril_cbs *cd,
|
|||||||
grilio_request_append_int32(req, activate ? 0 :1);
|
grilio_request_append_int32(req, activate ? 0 :1);
|
||||||
|
|
||||||
DBG_(cd, "%sactivating CB", activate ? "" : "de");
|
DBG_(cd, "%sactivating CB", activate ? "" : "de");
|
||||||
|
grilio_request_set_retry_func(req, ril_cbs_retry);
|
||||||
|
grilio_request_set_retry(req, RIL_CBS_CHECK_RETRY_MS,
|
||||||
|
RIL_CBS_CHECK_RETRY_COUNT);
|
||||||
grilio_queue_send_request_full(cd->q, req,
|
grilio_queue_send_request_full(cd->q, req,
|
||||||
RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION,
|
RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION,
|
||||||
response, destroy, user_data);
|
response, destroy, user_data);
|
||||||
@@ -97,6 +107,9 @@ static void ril_cbs_set_config(struct ril_cbs *cd, const char *topics,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBG_(cd, "configuring CB");
|
DBG_(cd, "configuring CB");
|
||||||
|
grilio_request_set_retry_func(req, ril_cbs_retry);
|
||||||
|
grilio_request_set_retry(req, RIL_CBS_CHECK_RETRY_MS,
|
||||||
|
RIL_CBS_CHECK_RETRY_COUNT);
|
||||||
grilio_queue_send_request_full(cd->q, req,
|
grilio_queue_send_request_full(cd->q, req,
|
||||||
RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG,
|
RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG,
|
||||||
response, destroy, user_data);
|
response, destroy, user_data);
|
||||||
@@ -152,28 +165,33 @@ static void ril_cbs_notify(GRilIoChannel *io, guint code,
|
|||||||
if (grilio_parser_get_uint32(&rilp, &pdu_len)) {
|
if (grilio_parser_get_uint32(&rilp, &pdu_len)) {
|
||||||
const void* pdu = grilio_parser_get_bytes(&rilp, pdu_len);
|
const void* pdu = grilio_parser_get_bytes(&rilp, pdu_len);
|
||||||
|
|
||||||
if (pdu) {
|
/*
|
||||||
|
* By default assume that it's a length followed by the
|
||||||
|
* binary PDU data.
|
||||||
|
*/
|
||||||
|
if (pdu && grilio_parser_bytes_remaining(&rilp) < 4) {
|
||||||
DBG_(cd, "%u bytes", pdu_len);
|
DBG_(cd, "%u bytes", pdu_len);
|
||||||
ofono_cbs_notify(cd->cbs, pdu, pdu_len);
|
ofono_cbs_notify(cd->cbs, pdu, pdu_len);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* But I've seen cell broadcasts arriving without
|
||||||
|
* the length, simply as a blob.
|
||||||
|
*/
|
||||||
|
ofono_cbs_notify(cd->cbs, data, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_cbs_probe_done_cb(GRilIoChannel *io, int status,
|
static gboolean ril_cbs_register(void *user_data)
|
||||||
const void *data, guint len, void *user_data)
|
|
||||||
{
|
{
|
||||||
struct ril_cbs *cd = user_data;
|
struct ril_cbs *cd = user_data;
|
||||||
|
|
||||||
if (status == RIL_E_SUCCESS) {
|
|
||||||
DBG_(cd, "registering for CB");
|
DBG_(cd, "registering for CB");
|
||||||
|
cd->register_id = 0;
|
||||||
cd->event_id = grilio_channel_add_unsol_event_handler(cd->io,
|
cd->event_id = grilio_channel_add_unsol_event_handler(cd->io,
|
||||||
ril_cbs_notify, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS,
|
ril_cbs_notify, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, cd);
|
||||||
cd);
|
|
||||||
ofono_cbs_register(cd->cbs);
|
ofono_cbs_register(cd->cbs);
|
||||||
} else {
|
return G_SOURCE_REMOVE;
|
||||||
DBG_(cd, "failed to query CB config");
|
|
||||||
ofono_cbs_remove(cd->cbs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
||||||
@@ -181,7 +199,6 @@ static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
|||||||
{
|
{
|
||||||
struct ril_modem *modem = data;
|
struct ril_modem *modem = data;
|
||||||
struct ril_cbs *cd = g_try_new0(struct ril_cbs, 1);
|
struct ril_cbs *cd = g_try_new0(struct ril_cbs, 1);
|
||||||
GRilIoRequest* req = grilio_request_new();
|
|
||||||
|
|
||||||
ofono_cbs_set_data(cbs, cd);
|
ofono_cbs_set_data(cbs, cd);
|
||||||
cd->log_prefix = (modem->log_prefix && modem->log_prefix[0]) ?
|
cd->log_prefix = (modem->log_prefix && modem->log_prefix[0]) ?
|
||||||
@@ -191,20 +208,7 @@ static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
|||||||
DBG_(cd, "");
|
DBG_(cd, "");
|
||||||
cd->io = grilio_channel_ref(ril_modem_io(modem));
|
cd->io = grilio_channel_ref(ril_modem_io(modem));
|
||||||
cd->q = grilio_queue_new(cd->io);
|
cd->q = grilio_queue_new(cd->io);
|
||||||
|
cd->register_id = g_idle_add(ril_cbs_register, cd);
|
||||||
/*
|
|
||||||
* RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG often fails at startup
|
|
||||||
* especially if other RIL requests are running in parallel. We may
|
|
||||||
* have to retry a few times. Also, make it blocking in order to
|
|
||||||
* improve the chance of success.
|
|
||||||
*/
|
|
||||||
grilio_request_set_retry(req, RIL_CBS_CHECK_RETRY_MS,
|
|
||||||
RIL_CBS_CHECK_RETRY_COUNT);
|
|
||||||
grilio_request_set_blocking(req, TRUE);
|
|
||||||
grilio_queue_send_request_full(cd->q, req,
|
|
||||||
RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG,
|
|
||||||
ril_cbs_probe_done_cb, NULL, cd);
|
|
||||||
grilio_request_unref(req);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +217,9 @@ static void ril_cbs_remove(struct ofono_cbs *cbs)
|
|||||||
struct ril_cbs *cd = ofono_cbs_get_data(cbs);
|
struct ril_cbs *cd = ofono_cbs_get_data(cbs);
|
||||||
|
|
||||||
DBG_(cd, "");
|
DBG_(cd, "");
|
||||||
|
if (cd->register_id) {
|
||||||
|
g_source_remove(cd->register_id);
|
||||||
|
}
|
||||||
ofono_cbs_set_data(cbs, NULL);
|
ofono_cbs_set_data(cbs, NULL);
|
||||||
grilio_channel_remove_handler(cd->io, cd->event_id);
|
grilio_channel_remove_handler(cd->io, cd->event_id);
|
||||||
grilio_channel_unref(cd->io);
|
grilio_channel_unref(cd->io);
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ static void ril_cell_info_query(struct ril_cell_info *self)
|
|||||||
static void ril_cell_info_set_rate(struct ril_cell_info *self)
|
static void ril_cell_info_set_rate(struct ril_cell_info *self)
|
||||||
{
|
{
|
||||||
GRilIoRequest *req = grilio_request_array_int32_new(1,
|
GRilIoRequest *req = grilio_request_array_int32_new(1,
|
||||||
(self->update_rate_ms > 0) ? self->update_rate_ms : INT_MAX);
|
(self->update_rate_ms >= 0) ? self->update_rate_ms : INT_MAX);
|
||||||
|
|
||||||
grilio_request_set_retry(req, RIL_RETRY_MS, MAX_RETRIES);
|
grilio_request_set_retry(req, RIL_RETRY_MS, MAX_RETRIES);
|
||||||
grilio_request_set_retry_func(req, ril_cell_info_retry);
|
grilio_request_set_retry_func(req, ril_cell_info_retry);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2020 Jolla Ltd.
|
* Copyright (C) 2016-2020 Jolla Ltd.
|
||||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -81,6 +81,7 @@ typedef struct ril_data RilData;
|
|||||||
enum ril_data_io_event_id {
|
enum ril_data_io_event_id {
|
||||||
IO_EVENT_DATA_CALL_LIST_CHANGED,
|
IO_EVENT_DATA_CALL_LIST_CHANGED,
|
||||||
IO_EVENT_RESTRICTED_STATE_CHANGED,
|
IO_EVENT_RESTRICTED_STATE_CHANGED,
|
||||||
|
IO_EVENT_EOF,
|
||||||
IO_EVENT_COUNT
|
IO_EVENT_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -192,6 +193,7 @@ struct ril_data_request_allow_data {
|
|||||||
|
|
||||||
static void ril_data_manager_check_network_mode(struct ril_data_manager *dm);
|
static void ril_data_manager_check_network_mode(struct ril_data_manager *dm);
|
||||||
static void ril_data_call_deact_cid(struct ril_data *data, int cid);
|
static void ril_data_call_deact_cid(struct ril_data *data, int cid);
|
||||||
|
static void ril_data_cancel_all_requests(struct ril_data *self);
|
||||||
static void ril_data_power_update(struct ril_data *self);
|
static void ril_data_power_update(struct ril_data *self);
|
||||||
static void ril_data_signal_emit(struct ril_data *self, enum ril_data_signal id)
|
static void ril_data_signal_emit(struct ril_data *self, enum ril_data_signal id)
|
||||||
{
|
{
|
||||||
@@ -1230,6 +1232,17 @@ static void ril_data_settings_changed(struct ril_sim_settings *settings,
|
|||||||
ril_data_manager_check_network_mode(RIL_DATA(user_data)->priv->dm);
|
ril_data_manager_check_network_mode(RIL_DATA(user_data)->priv->dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_data_ril_disconnected_cb(GRilIoChannel *io, void *user_data)
|
||||||
|
{
|
||||||
|
struct ril_data *self = RIL_DATA(user_data);
|
||||||
|
struct ril_data_priv *priv = self->priv;
|
||||||
|
|
||||||
|
DBG_(self, "disconnected");
|
||||||
|
priv->flags = RIL_DATA_FLAG_NONE;
|
||||||
|
priv->restricted_state = 0;
|
||||||
|
ril_data_cancel_all_requests(self);
|
||||||
|
}
|
||||||
|
|
||||||
static gint ril_data_compare_cb(gconstpointer a, gconstpointer b)
|
static gint ril_data_compare_cb(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const struct ril_data *d1 = a;
|
const struct ril_data *d1 = a;
|
||||||
@@ -1289,6 +1302,9 @@ struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
|
|||||||
grilio_channel_add_unsol_event_handler(io,
|
grilio_channel_add_unsol_event_handler(io,
|
||||||
ril_data_restricted_state_changed_cb,
|
ril_data_restricted_state_changed_cb,
|
||||||
RIL_UNSOL_RESTRICTED_STATE_CHANGED, self);
|
RIL_UNSOL_RESTRICTED_STATE_CHANGED, self);
|
||||||
|
priv->io_event_id[IO_EVENT_EOF] =
|
||||||
|
grilio_channel_add_disconnected_handler(io,
|
||||||
|
ril_data_ril_disconnected_cb, self);
|
||||||
|
|
||||||
priv->settings_event_id[SETTINGS_EVENT_IMSI_CHANGED] =
|
priv->settings_event_id[SETTINGS_EVENT_IMSI_CHANGED] =
|
||||||
ril_sim_settings_add_imsi_changed_handler(settings,
|
ril_sim_settings_add_imsi_changed_handler(settings,
|
||||||
@@ -1415,6 +1431,20 @@ static void ril_data_cancel_requests(struct ril_data *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_data_cancel_all_requests(struct ril_data *self)
|
||||||
|
{
|
||||||
|
struct ril_data_priv *priv = self->priv;
|
||||||
|
struct ril_data_request *req = priv->req_queue;
|
||||||
|
|
||||||
|
ril_data_request_do_cancel(priv->pending_req);
|
||||||
|
while (req) {
|
||||||
|
struct ril_data_request *next = req->next;
|
||||||
|
|
||||||
|
ril_data_request_do_cancel(req);
|
||||||
|
req = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ril_data_disallow(struct ril_data *self)
|
static void ril_data_disallow(struct ril_data *self)
|
||||||
{
|
{
|
||||||
struct ril_data_priv *priv = self->priv;
|
struct ril_data_priv *priv = self->priv;
|
||||||
@@ -1586,24 +1616,11 @@ static void ril_data_dispose(GObject *object)
|
|||||||
struct ril_data *self = RIL_DATA(object);
|
struct ril_data *self = RIL_DATA(object);
|
||||||
struct ril_data_priv *priv = self->priv;
|
struct ril_data_priv *priv = self->priv;
|
||||||
struct ril_data_manager *dm = priv->dm;
|
struct ril_data_manager *dm = priv->dm;
|
||||||
struct ril_network *network = priv->network;
|
|
||||||
struct ril_sim_settings *settings = network->settings;
|
|
||||||
struct ril_data_request *req;
|
|
||||||
|
|
||||||
ril_sim_settings_remove_handlers(settings, priv->settings_event_id,
|
|
||||||
G_N_ELEMENTS(priv->settings_event_id));
|
|
||||||
grilio_channel_remove_all_handlers(priv->io, priv->io_event_id);
|
|
||||||
grilio_queue_cancel_all(priv->q, FALSE);
|
grilio_queue_cancel_all(priv->q, FALSE);
|
||||||
priv->query_id = 0;
|
priv->query_id = 0;
|
||||||
|
|
||||||
ril_data_request_do_cancel(priv->pending_req);
|
ril_data_cancel_all_requests(self);
|
||||||
req = priv->req_queue;
|
|
||||||
while (req) {
|
|
||||||
struct ril_data_request *next = req->next;
|
|
||||||
ril_data_request_do_cancel(req);
|
|
||||||
req = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
dm->data_list = g_slist_remove(dm->data_list, self);
|
dm->data_list = g_slist_remove(dm->data_list, self);
|
||||||
ril_data_manager_check_data(dm);
|
ril_data_manager_check_data(dm);
|
||||||
g_hash_table_destroy(priv->grab);
|
g_hash_table_destroy(priv->grab);
|
||||||
@@ -1614,6 +1631,11 @@ static void ril_data_finalize(GObject *object)
|
|||||||
{
|
{
|
||||||
struct ril_data *self = RIL_DATA(object);
|
struct ril_data *self = RIL_DATA(object);
|
||||||
struct ril_data_priv *priv = self->priv;
|
struct ril_data_priv *priv = self->priv;
|
||||||
|
struct ril_network *network = priv->network;
|
||||||
|
struct ril_sim_settings *settings = network->settings;
|
||||||
|
|
||||||
|
ril_sim_settings_remove_all_handlers(settings, priv->settings_event_id);
|
||||||
|
grilio_channel_remove_all_handlers(priv->io, priv->io_event_id);
|
||||||
|
|
||||||
g_free(priv->log_prefix);
|
g_free(priv->log_prefix);
|
||||||
grilio_queue_unref(priv->q);
|
grilio_queue_unref(priv->q);
|
||||||
@@ -1699,34 +1721,39 @@ static void ril_data_manager_check_network_mode(struct ril_data_manager *self)
|
|||||||
|
|
||||||
if ((self->flags & RIL_DATA_MANAGER_FORCE_GSM_ON_OTHER_SLOTS) &&
|
if ((self->flags & RIL_DATA_MANAGER_FORCE_GSM_ON_OTHER_SLOTS) &&
|
||||||
ril_data_manager_handover(self)) {
|
ril_data_manager_handover(self)) {
|
||||||
struct ril_network *lte_network = NULL;
|
struct ril_network *lte_network = NULL, *best_network = NULL;
|
||||||
int non_gsm_count = 0;
|
enum ofono_radio_access_mode best_mode =
|
||||||
|
OFONO_RADIO_ACCESS_MODE_ANY;
|
||||||
|
|
||||||
/*
|
/* Find a SIM for internet access */
|
||||||
* Count number of SIMs for which non-GSM mode is selected
|
|
||||||
*/
|
|
||||||
for (l= self->data_list; l; l = l->next) {
|
for (l= self->data_list; l; l = l->next) {
|
||||||
struct ril_data *data = l->data;
|
struct ril_data *data = l->data;
|
||||||
struct ril_data_priv *priv = data->priv;
|
struct ril_data_priv *priv = data->priv;
|
||||||
struct ril_network *network = priv->network;
|
struct ril_network *network = priv->network;
|
||||||
struct ril_sim_settings *sim = network->settings;
|
struct ril_sim_settings *sim = network->settings;
|
||||||
|
enum ofono_radio_access_mode mode;
|
||||||
|
|
||||||
if (sim->pref_mode != OFONO_RADIO_ACCESS_MODE_GSM) {
|
/* Select the first network with internet role */
|
||||||
non_gsm_count++;
|
if ((sim->pref_mode != OFONO_RADIO_ACCESS_MODE_GSM) &&
|
||||||
if ((priv->flags & RIL_DATA_FLAG_MAX_SPEED) &&
|
(priv->flags & RIL_DATA_FLAG_MAX_SPEED)) {
|
||||||
!lte_network) {
|
|
||||||
lte_network = network;
|
lte_network = network;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* At the same time, look for a suitable slot */
|
||||||
|
mode = ril_network_max_supported_mode(network);
|
||||||
|
if (mode > best_mode) {
|
||||||
|
best_network = network;
|
||||||
|
best_mode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there's no SIM selected for internet access
|
* If there's no SIM selected for internet access
|
||||||
* then choose the first slot for LTE.
|
* then use a slot with highest capabilities for LTE.
|
||||||
*/
|
*/
|
||||||
if (!lte_network) {
|
if (!lte_network) {
|
||||||
struct ril_data *data = self->data_list->data;
|
lte_network = best_network;
|
||||||
lte_network = data->priv->network;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l= self->data_list; l; l = l->next) {
|
for (l= self->data_list; l; l = l->next) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2019 Jolla Ltd.
|
* Copyright (C) 2016-2020 Jolla Ltd.
|
||||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
* Copyright (C) 2019 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -79,12 +79,6 @@ struct ril_data_options {
|
|||||||
unsigned int data_call_retry_delay_ms;
|
unsigned int data_call_retry_delay_ms;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ril_data_role {
|
|
||||||
RIL_DATA_ROLE_NONE, /* Data not allowed */
|
|
||||||
RIL_DATA_ROLE_MMS, /* Data is allowed at any speed */
|
|
||||||
RIL_DATA_ROLE_INTERNET /* Data is allowed at full speed */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ril_data_manager;
|
struct ril_data_manager;
|
||||||
struct ril_data_manager *ril_data_manager_new(enum ril_data_manager_flags flg);
|
struct ril_data_manager *ril_data_manager_new(enum ril_data_manager_flags flg);
|
||||||
struct ril_data_manager *ril_data_manager_ref(struct ril_data_manager *dm);
|
struct ril_data_manager *ril_data_manager_ref(struct ril_data_manager *dm);
|
||||||
|
|||||||
@@ -34,33 +34,29 @@ struct ril_devmon {
|
|||||||
GRilIoChannel *channel, struct sailfish_cell_info *cell_info);
|
GRilIoChannel *channel, struct sailfish_cell_info *cell_info);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Cell info update intervals */
|
|
||||||
#define RIL_CELL_INFO_INTERVAL_SHORT_MS (2000) /* 2 sec */
|
|
||||||
#define RIL_CELL_INFO_INTERVAL_LONG_MS (30000) /* 30 sec */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Legacy Device Monitor uses RIL_REQUEST_SCREEN_STATE to tell
|
* Legacy Device Monitor uses RIL_REQUEST_SCREEN_STATE to tell
|
||||||
* the modem when screen turns on and off.
|
* the modem when screen turns on and off.
|
||||||
*/
|
*/
|
||||||
struct ril_devmon *ril_devmon_ss_new(void);
|
struct ril_devmon *ril_devmon_ss_new(const struct ril_slot_config *config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This Device Monitor uses RIL_REQUEST_SEND_DEVICE_STATE to let
|
* This Device Monitor uses RIL_REQUEST_SEND_DEVICE_STATE to let
|
||||||
* the modem choose the right power saving strategy. It basically
|
* the modem choose the right power saving strategy. It basically
|
||||||
* mirrors the logic of Android's DeviceStateMonitor class.
|
* mirrors the logic of Android's DeviceStateMonitor class.
|
||||||
*/
|
*/
|
||||||
struct ril_devmon *ril_devmon_ds_new(void);
|
struct ril_devmon *ril_devmon_ds_new(const struct ril_slot_config *config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This Device Monitor implementation controls network state updates
|
* This Device Monitor implementation controls network state updates
|
||||||
* by sending SET_UNSOLICITED_RESPONSE_FILTER.
|
* by sending SET_UNSOLICITED_RESPONSE_FILTER.
|
||||||
*/
|
*/
|
||||||
struct ril_devmon *ril_devmon_ur_new(void);
|
struct ril_devmon *ril_devmon_ur_new(const struct ril_slot_config *config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This one selects the type based on the RIL version.
|
* This one selects the type based on the RIL version.
|
||||||
*/
|
*/
|
||||||
struct ril_devmon *ril_devmon_auto_new(void);
|
struct ril_devmon *ril_devmon_auto_new(const struct ril_slot_config *config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This one combines several methods. Takes ownership of ril_devmon objects.
|
* This one combines several methods. Takes ownership of ril_devmon objects.
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static void ril_devmon_auto_free(struct ril_devmon *devmon)
|
|||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ril_devmon *ril_devmon_auto_new()
|
struct ril_devmon *ril_devmon_auto_new(const struct ril_slot_config *config)
|
||||||
{
|
{
|
||||||
DevMon *self = g_new0(DevMon, 1);
|
DevMon *self = g_new0(DevMon, 1);
|
||||||
|
|
||||||
@@ -78,8 +78,8 @@ struct ril_devmon *ril_devmon_auto_new()
|
|||||||
*/
|
*/
|
||||||
self->pub.free = ril_devmon_auto_free;
|
self->pub.free = ril_devmon_auto_free;
|
||||||
self->pub.start_io = ril_devmon_auto_start_io;
|
self->pub.start_io = ril_devmon_auto_start_io;
|
||||||
self->ss = ril_devmon_ss_new();
|
self->ss = ril_devmon_ss_new(config);
|
||||||
self->ds = ril_devmon_ds_new();
|
self->ds = ril_devmon_ds_new(config);
|
||||||
return &self->pub;
|
return &self->pub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ typedef struct ril_devmon_ds {
|
|||||||
MceBattery *battery;
|
MceBattery *battery;
|
||||||
MceCharger *charger;
|
MceCharger *charger;
|
||||||
MceDisplay *display;
|
MceDisplay *display;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
} DevMon;
|
} DevMon;
|
||||||
|
|
||||||
typedef struct ril_devmon_ds_io {
|
typedef struct ril_devmon_ds_io {
|
||||||
@@ -86,6 +88,8 @@ typedef struct ril_devmon_ds_io {
|
|||||||
gulong charger_event_id[CHARGER_EVENT_COUNT];
|
gulong charger_event_id[CHARGER_EVENT_COUNT];
|
||||||
gulong display_event_id[DISPLAY_EVENT_COUNT];
|
gulong display_event_id[DISPLAY_EVENT_COUNT];
|
||||||
guint req_id;
|
guint req_id;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
} DevMonIo;
|
} DevMonIo;
|
||||||
|
|
||||||
#define DBG_(self,fmt,args...) DBG("%s: " fmt, (self)->io->name, ##args)
|
#define DBG_(self,fmt,args...) DBG("%s: " fmt, (self)->io->name, ##args)
|
||||||
@@ -201,8 +205,8 @@ static void ril_devmon_ds_io_set_cell_info_update_interval(DevMonIo *self)
|
|||||||
(ril_devmon_ds_display_on(self->display) &&
|
(ril_devmon_ds_display_on(self->display) &&
|
||||||
(ril_devmon_ds_charging(self->charger) ||
|
(ril_devmon_ds_charging(self->charger) ||
|
||||||
ril_devmon_ds_battery_ok(self->battery))) ?
|
ril_devmon_ds_battery_ok(self->battery))) ?
|
||||||
RIL_CELL_INFO_INTERVAL_SHORT_MS :
|
self->cell_info_interval_short_ms :
|
||||||
RIL_CELL_INFO_INTERVAL_LONG_MS);
|
self->cell_info_interval_long_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_devmon_ds_io_connman_cb(struct ril_connman *connman,
|
static void ril_devmon_ds_io_connman_cb(struct ril_connman *connman,
|
||||||
@@ -303,6 +307,11 @@ static struct ril_devmon_io *ril_devmon_ds_start_io(struct ril_devmon *devmon,
|
|||||||
mce_display_add_state_changed_handler(self->display,
|
mce_display_add_state_changed_handler(self->display,
|
||||||
ril_devmon_ds_io_display_cb, self);
|
ril_devmon_ds_io_display_cb, self);
|
||||||
|
|
||||||
|
self->cell_info_interval_short_ms =
|
||||||
|
ds->cell_info_interval_short_ms;
|
||||||
|
self->cell_info_interval_long_ms =
|
||||||
|
ds->cell_info_interval_long_ms;
|
||||||
|
|
||||||
ril_devmon_ds_io_update_low_data(self);
|
ril_devmon_ds_io_update_low_data(self);
|
||||||
ril_devmon_ds_io_update_charging(self);
|
ril_devmon_ds_io_update_charging(self);
|
||||||
ril_devmon_ds_io_set_cell_info_update_interval(self);
|
ril_devmon_ds_io_set_cell_info_update_interval(self);
|
||||||
@@ -320,7 +329,7 @@ static void ril_devmon_ds_free(struct ril_devmon *devmon)
|
|||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ril_devmon *ril_devmon_ds_new()
|
struct ril_devmon *ril_devmon_ds_new(const struct ril_slot_config *config)
|
||||||
{
|
{
|
||||||
DevMon *self = g_new0(DevMon, 1);
|
DevMon *self = g_new0(DevMon, 1);
|
||||||
|
|
||||||
@@ -330,6 +339,10 @@ struct ril_devmon *ril_devmon_ds_new()
|
|||||||
self->battery = mce_battery_new();
|
self->battery = mce_battery_new();
|
||||||
self->charger = mce_charger_new();
|
self->charger = mce_charger_new();
|
||||||
self->display = mce_display_new();
|
self->display = mce_display_new();
|
||||||
|
self->cell_info_interval_short_ms =
|
||||||
|
config->cell_info_interval_short_ms;
|
||||||
|
self->cell_info_interval_long_ms =
|
||||||
|
config->cell_info_interval_long_ms;
|
||||||
return &self->pub;
|
return &self->pub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ typedef struct ril_devmon_ss {
|
|||||||
MceBattery *battery;
|
MceBattery *battery;
|
||||||
MceCharger *charger;
|
MceCharger *charger;
|
||||||
MceDisplay *display;
|
MceDisplay *display;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
} DevMon;
|
} DevMon;
|
||||||
|
|
||||||
typedef struct ril_devmon_ss_io {
|
typedef struct ril_devmon_ss_io {
|
||||||
@@ -65,6 +67,8 @@ typedef struct ril_devmon_ss_io {
|
|||||||
gulong charger_event_id[CHARGER_EVENT_COUNT];
|
gulong charger_event_id[CHARGER_EVENT_COUNT];
|
||||||
gulong display_event_id[DISPLAY_EVENT_COUNT];
|
gulong display_event_id[DISPLAY_EVENT_COUNT];
|
||||||
guint req_id;
|
guint req_id;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
} DevMonIo;
|
} DevMonIo;
|
||||||
|
|
||||||
inline static DevMon *ril_devmon_ss_cast(struct ril_devmon *pub)
|
inline static DevMon *ril_devmon_ss_cast(struct ril_devmon *pub)
|
||||||
@@ -130,8 +134,8 @@ static void ril_devmon_ss_io_set_cell_info_update_interval(DevMonIo *self)
|
|||||||
sailfish_cell_info_set_update_interval(self->cell_info,
|
sailfish_cell_info_set_update_interval(self->cell_info,
|
||||||
(self->display_on && (ril_devmon_ss_charging(self->charger) ||
|
(self->display_on && (ril_devmon_ss_charging(self->charger) ||
|
||||||
ril_devmon_ss_battery_ok(self->battery))) ?
|
ril_devmon_ss_battery_ok(self->battery))) ?
|
||||||
RIL_CELL_INFO_INTERVAL_SHORT_MS :
|
self->cell_info_interval_short_ms :
|
||||||
RIL_CELL_INFO_INTERVAL_LONG_MS);
|
self->cell_info_interval_long_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_devmon_ss_io_battery_cb(MceBattery *battery, void *user_data)
|
static void ril_devmon_ss_io_battery_cb(MceBattery *battery, void *user_data)
|
||||||
@@ -212,6 +216,11 @@ static struct ril_devmon_io *ril_devmon_ss_start_io(struct ril_devmon *devmon,
|
|||||||
mce_display_add_state_changed_handler(self->display,
|
mce_display_add_state_changed_handler(self->display,
|
||||||
ril_devmon_ss_io_display_cb, self);
|
ril_devmon_ss_io_display_cb, self);
|
||||||
|
|
||||||
|
self->cell_info_interval_short_ms =
|
||||||
|
ss->cell_info_interval_short_ms;
|
||||||
|
self->cell_info_interval_long_ms =
|
||||||
|
ss->cell_info_interval_long_ms;
|
||||||
|
|
||||||
ril_devmon_ss_io_send_screen_state(self);
|
ril_devmon_ss_io_send_screen_state(self);
|
||||||
ril_devmon_ss_io_set_cell_info_update_interval(self);
|
ril_devmon_ss_io_set_cell_info_update_interval(self);
|
||||||
return &self->pub;
|
return &self->pub;
|
||||||
@@ -227,7 +236,7 @@ static void ril_devmon_ss_free(struct ril_devmon *devmon)
|
|||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ril_devmon *ril_devmon_ss_new()
|
struct ril_devmon *ril_devmon_ss_new(const struct ril_slot_config *config)
|
||||||
{
|
{
|
||||||
DevMon *self = g_new0(DevMon, 1);
|
DevMon *self = g_new0(DevMon, 1);
|
||||||
|
|
||||||
@@ -236,6 +245,10 @@ struct ril_devmon *ril_devmon_ss_new()
|
|||||||
self->battery = mce_battery_new();
|
self->battery = mce_battery_new();
|
||||||
self->charger = mce_charger_new();
|
self->charger = mce_charger_new();
|
||||||
self->display = mce_display_new();
|
self->display = mce_display_new();
|
||||||
|
self->cell_info_interval_short_ms =
|
||||||
|
config->cell_info_interval_short_ms;
|
||||||
|
self->cell_info_interval_long_ms =
|
||||||
|
config->cell_info_interval_long_ms;
|
||||||
return &self->pub;
|
return &self->pub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ typedef struct ril_devmon_ur {
|
|||||||
MceBattery *battery;
|
MceBattery *battery;
|
||||||
MceCharger *charger;
|
MceCharger *charger;
|
||||||
MceDisplay *display;
|
MceDisplay *display;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
} DevMon;
|
} DevMon;
|
||||||
|
|
||||||
typedef struct ril_devmon_ur_io {
|
typedef struct ril_devmon_ur_io {
|
||||||
@@ -70,6 +72,8 @@ typedef struct ril_devmon_ur_io {
|
|||||||
gulong charger_event_id[CHARGER_EVENT_COUNT];
|
gulong charger_event_id[CHARGER_EVENT_COUNT];
|
||||||
gulong display_event_id[DISPLAY_EVENT_COUNT];
|
gulong display_event_id[DISPLAY_EVENT_COUNT];
|
||||||
guint req_id;
|
guint req_id;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
} DevMonIo;
|
} DevMonIo;
|
||||||
|
|
||||||
#define DBG_(self,fmt,args...) DBG("%s: " fmt, (self)->io->name, ##args)
|
#define DBG_(self,fmt,args...) DBG("%s: " fmt, (self)->io->name, ##args)
|
||||||
@@ -136,8 +140,8 @@ static void ril_devmon_ur_io_set_cell_info_update_interval(DevMonIo *self)
|
|||||||
sailfish_cell_info_set_update_interval(self->cell_info,
|
sailfish_cell_info_set_update_interval(self->cell_info,
|
||||||
(self->display_on && (ril_devmon_ur_charging(self->charger) ||
|
(self->display_on && (ril_devmon_ur_charging(self->charger) ||
|
||||||
ril_devmon_ur_battery_ok(self->battery))) ?
|
ril_devmon_ur_battery_ok(self->battery))) ?
|
||||||
RIL_CELL_INFO_INTERVAL_SHORT_MS :
|
self->cell_info_interval_short_ms :
|
||||||
RIL_CELL_INFO_INTERVAL_LONG_MS);
|
self->cell_info_interval_long_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_devmon_ur_io_battery_cb(MceBattery *battery, void *user_data)
|
static void ril_devmon_ur_io_battery_cb(MceBattery *battery, void *user_data)
|
||||||
@@ -218,6 +222,11 @@ static struct ril_devmon_io *ril_devmon_ur_start_io(struct ril_devmon *devmon,
|
|||||||
mce_display_add_state_changed_handler(self->display,
|
mce_display_add_state_changed_handler(self->display,
|
||||||
ril_devmon_ur_io_display_cb, self);
|
ril_devmon_ur_io_display_cb, self);
|
||||||
|
|
||||||
|
self->cell_info_interval_short_ms =
|
||||||
|
ur->cell_info_interval_short_ms;
|
||||||
|
self->cell_info_interval_long_ms =
|
||||||
|
ur->cell_info_interval_long_ms;
|
||||||
|
|
||||||
ril_devmon_ur_io_set_unsol_response_filter(self);
|
ril_devmon_ur_io_set_unsol_response_filter(self);
|
||||||
ril_devmon_ur_io_set_cell_info_update_interval(self);
|
ril_devmon_ur_io_set_cell_info_update_interval(self);
|
||||||
return &self->pub;
|
return &self->pub;
|
||||||
@@ -233,7 +242,7 @@ static void ril_devmon_ur_free(struct ril_devmon *devmon)
|
|||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ril_devmon *ril_devmon_ur_new()
|
struct ril_devmon *ril_devmon_ur_new(const struct ril_slot_config *config)
|
||||||
{
|
{
|
||||||
DevMon *self = g_new0(DevMon, 1);
|
DevMon *self = g_new0(DevMon, 1);
|
||||||
|
|
||||||
@@ -242,6 +251,10 @@ struct ril_devmon *ril_devmon_ur_new()
|
|||||||
self->battery = mce_battery_new();
|
self->battery = mce_battery_new();
|
||||||
self->charger = mce_charger_new();
|
self->charger = mce_charger_new();
|
||||||
self->display = mce_display_new();
|
self->display = mce_display_new();
|
||||||
|
self->cell_info_interval_short_ms =
|
||||||
|
config->cell_info_interval_short_ms;
|
||||||
|
self->cell_info_interval_long_ms =
|
||||||
|
config->cell_info_interval_long_ms;
|
||||||
return &self->pub;
|
return &self->pub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ static void ril_modem_remove(struct ofono_modem *ofono)
|
|||||||
ofono_modem_set_data(ofono, NULL);
|
ofono_modem_set_data(ofono, NULL);
|
||||||
|
|
||||||
ril_radio_remove_handler(modem->radio, md->radio_state_event_id);
|
ril_radio_remove_handler(modem->radio, md->radio_state_event_id);
|
||||||
|
ril_radio_set_online(modem->radio, FALSE);
|
||||||
ril_radio_power_off(modem->radio, RADIO_POWER_TAG(md));
|
ril_radio_power_off(modem->radio, RADIO_POWER_TAG(md));
|
||||||
ril_radio_set_online(modem->radio, FALSE);
|
ril_radio_set_online(modem->radio, FALSE);
|
||||||
ril_radio_unref(modem->radio);
|
ril_radio_unref(modem->radio);
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ static int ril_netreg_get_signal_strength(struct ril_netreg *nd,
|
|||||||
signal.qdbm = -4 * tdscdma_dbm;
|
signal.qdbm = -4 * tdscdma_dbm;
|
||||||
} else if (signal.lte == 99 && rsrp >= 44 && rsrp <= 140) {
|
} else if (signal.lte == 99 && rsrp >= 44 && rsrp <= 140) {
|
||||||
/* RSRP range: 44 to 140 dBm per 3GPP TS 36.133 */
|
/* RSRP range: 44 to 140 dBm per 3GPP TS 36.133 */
|
||||||
signal.qdbm = -rsrp;
|
signal.qdbm = -4 * rsrp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "ril_network.h"
|
#include "ril_network.h"
|
||||||
#include "ril_radio.h"
|
#include "ril_radio.h"
|
||||||
|
#include "ril_radio_caps.h"
|
||||||
#include "ril_sim_card.h"
|
#include "ril_sim_card.h"
|
||||||
#include "ril_sim_settings.h"
|
#include "ril_sim_settings.h"
|
||||||
#include "ril_vendor.h"
|
#include "ril_vendor.h"
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
#include <ofono/watch.h>
|
#include <ofono/watch.h>
|
||||||
#include <ofono/gprs.h>
|
#include <ofono/gprs.h>
|
||||||
|
|
||||||
|
#include "ofono.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#define SET_PREF_MODE_HOLDOFF_SEC RIL_RETRY_SECS
|
#define SET_PREF_MODE_HOLDOFF_SEC RIL_RETRY_SECS
|
||||||
@@ -54,6 +56,12 @@ enum ril_network_radio_event {
|
|||||||
RADIO_EVENT_COUNT
|
RADIO_EVENT_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ril_network_radio_caps_mgr_events {
|
||||||
|
RADIO_CAPS_MGR_TX_DONE,
|
||||||
|
RADIO_CAPS_MGR_TX_ABORTED,
|
||||||
|
RADIO_CAPS_MGR_EVENT_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
enum ril_network_sim_events {
|
enum ril_network_sim_events {
|
||||||
SIM_EVENT_STATUS_CHANGED,
|
SIM_EVENT_STATUS_CHANGED,
|
||||||
SIM_EVENT_IO_ACTIVE_CHANGED,
|
SIM_EVENT_IO_ACTIVE_CHANGED,
|
||||||
@@ -62,7 +70,6 @@ enum ril_network_sim_events {
|
|||||||
|
|
||||||
enum ril_network_unsol_event {
|
enum ril_network_unsol_event {
|
||||||
UNSOL_EVENT_NETWORK_STATE,
|
UNSOL_EVENT_NETWORK_STATE,
|
||||||
UNSOL_EVENT_RADIO_CAPABILITY,
|
|
||||||
UNSOL_EVENT_COUNT
|
UNSOL_EVENT_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,6 +97,7 @@ struct ril_network_priv {
|
|||||||
GRilIoChannel *io;
|
GRilIoChannel *io;
|
||||||
GRilIoQueue *q;
|
GRilIoQueue *q;
|
||||||
struct ril_radio *radio;
|
struct ril_radio *radio;
|
||||||
|
struct ril_radio_caps *caps;
|
||||||
struct ril_sim_card *simcard;
|
struct ril_sim_card *simcard;
|
||||||
struct ril_vendor *vendor;
|
struct ril_vendor *vendor;
|
||||||
struct ofono_watch *watch;
|
struct ofono_watch *watch;
|
||||||
@@ -106,6 +114,8 @@ struct ril_network_priv {
|
|||||||
gulong set_rat_id;
|
gulong set_rat_id;
|
||||||
gulong unsol_event_id[UNSOL_EVENT_COUNT];
|
gulong unsol_event_id[UNSOL_EVENT_COUNT];
|
||||||
gulong settings_event_id;
|
gulong settings_event_id;
|
||||||
|
gulong supported_modes_event_id;
|
||||||
|
gulong caps_mgr_event_id[RADIO_CAPS_MGR_EVENT_COUNT];
|
||||||
gulong radio_event_id[RADIO_EVENT_COUNT];
|
gulong radio_event_id[RADIO_EVENT_COUNT];
|
||||||
gulong simcard_event_id[SIM_EVENT_COUNT];
|
gulong simcard_event_id[SIM_EVENT_COUNT];
|
||||||
gulong watch_ids[WATCH_EVENT_COUNT];
|
gulong watch_ids[WATCH_EVENT_COUNT];
|
||||||
@@ -125,7 +135,6 @@ enum ril_network_signal {
|
|||||||
SIGNAL_VOICE_STATE_CHANGED,
|
SIGNAL_VOICE_STATE_CHANGED,
|
||||||
SIGNAL_DATA_STATE_CHANGED,
|
SIGNAL_DATA_STATE_CHANGED,
|
||||||
SIGNAL_PREF_MODE_CHANGED,
|
SIGNAL_PREF_MODE_CHANGED,
|
||||||
SIGNAL_MAX_PREF_MODE_CHANGED,
|
|
||||||
SIGNAL_COUNT
|
SIGNAL_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,7 +142,6 @@ enum ril_network_signal {
|
|||||||
#define SIGNAL_VOICE_STATE_CHANGED_NAME "ril-network-voice-state-changed"
|
#define SIGNAL_VOICE_STATE_CHANGED_NAME "ril-network-voice-state-changed"
|
||||||
#define SIGNAL_DATA_STATE_CHANGED_NAME "ril-network-data-state-changed"
|
#define SIGNAL_DATA_STATE_CHANGED_NAME "ril-network-data-state-changed"
|
||||||
#define SIGNAL_PREF_MODE_CHANGED_NAME "ril-network-pref-mode-changed"
|
#define SIGNAL_PREF_MODE_CHANGED_NAME "ril-network-pref-mode-changed"
|
||||||
#define SIGNAL_MAX_PREF_MODE_CHANGED_NAME "ril-network-max-pref-mode-changed"
|
|
||||||
|
|
||||||
static guint ril_network_signals[SIGNAL_COUNT] = { 0 };
|
static guint ril_network_signals[SIGNAL_COUNT] = { 0 };
|
||||||
|
|
||||||
@@ -525,6 +533,17 @@ static int ril_network_mode_to_rat(struct ril_network *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ofono_radio_access_mode ril_network_max_supported_mode
|
||||||
|
(struct ril_network *self)
|
||||||
|
{
|
||||||
|
struct ril_sim_settings *settings = self->settings;
|
||||||
|
struct ril_network_priv *priv = self->priv;
|
||||||
|
const struct ril_radio_caps *caps = priv->caps;
|
||||||
|
|
||||||
|
return caps ? __ofono_radio_access_max_mode(caps->supported_modes) :
|
||||||
|
__ofono_radio_access_max_mode(settings->techs);
|
||||||
|
}
|
||||||
|
|
||||||
static enum ofono_radio_access_mode ril_network_actual_pref_mode
|
static enum ofono_radio_access_mode ril_network_actual_pref_mode
|
||||||
(struct ril_network *self)
|
(struct ril_network *self)
|
||||||
{
|
{
|
||||||
@@ -548,9 +567,16 @@ static enum ofono_radio_access_mode ril_network_actual_pref_mode
|
|||||||
* and max_pref_mode are not ANY, we pick the smallest value.
|
* and max_pref_mode are not ANY, we pick the smallest value.
|
||||||
* Otherwise we take any non-zero value if there is one.
|
* Otherwise we take any non-zero value if there is one.
|
||||||
*/
|
*/
|
||||||
return (settings->pref_mode && max_pref_mode) ?
|
const enum ofono_radio_access_mode pref_mode =
|
||||||
|
(settings->pref_mode && max_pref_mode) ?
|
||||||
MIN(settings->pref_mode, max_pref_mode) :
|
MIN(settings->pref_mode, max_pref_mode) :
|
||||||
settings->pref_mode ? settings->pref_mode : max_pref_mode;
|
settings->pref_mode ? settings->pref_mode : max_pref_mode;
|
||||||
|
|
||||||
|
/* Do not try to set unsupported mode */
|
||||||
|
const enum ofono_radio_access_mode max_mode =
|
||||||
|
ril_network_max_supported_mode(self);
|
||||||
|
|
||||||
|
return pref_mode ? MIN(pref_mode, max_mode) : max_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean ril_network_need_initial_attach_apn(struct ril_network *self)
|
static gboolean ril_network_need_initial_attach_apn(struct ril_network *self)
|
||||||
@@ -561,9 +587,9 @@ static gboolean ril_network_need_initial_attach_apn(struct ril_network *self)
|
|||||||
|
|
||||||
if (watch->gprs && radio->state == RADIO_STATE_ON) {
|
if (watch->gprs && radio->state == RADIO_STATE_ON) {
|
||||||
switch (ril_network_actual_pref_mode(self)) {
|
switch (ril_network_actual_pref_mode(self)) {
|
||||||
case OFONO_RADIO_ACCESS_MODE_ANY:
|
|
||||||
case OFONO_RADIO_ACCESS_MODE_LTE:
|
case OFONO_RADIO_ACCESS_MODE_LTE:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
case OFONO_RADIO_ACCESS_MODE_ANY:
|
||||||
case OFONO_RADIO_ACCESS_MODE_UMTS:
|
case OFONO_RADIO_ACCESS_MODE_UMTS:
|
||||||
case OFONO_RADIO_ACCESS_MODE_GSM:
|
case OFONO_RADIO_ACCESS_MODE_GSM:
|
||||||
break;
|
break;
|
||||||
@@ -968,6 +994,14 @@ static void ril_network_check_pref_mode(struct ril_network *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_network_assert_pref_mode(struct ril_network *self)
|
||||||
|
{
|
||||||
|
struct ril_network_priv *priv = self->priv;
|
||||||
|
|
||||||
|
priv->assert_rat = TRUE;
|
||||||
|
ril_network_check_pref_mode(self, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
static int ril_network_parse_pref_resp(const void *data, guint len)
|
static int ril_network_parse_pref_resp(const void *data, guint len)
|
||||||
{
|
{
|
||||||
GRilIoParser rilp;
|
GRilIoParser rilp;
|
||||||
@@ -997,10 +1031,10 @@ static void ril_network_startup_query_pref_mode_cb(GRilIoChannel *io,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unlike ril_network_query_pref_mode_cb, this one always
|
* At startup, the device may have an inconsistency between
|
||||||
* checks the preferred mode.
|
* voice and data network modes, so it needs to be asserted.
|
||||||
*/
|
*/
|
||||||
ril_network_check_pref_mode(self, FALSE);
|
ril_network_assert_pref_mode(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,19 +1087,79 @@ void ril_network_set_max_pref_mode(struct ril_network *self,
|
|||||||
DBG_(self, "rat mode %d (%s)", max_mode,
|
DBG_(self, "rat mode %d (%s)", max_mode,
|
||||||
ofono_radio_access_mode_to_string(max_mode));
|
ofono_radio_access_mode_to_string(max_mode));
|
||||||
self->max_pref_mode = max_mode;
|
self->max_pref_mode = max_mode;
|
||||||
ril_network_emit(self, SIGNAL_MAX_PREF_MODE_CHANGED);
|
|
||||||
ril_network_check_initial_attach_apn(self);
|
ril_network_check_initial_attach_apn(self);
|
||||||
}
|
}
|
||||||
ril_network_check_pref_mode(self, TRUE);
|
ril_network_check_pref_mode(self, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ril_network_assert_pref_mode(struct ril_network *self, gboolean immediate)
|
static void ril_network_supported_modes_handler(struct ril_radio_caps *caps,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct ril_network *self = RIL_NETWORK(user_data);
|
||||||
|
|
||||||
|
DBG_(self, "%s", ofono_radio_access_mode_to_string
|
||||||
|
(caps->supported_modes));
|
||||||
|
ril_network_check_pref_mode(self, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_network_radio_capability_tx_done_cb
|
||||||
|
(struct ril_radio_caps_manager *mgr, void *user_data)
|
||||||
|
{
|
||||||
|
struct ril_network *self = RIL_NETWORK(user_data);
|
||||||
|
|
||||||
|
DBG_(self, "");
|
||||||
|
ril_network_assert_pref_mode(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_network_release_radio_caps(struct ril_network *self)
|
||||||
|
{
|
||||||
|
struct ril_network_priv *priv = self->priv;
|
||||||
|
struct ril_radio_caps *caps = priv->caps;
|
||||||
|
|
||||||
|
if (caps) {
|
||||||
|
ril_radio_caps_manager_remove_all_handlers(caps->mgr,
|
||||||
|
priv->caps_mgr_event_id);
|
||||||
|
ril_radio_caps_remove_handler(caps,
|
||||||
|
priv->supported_modes_event_id);
|
||||||
|
ril_radio_caps_unref(caps);
|
||||||
|
|
||||||
|
priv->caps = NULL;
|
||||||
|
priv->supported_modes_event_id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_network_attach_radio_caps(struct ril_network *self,
|
||||||
|
struct ril_radio_caps *caps)
|
||||||
{
|
{
|
||||||
struct ril_network_priv *priv = self->priv;
|
struct ril_network_priv *priv = self->priv;
|
||||||
|
|
||||||
priv->assert_rat = TRUE;
|
priv->caps = ril_radio_caps_ref(caps);
|
||||||
ril_network_check_pref_mode(self, immediate);
|
priv->supported_modes_event_id =
|
||||||
|
ril_radio_caps_add_supported_modes_handler(caps,
|
||||||
|
ril_network_supported_modes_handler, self);
|
||||||
|
priv->caps_mgr_event_id[RADIO_CAPS_MGR_TX_DONE] =
|
||||||
|
ril_radio_caps_manager_add_tx_done_handler(caps->mgr,
|
||||||
|
ril_network_radio_capability_tx_done_cb, self);
|
||||||
|
priv->caps_mgr_event_id[RADIO_CAPS_MGR_TX_ABORTED] =
|
||||||
|
ril_radio_caps_manager_add_tx_aborted_handler(caps->mgr,
|
||||||
|
ril_network_radio_capability_tx_done_cb, self);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ril_network_set_radio_caps(struct ril_network *self,
|
||||||
|
struct ril_radio_caps *caps)
|
||||||
|
{
|
||||||
|
if (self) {
|
||||||
|
struct ril_network_priv *priv = self->priv;
|
||||||
|
|
||||||
|
if (priv->caps != caps) {
|
||||||
|
ril_network_release_radio_caps(self);
|
||||||
|
if (caps) {
|
||||||
|
ril_network_attach_radio_caps(self, caps);
|
||||||
|
}
|
||||||
|
ril_network_check_pref_mode(self, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gulong ril_network_add_operator_changed_handler(struct ril_network *self,
|
gulong ril_network_add_operator_changed_handler(struct ril_network *self,
|
||||||
@@ -1096,13 +1190,6 @@ gulong ril_network_add_pref_mode_changed_handler(struct ril_network *self,
|
|||||||
SIGNAL_PREF_MODE_CHANGED_NAME, G_CALLBACK(cb), arg) : 0;
|
SIGNAL_PREF_MODE_CHANGED_NAME, G_CALLBACK(cb), arg) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gulong ril_network_add_max_pref_mode_changed_handler(struct ril_network *self,
|
|
||||||
ril_network_cb_t cb, void *arg)
|
|
||||||
{
|
|
||||||
return (G_LIKELY(self) && G_LIKELY(cb)) ? g_signal_connect(self,
|
|
||||||
SIGNAL_MAX_PREF_MODE_CHANGED_NAME, G_CALLBACK(cb), arg) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ril_network_remove_handler(struct ril_network *self, gulong id)
|
void ril_network_remove_handler(struct ril_network *self, gulong id)
|
||||||
{
|
{
|
||||||
if (G_LIKELY(self) && G_LIKELY(id)) {
|
if (G_LIKELY(self) && G_LIKELY(id)) {
|
||||||
@@ -1125,16 +1212,6 @@ static void ril_network_state_changed_cb(GRilIoChannel *io, guint code,
|
|||||||
ril_network_poll_state(self);
|
ril_network_poll_state(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_network_radio_capability_changed_cb(GRilIoChannel *io,
|
|
||||||
guint code, const void *data, guint len, void *user_data)
|
|
||||||
{
|
|
||||||
struct ril_network *self = RIL_NETWORK(user_data);
|
|
||||||
|
|
||||||
DBG_(self, "");
|
|
||||||
GASSERT(code == RIL_UNSOL_RADIO_CAPABILITY);
|
|
||||||
ril_network_assert_pref_mode(self, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ril_network_radio_state_cb(struct ril_radio *radio, void *data)
|
static void ril_network_radio_state_cb(struct ril_radio *radio, void *data)
|
||||||
{
|
{
|
||||||
struct ril_network *self = RIL_NETWORK(data);
|
struct ril_network *self = RIL_NETWORK(data);
|
||||||
@@ -1267,10 +1344,6 @@ struct ril_network *ril_network_new(const char *path, GRilIoChannel *io,
|
|||||||
grilio_channel_add_unsol_event_handler(priv->io,
|
grilio_channel_add_unsol_event_handler(priv->io,
|
||||||
ril_network_state_changed_cb,
|
ril_network_state_changed_cb,
|
||||||
RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, self);
|
RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, self);
|
||||||
priv->unsol_event_id[UNSOL_EVENT_RADIO_CAPABILITY] =
|
|
||||||
grilio_channel_add_unsol_event_handler(priv->io,
|
|
||||||
ril_network_radio_capability_changed_cb,
|
|
||||||
RIL_UNSOL_RADIO_CAPABILITY, self);
|
|
||||||
|
|
||||||
priv->radio_event_id[RADIO_EVENT_STATE_CHANGED] =
|
priv->radio_event_id[RADIO_EVENT_STATE_CHANGED] =
|
||||||
ril_radio_add_state_changed_handler(priv->radio,
|
ril_radio_add_state_changed_handler(priv->radio,
|
||||||
@@ -1365,6 +1438,7 @@ static void ril_network_finalize(GObject *object)
|
|||||||
grilio_channel_remove_all_handlers(priv->io, priv->unsol_event_id);
|
grilio_channel_remove_all_handlers(priv->io, priv->unsol_event_id);
|
||||||
grilio_channel_unref(priv->io);
|
grilio_channel_unref(priv->io);
|
||||||
grilio_queue_unref(priv->q);
|
grilio_queue_unref(priv->q);
|
||||||
|
ril_network_release_radio_caps(self);
|
||||||
ril_radio_remove_all_handlers(priv->radio, priv->radio_event_id);
|
ril_radio_remove_all_handlers(priv->radio, priv->radio_event_id);
|
||||||
ril_radio_unref(priv->radio);
|
ril_radio_unref(priv->radio);
|
||||||
ril_sim_card_remove_all_handlers(priv->simcard, priv->simcard_event_id);
|
ril_sim_card_remove_all_handlers(priv->simcard, priv->simcard_event_id);
|
||||||
@@ -1386,7 +1460,6 @@ static void ril_network_class_init(RilNetworkClass *klass)
|
|||||||
RIL_NETWORK_SIGNAL(klass, VOICE_STATE);
|
RIL_NETWORK_SIGNAL(klass, VOICE_STATE);
|
||||||
RIL_NETWORK_SIGNAL(klass, DATA_STATE);
|
RIL_NETWORK_SIGNAL(klass, DATA_STATE);
|
||||||
RIL_NETWORK_SIGNAL(klass, PREF_MODE);
|
RIL_NETWORK_SIGNAL(klass, PREF_MODE);
|
||||||
RIL_NETWORK_SIGNAL(klass, MAX_PREF_MODE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2019 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
|
* Copyright (C) 2020 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
struct ofono_network_operator;
|
struct ofono_network_operator;
|
||||||
|
struct ril_radio_caps;
|
||||||
|
|
||||||
struct ril_registration_state {
|
struct ril_registration_state {
|
||||||
int status; /* enum network_registration_status */
|
int status; /* enum network_registration_status */
|
||||||
@@ -42,7 +44,6 @@ struct ril_network {
|
|||||||
struct ril_sim_settings *settings;
|
struct ril_sim_settings *settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ofono_sim;
|
|
||||||
typedef void (*ril_network_cb_t)(struct ril_network *net, void *arg);
|
typedef void (*ril_network_cb_t)(struct ril_network *net, void *arg);
|
||||||
|
|
||||||
struct ril_network *ril_network_new(const char *path, GRilIoChannel *io,
|
struct ril_network *ril_network_new(const char *path, GRilIoChannel *io,
|
||||||
@@ -54,10 +55,13 @@ struct ril_network *ril_network_new(const char *path, GRilIoChannel *io,
|
|||||||
struct ril_network *ril_network_ref(struct ril_network *net);
|
struct ril_network *ril_network_ref(struct ril_network *net);
|
||||||
void ril_network_unref(struct ril_network *net);
|
void ril_network_unref(struct ril_network *net);
|
||||||
|
|
||||||
|
void ril_network_set_radio_caps(struct ril_network *net,
|
||||||
|
struct ril_radio_caps *caps);
|
||||||
void ril_network_set_max_pref_mode(struct ril_network *net,
|
void ril_network_set_max_pref_mode(struct ril_network *net,
|
||||||
enum ofono_radio_access_mode max_pref_mode,
|
enum ofono_radio_access_mode max_pref_mode,
|
||||||
gboolean force_check);
|
gboolean force_check);
|
||||||
void ril_network_assert_pref_mode(struct ril_network *net, gboolean immediate);
|
enum ofono_radio_access_mode ril_network_max_supported_mode
|
||||||
|
(struct ril_network *self);
|
||||||
void ril_network_query_registration_state(struct ril_network *net);
|
void ril_network_query_registration_state(struct ril_network *net);
|
||||||
gulong ril_network_add_operator_changed_handler(struct ril_network *net,
|
gulong ril_network_add_operator_changed_handler(struct ril_network *net,
|
||||||
ril_network_cb_t cb, void *arg);
|
ril_network_cb_t cb, void *arg);
|
||||||
@@ -67,8 +71,6 @@ gulong ril_network_add_data_state_changed_handler(struct ril_network *net,
|
|||||||
ril_network_cb_t cb, void *arg);
|
ril_network_cb_t cb, void *arg);
|
||||||
gulong ril_network_add_pref_mode_changed_handler(struct ril_network *net,
|
gulong ril_network_add_pref_mode_changed_handler(struct ril_network *net,
|
||||||
ril_network_cb_t cb, void *arg);
|
ril_network_cb_t cb, void *arg);
|
||||||
gulong ril_network_add_max_pref_mode_changed_handler(struct ril_network *net,
|
|
||||||
ril_network_cb_t cb, void *arg);
|
|
||||||
void ril_network_remove_handler(struct ril_network *net, gulong id);
|
void ril_network_remove_handler(struct ril_network *net, gulong id);
|
||||||
void ril_network_remove_handlers(struct ril_network *net, gulong *ids, int n);
|
void ril_network_remove_handlers(struct ril_network *net, gulong *ids, int n);
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,8 @@
|
|||||||
#define RILMODEM_DEFAULT_USE_DATA_PROFILES FALSE
|
#define RILMODEM_DEFAULT_USE_DATA_PROFILES FALSE
|
||||||
#define RILMODEM_DEFAULT_MMS_DATA_PROFILE_ID RIL_DATA_PROFILE_IMS
|
#define RILMODEM_DEFAULT_MMS_DATA_PROFILE_ID RIL_DATA_PROFILE_IMS
|
||||||
#define RILMODEM_DEFAULT_SLOT_FLAGS SAILFISH_SLOT_NO_FLAGS
|
#define RILMODEM_DEFAULT_SLOT_FLAGS SAILFISH_SLOT_NO_FLAGS
|
||||||
|
#define RILMODEM_DEFAULT_CELL_INFO_INTERVAL_SHORT_MS (2000) /* 2 sec */
|
||||||
|
#define RILMODEM_DEFAULT_CELL_INFO_INTERVAL_LONG_MS (30000) /* 30 sec */
|
||||||
|
|
||||||
/* RIL socket transport name and parameters */
|
/* RIL socket transport name and parameters */
|
||||||
#define RIL_TRANSPORT_MODEM "modem"
|
#define RIL_TRANSPORT_MODEM "modem"
|
||||||
@@ -158,6 +160,8 @@
|
|||||||
#define RILCONF_USE_DATA_PROFILES "useDataProfiles"
|
#define RILCONF_USE_DATA_PROFILES "useDataProfiles"
|
||||||
#define RILCONF_MMS_DATA_PROFILE_ID "mmsDataProfileId"
|
#define RILCONF_MMS_DATA_PROFILE_ID "mmsDataProfileId"
|
||||||
#define RILCONF_DEVMON "deviceStateTracking"
|
#define RILCONF_DEVMON "deviceStateTracking"
|
||||||
|
#define RILCONF_CELL_INFO_INTERVAL_SHORT_MS "cellInfoIntervalShortMs"
|
||||||
|
#define RILCONF_CELL_INFO_INTERVAL_LONG_MS "cellInfoIntervalLongMs"
|
||||||
|
|
||||||
/* Modem error ids */
|
/* Modem error ids */
|
||||||
#define RIL_ERROR_ID_RILD_RESTART "rild-restart"
|
#define RIL_ERROR_ID_RILD_RESTART "rild-restart"
|
||||||
@@ -230,6 +234,7 @@ typedef struct sailfish_slot_impl {
|
|||||||
struct ril_modem *modem;
|
struct ril_modem *modem;
|
||||||
struct ril_radio *radio;
|
struct ril_radio *radio;
|
||||||
struct ril_radio_caps *caps;
|
struct ril_radio_caps *caps;
|
||||||
|
struct ril_radio_caps_request *caps_req;
|
||||||
struct ril_network *network;
|
struct ril_network *network;
|
||||||
struct ril_sim_card *sim_card;
|
struct ril_sim_card *sim_card;
|
||||||
struct ril_sim_settings *sim_settings;
|
struct ril_sim_settings *sim_settings;
|
||||||
@@ -392,7 +397,10 @@ static void ril_plugin_shutdown_slot(ril_slot *slot, gboolean kill_io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (slot->caps) {
|
if (slot->caps) {
|
||||||
ril_radio_caps_unref(slot->caps);
|
ril_network_set_radio_caps(slot->network, NULL);
|
||||||
|
ril_radio_caps_request_free(slot->caps_req);
|
||||||
|
ril_radio_caps_drop(slot->caps);
|
||||||
|
slot->caps_req = NULL;
|
||||||
slot->caps = NULL;
|
slot->caps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -906,7 +914,7 @@ static void ril_plugin_radio_caps_cb(const struct ril_radio_capability *cap,
|
|||||||
plugin->caps_manager = ril_radio_caps_manager_new
|
plugin->caps_manager = ril_radio_caps_manager_new
|
||||||
(plugin->data_manager);
|
(plugin->data_manager);
|
||||||
plugin->caps_manager_event_id =
|
plugin->caps_manager_event_id =
|
||||||
ril_radio_caps_manager_add_aborted_handler(
|
ril_radio_caps_manager_add_tx_aborted_handler(
|
||||||
plugin->caps_manager,
|
plugin->caps_manager,
|
||||||
ril_plugin_caps_switch_aborted,
|
ril_plugin_caps_switch_aborted,
|
||||||
plugin);
|
plugin);
|
||||||
@@ -914,9 +922,10 @@ static void ril_plugin_radio_caps_cb(const struct ril_radio_capability *cap,
|
|||||||
|
|
||||||
GASSERT(!slot->caps);
|
GASSERT(!slot->caps);
|
||||||
slot->caps = ril_radio_caps_new(plugin->caps_manager,
|
slot->caps = ril_radio_caps_new(plugin->caps_manager,
|
||||||
ril_plugin_log_prefix(slot), slot->io, slot->data,
|
ril_plugin_log_prefix(slot), slot->io, slot->watch,
|
||||||
slot->radio, slot->sim_card, slot->network,
|
slot->data, slot->radio, slot->sim_card,
|
||||||
&slot->config, cap);
|
slot->sim_settings, &slot->config, cap);
|
||||||
|
ril_network_set_radio_caps(slot->network, slot->caps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,6 +1157,8 @@ static void ril_plugin_slot_modem_changed(struct ofono_watch *w,
|
|||||||
|
|
||||||
slot->modem = NULL;
|
slot->modem = NULL;
|
||||||
ril_data_allow(slot->data, RIL_DATA_ROLE_NONE);
|
ril_data_allow(slot->data, RIL_DATA_ROLE_NONE);
|
||||||
|
ril_radio_caps_request_free(slot->caps_req);
|
||||||
|
slot->caps_req = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1223,6 +1234,10 @@ static ril_slot *ril_plugin_slot_new_take(char *transport,
|
|||||||
RILMODEM_DEFAULT_FORCE_GSM_WHEN_RADIO_OFF;
|
RILMODEM_DEFAULT_FORCE_GSM_WHEN_RADIO_OFF;
|
||||||
config->use_data_profiles = RILMODEM_DEFAULT_USE_DATA_PROFILES;
|
config->use_data_profiles = RILMODEM_DEFAULT_USE_DATA_PROFILES;
|
||||||
config->mms_data_profile_id = RILMODEM_DEFAULT_MMS_DATA_PROFILE_ID;
|
config->mms_data_profile_id = RILMODEM_DEFAULT_MMS_DATA_PROFILE_ID;
|
||||||
|
config->cell_info_interval_short_ms =
|
||||||
|
RILMODEM_DEFAULT_CELL_INFO_INTERVAL_SHORT_MS;
|
||||||
|
config->cell_info_interval_long_ms =
|
||||||
|
RILMODEM_DEFAULT_CELL_INFO_INTERVAL_LONG_MS;
|
||||||
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
||||||
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
||||||
slot->slot_flags = RILMODEM_DEFAULT_SLOT_FLAGS;
|
slot->slot_flags = RILMODEM_DEFAULT_SLOT_FLAGS;
|
||||||
@@ -1234,8 +1249,7 @@ static ril_slot *ril_plugin_slot_new_take(char *transport,
|
|||||||
RILMODEM_DEFAULT_DATA_CALL_RETRY_LIMIT;
|
RILMODEM_DEFAULT_DATA_CALL_RETRY_LIMIT;
|
||||||
slot->data_opt.data_call_retry_delay_ms =
|
slot->data_opt.data_call_retry_delay_ms =
|
||||||
RILMODEM_DEFAULT_DATA_CALL_RETRY_DELAY;
|
RILMODEM_DEFAULT_DATA_CALL_RETRY_DELAY;
|
||||||
|
slot->devmon = ril_devmon_auto_new(config);
|
||||||
slot->devmon = ril_devmon_auto_new();
|
|
||||||
slot->watch = ofono_watch_new(dbus_path);
|
slot->watch = ofono_watch_new(dbus_path);
|
||||||
slot->watch_event_id[WATCH_EVENT_MODEM] =
|
slot->watch_event_id[WATCH_EVENT_MODEM] =
|
||||||
ofono_watch_add_modem_changed_handler(slot->watch,
|
ofono_watch_add_modem_changed_handler(slot->watch,
|
||||||
@@ -1735,6 +1749,26 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
|||||||
slot->legacy_imei_query ? "on" : "off");
|
slot->legacy_imei_query ? "on" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* cellInfoIntervalShortMs */
|
||||||
|
if (ril_config_get_integer(file, group,
|
||||||
|
RILCONF_CELL_INFO_INTERVAL_SHORT_MS,
|
||||||
|
&config->cell_info_interval_short_ms)) {
|
||||||
|
DBG("%s: " RILCONF_CELL_INFO_INTERVAL_SHORT_MS " %d", group,
|
||||||
|
config->cell_info_interval_short_ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cellInfoIntervalLongMs */
|
||||||
|
if (ril_config_get_integer(file, group,
|
||||||
|
RILCONF_CELL_INFO_INTERVAL_LONG_MS,
|
||||||
|
&config->cell_info_interval_long_ms)) {
|
||||||
|
DBG("%s: " RILCONF_CELL_INFO_INTERVAL_LONG_MS " %d",
|
||||||
|
group, config->cell_info_interval_long_ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace devmon with a new one with applied settings */
|
||||||
|
ril_devmon_free(slot->devmon);
|
||||||
|
slot->devmon = NULL;
|
||||||
|
|
||||||
/* deviceStateTracking */
|
/* deviceStateTracking */
|
||||||
if (ril_config_get_mask(file, group, RILCONF_DEVMON, &ival,
|
if (ril_config_get_mask(file, group, RILCONF_DEVMON, &ival,
|
||||||
"ds", RIL_DEVMON_DS,
|
"ds", RIL_DEVMON_DS,
|
||||||
@@ -1743,11 +1777,16 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
struct ril_devmon *devmon[3];
|
struct ril_devmon *devmon[3];
|
||||||
|
|
||||||
if (ival & RIL_DEVMON_DS) devmon[n++] = ril_devmon_ds_new();
|
if (ival & RIL_DEVMON_DS) {
|
||||||
if (ival & RIL_DEVMON_SS) devmon[n++] = ril_devmon_ss_new();
|
devmon[n++] = ril_devmon_ds_new(config);
|
||||||
if (ival & RIL_DEVMON_UR) devmon[n++] = ril_devmon_ur_new();
|
}
|
||||||
|
if (ival & RIL_DEVMON_SS) {
|
||||||
|
devmon[n++] = ril_devmon_ss_new(config);
|
||||||
|
}
|
||||||
|
if (ival & RIL_DEVMON_UR) {
|
||||||
|
devmon[n++] = ril_devmon_ur_new(config);
|
||||||
|
}
|
||||||
DBG("%s: " RILCONF_DEVMON " 0x%x", group, ival);
|
DBG("%s: " RILCONF_DEVMON " 0x%x", group, ival);
|
||||||
ril_devmon_free(slot->devmon);
|
|
||||||
slot->devmon = ril_devmon_combine(devmon, n);
|
slot->devmon = ril_devmon_combine(devmon, n);
|
||||||
} else {
|
} else {
|
||||||
/* Try special values */
|
/* Try special values */
|
||||||
@@ -1755,13 +1794,14 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
|||||||
if (sval) {
|
if (sval) {
|
||||||
if (!g_ascii_strcasecmp(sval, "none")) {
|
if (!g_ascii_strcasecmp(sval, "none")) {
|
||||||
DBG("%s: " RILCONF_DEVMON " %s", group, sval);
|
DBG("%s: " RILCONF_DEVMON " %s", group, sval);
|
||||||
ril_devmon_free(slot->devmon);
|
|
||||||
slot->devmon = NULL;
|
|
||||||
} else if (!g_ascii_strcasecmp(sval, "auto")) {
|
} else if (!g_ascii_strcasecmp(sval, "auto")) {
|
||||||
DBG("%s: " RILCONF_DEVMON " %s", group, sval);
|
DBG("%s: " RILCONF_DEVMON " %s", group, sval);
|
||||||
/* This is the default */
|
slot->devmon = ril_devmon_auto_new(config);
|
||||||
}
|
}
|
||||||
g_free(sval);
|
g_free(sval);
|
||||||
|
} else {
|
||||||
|
/* This is the default */
|
||||||
|
slot->devmon = ril_devmon_auto_new(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2192,10 +2232,24 @@ static void ril_plugin_manager_free(ril_plugin *plugin)
|
|||||||
|
|
||||||
static void ril_slot_set_data_role(ril_slot *slot, enum sailfish_data_role r)
|
static void ril_slot_set_data_role(ril_slot *slot, enum sailfish_data_role r)
|
||||||
{
|
{
|
||||||
ril_data_allow(slot->data,
|
enum ril_data_role role =
|
||||||
(r == SAILFISH_DATA_ROLE_INTERNET) ? RIL_DATA_ROLE_INTERNET :
|
(r == SAILFISH_DATA_ROLE_INTERNET) ? RIL_DATA_ROLE_INTERNET :
|
||||||
(r == SAILFISH_DATA_ROLE_MMS) ? RIL_DATA_ROLE_MMS :
|
(r == SAILFISH_DATA_ROLE_MMS) ? RIL_DATA_ROLE_MMS :
|
||||||
RIL_DATA_ROLE_NONE);
|
RIL_DATA_ROLE_NONE;
|
||||||
|
ril_data_allow(slot->data, role);
|
||||||
|
ril_radio_caps_request_free(slot->caps_req);
|
||||||
|
if (role == RIL_DATA_ROLE_NONE) {
|
||||||
|
slot->caps_req = NULL;
|
||||||
|
} else {
|
||||||
|
const enum ofono_radio_access_mode mode =
|
||||||
|
(r == SAILFISH_DATA_ROLE_MMS) ?
|
||||||
|
OFONO_RADIO_ACCESS_MODE_GSM :
|
||||||
|
__ofono_radio_access_max_mode
|
||||||
|
(slot->sim_settings->techs);
|
||||||
|
|
||||||
|
slot->caps_req = ril_radio_caps_request_new
|
||||||
|
(slot->caps, mode, role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_slot_enabled_changed(struct sailfish_slot_impl *s)
|
static void ril_slot_enabled_changed(struct sailfish_slot_impl *s)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jolla Ltd.
|
* Copyright (C) 2017-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -19,12 +19,16 @@
|
|||||||
#include "ril_types.h"
|
#include "ril_types.h"
|
||||||
|
|
||||||
struct ril_data_manager;
|
struct ril_data_manager;
|
||||||
|
struct ril_sim_settings;
|
||||||
struct ril_radio_caps;
|
struct ril_radio_caps;
|
||||||
struct ril_radio_caps_manager;
|
struct ril_radio_caps_manager;
|
||||||
struct ril_radio_capability;
|
struct ril_radio_capability;
|
||||||
|
struct ril_radio_caps_request;
|
||||||
|
|
||||||
|
typedef void (*ril_radio_caps_cb_t)(struct ril_radio_caps *caps, void *arg);
|
||||||
typedef void (*ril_radio_caps_manager_cb_t)(struct ril_radio_caps_manager *mgr,
|
typedef void (*ril_radio_caps_manager_cb_t)(struct ril_radio_caps_manager *mgr,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
/* ril_radio_capability pointer is NULL if functionality is unsupported */
|
/* ril_radio_capability pointer is NULL if functionality is unsupported */
|
||||||
typedef void (*ril_radio_caps_check_cb_t)
|
typedef void (*ril_radio_caps_check_cb_t)
|
||||||
(const struct ril_radio_capability *cap, void *user_data);
|
(const struct ril_radio_capability *cap, void *user_data);
|
||||||
@@ -39,21 +43,47 @@ struct ril_radio_caps_manager *ril_radio_caps_manager_new
|
|||||||
struct ril_radio_caps_manager *ril_radio_caps_manager_ref
|
struct ril_radio_caps_manager *ril_radio_caps_manager_ref
|
||||||
(struct ril_radio_caps_manager *mgr);
|
(struct ril_radio_caps_manager *mgr);
|
||||||
void ril_radio_caps_manager_unref(struct ril_radio_caps_manager *mgr);
|
void ril_radio_caps_manager_unref(struct ril_radio_caps_manager *mgr);
|
||||||
gulong ril_radio_caps_manager_add_aborted_handler
|
gulong ril_radio_caps_manager_add_tx_aborted_handler
|
||||||
|
(struct ril_radio_caps_manager *mgr,
|
||||||
|
ril_radio_caps_manager_cb_t cb, void *arg);
|
||||||
|
gulong ril_radio_caps_manager_add_tx_done_handler
|
||||||
(struct ril_radio_caps_manager *mgr,
|
(struct ril_radio_caps_manager *mgr,
|
||||||
ril_radio_caps_manager_cb_t cb, void *arg);
|
ril_radio_caps_manager_cb_t cb, void *arg);
|
||||||
void ril_radio_caps_manager_remove_handler(struct ril_radio_caps_manager *mgr,
|
void ril_radio_caps_manager_remove_handler(struct ril_radio_caps_manager *mgr,
|
||||||
gulong id);
|
gulong id);
|
||||||
|
void ril_radio_caps_manager_remove_handlers(struct ril_radio_caps_manager *mgr,
|
||||||
|
gulong *ids, int count);
|
||||||
|
#define ril_radio_caps_manager_remove_all_handlers(mgr, ids) \
|
||||||
|
ril_radio_caps_manager_remove_handlers(mgr, ids, G_N_ELEMENTS(ids))
|
||||||
|
|
||||||
/* And one ril_radio_caps object per modem */
|
/* And one ril_radio_caps object per modem */
|
||||||
|
|
||||||
|
struct ril_radio_caps {
|
||||||
|
struct ril_radio_caps_manager *mgr;
|
||||||
|
enum ofono_radio_access_mode supported_modes;
|
||||||
|
};
|
||||||
|
|
||||||
struct ril_radio_caps *ril_radio_caps_new(struct ril_radio_caps_manager *mgr,
|
struct ril_radio_caps *ril_radio_caps_new(struct ril_radio_caps_manager *mgr,
|
||||||
const char *log_prefix, GRilIoChannel *io,
|
const char *log_prefix, GRilIoChannel *io,
|
||||||
|
struct ofono_watch *watch,
|
||||||
struct ril_data *data, struct ril_radio *radio,
|
struct ril_data *data, struct ril_radio *radio,
|
||||||
struct ril_sim_card *sim, struct ril_network *net,
|
struct ril_sim_card *sim, struct ril_sim_settings *settings,
|
||||||
const struct ril_slot_config *config,
|
const struct ril_slot_config *config,
|
||||||
const struct ril_radio_capability *cap);
|
const struct ril_radio_capability *cap);
|
||||||
struct ril_radio_caps *ril_radio_caps_ref(struct ril_radio_caps *caps);
|
struct ril_radio_caps *ril_radio_caps_ref(struct ril_radio_caps *caps);
|
||||||
void ril_radio_caps_unref(struct ril_radio_caps *caps);
|
void ril_radio_caps_unref(struct ril_radio_caps *caps);
|
||||||
|
void ril_radio_caps_drop(struct ril_radio_caps *caps);
|
||||||
|
gulong ril_radio_caps_add_supported_modes_handler
|
||||||
|
(struct ril_radio_caps *caps,
|
||||||
|
ril_radio_caps_cb_t cb, void *arg);
|
||||||
|
void ril_radio_caps_remove_handler(struct ril_radio_caps *caps, gulong id);
|
||||||
|
|
||||||
|
/* Data requests */
|
||||||
|
|
||||||
|
struct ril_radio_caps_request *ril_radio_caps_request_new
|
||||||
|
(struct ril_radio_caps *caps, enum ofono_radio_access_mode mode,
|
||||||
|
enum ril_data_role role);
|
||||||
|
void ril_radio_caps_request_free(struct ril_radio_caps_request *req);
|
||||||
|
|
||||||
#endif /* RIL_RADIO_CAPS_H */
|
#endif /* RIL_RADIO_CAPS_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2018 Jolla Ltd.
|
* Copyright (C) 2016-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -45,6 +45,8 @@ gulong ril_sim_settings_add_pref_mode_changed_handler(struct ril_sim_settings *s
|
|||||||
void ril_sim_settings_remove_handler(struct ril_sim_settings *s, gulong id);
|
void ril_sim_settings_remove_handler(struct ril_sim_settings *s, gulong id);
|
||||||
void ril_sim_settings_remove_handlers(struct ril_sim_settings *s, gulong *ids,
|
void ril_sim_settings_remove_handlers(struct ril_sim_settings *s, gulong *ids,
|
||||||
int count);
|
int count);
|
||||||
|
#define ril_sim_settings_remove_all_handlers(s,ids) \
|
||||||
|
ril_sim_settings_remove_handlers(s, ids, G_N_ELEMENTS(ids))
|
||||||
|
|
||||||
#endif /* RIL_SIM_SETTINGS_H */
|
#endif /* RIL_SIM_SETTINGS_H */
|
||||||
|
|
||||||
|
|||||||
@@ -339,3 +339,29 @@ socket=/dev/socket/rild
|
|||||||
# Default true (false for MTK RILs)
|
# Default true (false for MTK RILs)
|
||||||
#
|
#
|
||||||
#forceGsmWhenRadioOff=true
|
#forceGsmWhenRadioOff=true
|
||||||
|
|
||||||
|
# Configures a period between RIL_UNSOL_CELL_INFO_LIST events when the device
|
||||||
|
# is awake. Possible values are:
|
||||||
|
#
|
||||||
|
# 0 = invoke RIL_UNSOL_CELL_INFO_LIST when any of the reported information
|
||||||
|
# changes
|
||||||
|
# 1..INT_MAX-1 (2147483646) = sets update period in milliseconds
|
||||||
|
# negative value or INT_MAX = never issue a RIL_UNSOL_CELL_INFO_LIST
|
||||||
|
#
|
||||||
|
# On MediaTek devices the period of RIL_UNSOL_CELL_INFO_LIST events can't be
|
||||||
|
# configured. The parameter RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE has
|
||||||
|
# non-standard meaning:
|
||||||
|
#
|
||||||
|
# 0 = enable RIL_UNSOL_CELL_INFO_LIST
|
||||||
|
# any other value = disable RIL_UNSOL_CELL_INFO_LIST
|
||||||
|
#
|
||||||
|
# Default 2000
|
||||||
|
#
|
||||||
|
#cellInfoIntervalShortMs=2000
|
||||||
|
|
||||||
|
# Configures period between RIL_UNSOL_CELL_INFO_LIST events when the device is
|
||||||
|
# in a power saving mode. For possible values, look cellInfoIntervalShortMs.
|
||||||
|
#
|
||||||
|
# Default 30000
|
||||||
|
#
|
||||||
|
#cellInfoIntervalLongMs=30000
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <grilio_types.h>
|
#include <grilio_types.h>
|
||||||
#include <gutil_macros.h>
|
#include <gutil_macros.h>
|
||||||
|
|
||||||
|
struct ofono_watch;
|
||||||
struct ofono_modem;
|
struct ofono_modem;
|
||||||
struct ofono_sim;
|
struct ofono_sim;
|
||||||
|
|
||||||
@@ -49,6 +50,12 @@ struct ril_network;
|
|||||||
struct ril_sim_card;
|
struct ril_sim_card;
|
||||||
struct ril_vendor;
|
struct ril_vendor;
|
||||||
|
|
||||||
|
enum ril_data_role {
|
||||||
|
RIL_DATA_ROLE_NONE, /* Mobile data not required */
|
||||||
|
RIL_DATA_ROLE_MMS, /* Data is needed at any speed */
|
||||||
|
RIL_DATA_ROLE_INTERNET /* Data is needed at full speed */
|
||||||
|
};
|
||||||
|
|
||||||
struct ril_slot_config {
|
struct ril_slot_config {
|
||||||
guint slot;
|
guint slot;
|
||||||
enum ofono_radio_access_mode techs;
|
enum ofono_radio_access_mode techs;
|
||||||
@@ -72,6 +79,8 @@ struct ril_slot_config {
|
|||||||
guint mms_data_profile_id;
|
guint mms_data_profile_id;
|
||||||
GUtilInts *local_hangup_reasons;
|
GUtilInts *local_hangup_reasons;
|
||||||
GUtilInts *remote_hangup_reasons;
|
GUtilInts *remote_hangup_reasons;
|
||||||
|
int cell_info_interval_short_ms;
|
||||||
|
int cell_info_interval_long_ms;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* RIL_TYPES_H */
|
#endif /* RIL_TYPES_H */
|
||||||
|
|||||||
@@ -283,6 +283,10 @@ enum ofono_gprs_context_type __ofono_gprs_context_get_assigned_type(
|
|||||||
struct ofono_gprs_context *gc);
|
struct ofono_gprs_context *gc);
|
||||||
|
|
||||||
#include <ofono/radio-settings.h>
|
#include <ofono/radio-settings.h>
|
||||||
|
|
||||||
|
enum ofono_radio_access_mode __ofono_radio_access_max_mode(
|
||||||
|
enum ofono_radio_access_mode modes);
|
||||||
|
|
||||||
#include <ofono/audio-settings.h>
|
#include <ofono/audio-settings.h>
|
||||||
#include <ofono/ctm.h>
|
#include <ofono/ctm.h>
|
||||||
#include <ofono/location-reporting.h>
|
#include <ofono/location-reporting.h>
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "ofono.h"
|
#include "ofono.h"
|
||||||
|
|
||||||
|
#pragma message("PLUGINDIR="PLUGINDIR)
|
||||||
|
|
||||||
static GSList *plugins = NULL;
|
static GSList *plugins = NULL;
|
||||||
|
|
||||||
struct ofono_plugin {
|
struct ofono_plugin {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
* Copyright (C) 2014-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -61,10 +62,22 @@ struct ofono_radio_settings {
|
|||||||
struct ofono_atom *atom;
|
struct ofono_atom *atom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ofono_radio_access_mode __ofono_radio_access_max_mode(
|
||||||
|
enum ofono_radio_access_mode mask)
|
||||||
|
{
|
||||||
|
return (mask & OFONO_RADIO_ACCESS_MODE_LTE) ?
|
||||||
|
OFONO_RADIO_ACCESS_MODE_LTE :
|
||||||
|
(mask & OFONO_RADIO_ACCESS_MODE_UMTS) ?
|
||||||
|
OFONO_RADIO_ACCESS_MODE_UMTS :
|
||||||
|
(mask & OFONO_RADIO_ACCESS_MODE_GSM) ?
|
||||||
|
OFONO_RADIO_ACCESS_MODE_GSM :
|
||||||
|
OFONO_RADIO_ACCESS_MODE_ANY;
|
||||||
|
}
|
||||||
|
|
||||||
#define radio_access_mode_to_string ofono_radio_access_mode_to_string
|
#define radio_access_mode_to_string ofono_radio_access_mode_to_string
|
||||||
const char *ofono_radio_access_mode_to_string(enum ofono_radio_access_mode m)
|
const char *ofono_radio_access_mode_to_string(enum ofono_radio_access_mode m)
|
||||||
{
|
{
|
||||||
switch (m) {
|
switch (__ofono_radio_access_max_mode(m)) {
|
||||||
case OFONO_RADIO_ACCESS_MODE_ANY:
|
case OFONO_RADIO_ACCESS_MODE_ANY:
|
||||||
return "any";
|
return "any";
|
||||||
case OFONO_RADIO_ACCESS_MODE_GSM:
|
case OFONO_RADIO_ACCESS_MODE_GSM:
|
||||||
@@ -76,6 +89,10 @@ const char *ofono_radio_access_mode_to_string(enum ofono_radio_access_mode m)
|
|||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return (m == OFONO_RADIO_ACCESS_MODE_ANY) ? "any" :
|
||||||
|
(m & OFONO_RADIO_ACCESS_MODE_LTE) ? "lte" :
|
||||||
|
(m & OFONO_RADIO_ACCESS_MODE_UMTS) ? "umts" :
|
||||||
|
(m & OFONO_RADIO_ACCESS_MODE_GSM) ? "gsm" : NULL;
|
||||||
}
|
}
|
||||||
#define radio_access_mode_from_string ofono_radio_access_mode_from_string
|
#define radio_access_mode_from_string ofono_radio_access_mode_from_string
|
||||||
ofono_bool_t ofono_radio_access_mode_from_string(const char *str,
|
ofono_bool_t ofono_radio_access_mode_from_string(const char *str,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -1757,7 +1758,7 @@ gboolean sms_udh_iter_init_from_cbs(const struct cbs *cbs,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
hdr = cbs->ud;
|
hdr = cbs->ud;
|
||||||
max_ud_len = 82;
|
max_ud_len = cbs->udlen;
|
||||||
|
|
||||||
/* Must have at least one information-element if udhi is true */
|
/* Must have at least one information-element if udhi is true */
|
||||||
if (hdr[0] < 2)
|
if (hdr[0] < 2)
|
||||||
@@ -3856,8 +3857,8 @@ gboolean cbs_dcs_decode(guint8 dcs, gboolean *udhi, enum sms_class *cls,
|
|||||||
|
|
||||||
gboolean cbs_decode(const unsigned char *pdu, int len, struct cbs *out)
|
gboolean cbs_decode(const unsigned char *pdu, int len, struct cbs *out)
|
||||||
{
|
{
|
||||||
/* CBS is always a fixed length of 88 bytes */
|
/* CBS is (almost) always a fixed length of 88 bytes */
|
||||||
if (len != 88)
|
if (len < 6 || len > 88)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
out->gs = (enum cbs_geo_scope) ((pdu[0] >> 6) & 0x03);
|
out->gs = (enum cbs_geo_scope) ((pdu[0] >> 6) & 0x03);
|
||||||
@@ -3868,6 +3869,10 @@ gboolean cbs_decode(const unsigned char *pdu, int len, struct cbs *out)
|
|||||||
out->max_pages = pdu[5] & 0xf;
|
out->max_pages = pdu[5] & 0xf;
|
||||||
out->page = (pdu[5] >> 4) & 0xf;
|
out->page = (pdu[5] >> 4) & 0xf;
|
||||||
|
|
||||||
|
/* Allow the last fragment to be truncated */
|
||||||
|
if (len != 88 && out->max_pages != out->page)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a mobile receives the code 0000 in either the first field or
|
* If a mobile receives the code 0000 in either the first field or
|
||||||
* the second field then it shall treat the CBS message exactly the
|
* the second field then it shall treat the CBS message exactly the
|
||||||
@@ -3879,7 +3884,10 @@ gboolean cbs_decode(const unsigned char *pdu, int len, struct cbs *out)
|
|||||||
out->page = 1;
|
out->page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(out->ud, pdu + 6, 82);
|
out->udlen = (guint8)(len - 6);
|
||||||
|
memcpy(out->ud, pdu + 6, out->udlen);
|
||||||
|
if (out->udlen < 82)
|
||||||
|
memset(out->ud + out->udlen, 0, 82 - out->udlen);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -4072,7 +4080,7 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
|
|||||||
if (iso639)
|
if (iso639)
|
||||||
bufsize -= 3;
|
bufsize -= 3;
|
||||||
} else {
|
} else {
|
||||||
bufsize += 82;
|
bufsize += cbs->udlen;
|
||||||
|
|
||||||
if (iso639)
|
if (iso639)
|
||||||
bufsize -= 2;
|
bufsize -= 2;
|
||||||
@@ -4089,7 +4097,7 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
|
|||||||
if (sms_udh_iter_init_from_cbs(cbs, &iter))
|
if (sms_udh_iter_init_from_cbs(cbs, &iter))
|
||||||
taken = sms_udh_iter_get_udh_length(&iter) + 1;
|
taken = sms_udh_iter_get_udh_length(&iter) + 1;
|
||||||
|
|
||||||
unpack_7bit_own_buf(cbs->ud + taken, 82 - taken,
|
unpack_7bit_own_buf(cbs->ud + taken, cbs->udlen - taken,
|
||||||
taken, FALSE, 2,
|
taken, FALSE, 2,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
(unsigned char *)iso639_lang);
|
(unsigned char *)iso639_lang);
|
||||||
@@ -4122,7 +4130,7 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
|
|||||||
max_chars =
|
max_chars =
|
||||||
sms_text_capacity_gsm(CBS_MAX_GSM_CHARS, taken);
|
sms_text_capacity_gsm(CBS_MAX_GSM_CHARS, taken);
|
||||||
|
|
||||||
unpack_7bit_own_buf(ud + taken, 82 - taken,
|
unpack_7bit_own_buf(ud + taken, cbs->udlen - taken,
|
||||||
taken, FALSE, max_chars,
|
taken, FALSE, max_chars,
|
||||||
&written, 0, unpacked);
|
&written, 0, unpacked);
|
||||||
|
|
||||||
@@ -4156,7 +4164,7 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
|
|||||||
* the check here since the specification isn't clear
|
* the check here since the specification isn't clear
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
int num_ucs2_chars = (82 - taken) >> 1;
|
int num_ucs2_chars = (cbs->udlen - taken) >> 1;
|
||||||
int i = taken;
|
int i = taken;
|
||||||
int max_offset = taken + num_ucs2_chars * 2;
|
int max_offset = taken + num_ucs2_chars * 2;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -398,6 +399,7 @@ struct cbs {
|
|||||||
guint8 dcs; /* 8 bits */
|
guint8 dcs; /* 8 bits */
|
||||||
guint8 max_pages; /* 4 bits */
|
guint8 max_pages; /* 4 bits */
|
||||||
guint8 page; /* 4 bits */
|
guint8 page; /* 4 bits */
|
||||||
|
guint8 udlen;
|
||||||
guint8 ud[82];
|
guint8 ud[82];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -349,12 +349,12 @@ static int tone_queue(struct ofono_voicecall *vc, const char *tone_str,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Tones can be 0-9, *, #, A-D according to 27.007 C.2.11,
|
* Tones can be 0-9, *, #, A-D according to 27.007 C.2.11,
|
||||||
* and p for Pause.
|
* and p for Pause (also , for Pause as per ITU-T V.250 6.3.1.2).
|
||||||
*/
|
*/
|
||||||
for (i = 0; tone_str[i]; i++)
|
for (i = 0; tone_str[i]; i++)
|
||||||
if (!g_ascii_isdigit(tone_str[i]) && tone_str[i] != 'p' &&
|
if (!g_ascii_isdigit(tone_str[i]) && tone_str[i] != 'p' &&
|
||||||
tone_str[i] != 'P' && tone_str[i] != '*' &&
|
tone_str[i] != 'P' && tone_str[i] != '*' &&
|
||||||
tone_str[i] != '.' && tone_str[i] != ',' &&
|
tone_str[i] != ',' &&
|
||||||
tone_str[i] != '#' && (tone_str[i] < 'A' ||
|
tone_str[i] != '#' && (tone_str[i] < 'A' ||
|
||||||
tone_str[i] > 'D'))
|
tone_str[i] > 'D'))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -4389,7 +4389,7 @@ static void tone_request_cb(const struct ofono_error *error, void *data)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strspn(entry->left, "pP.,");
|
len = strspn(entry->left, "pP,");
|
||||||
entry->left += len;
|
entry->left += len;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@@ -4423,7 +4423,7 @@ static gboolean tone_request_run(gpointer user_data)
|
|||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
len = strcspn(entry->left, "pP.,");
|
len = strcspn(entry->left, "pP,");
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
if (len > 8) /* Arbitrary length limit per request */
|
if (len > 8) /* Arbitrary length limit per request */
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ Name: ofono
|
|||||||
Summary: Open Source Telephony
|
Summary: Open Source Telephony
|
||||||
Version: 1.23
|
Version: 1.23
|
||||||
Release: 1
|
Release: 1
|
||||||
Group: Communications/Connectivity Adaptation
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: https://git.sailfishos.org/mer-core/ofono
|
URL: https://git.sailfishos.org/mer-core/ofono
|
||||||
Source: %{name}-%{version}.tar.bz2
|
Source: %{name}-%{version}.tar.bz2
|
||||||
@@ -38,13 +37,13 @@ BuildRequires: pkgconfig(mobile-broadband-provider-info)
|
|||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
|
BuildRequires: systemd
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Telephony stack
|
Telephony stack
|
||||||
|
|
||||||
%package devel
|
%package devel
|
||||||
Summary: Headers for oFono
|
Summary: Headers for oFono
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
%description devel
|
%description devel
|
||||||
@@ -52,7 +51,6 @@ Development headers and libraries for oFono
|
|||||||
|
|
||||||
%package tests
|
%package tests
|
||||||
Summary: Test Scripts for oFono
|
Summary: Test Scripts for oFono
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
Requires: dbus-python3
|
Requires: dbus-python3
|
||||||
Requires: python3-gobject
|
Requires: python3-gobject
|
||||||
@@ -64,7 +62,6 @@ Scripts for testing oFono and its functionality
|
|||||||
|
|
||||||
%package configs-mer
|
%package configs-mer
|
||||||
Summary: Package to provide default configs for ofono
|
Summary: Package to provide default configs for ofono
|
||||||
Group: Development/Tools
|
|
||||||
Provides: ofono-configs
|
Provides: ofono-configs
|
||||||
|
|
||||||
%description configs-mer
|
%description configs-mer
|
||||||
@@ -72,7 +69,6 @@ This package provides default configs for ofono
|
|||||||
|
|
||||||
%package doc
|
%package doc
|
||||||
Summary: Documentation for %{name}
|
Summary: Documentation for %{name}
|
||||||
Group: Documentation
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
%description doc
|
%description doc
|
||||||
@@ -98,9 +94,9 @@ autoreconf --force --install
|
|||||||
--disable-add-remove-context \
|
--disable-add-remove-context \
|
||||||
--disable-isimodem \
|
--disable-isimodem \
|
||||||
--disable-qmimodem \
|
--disable-qmimodem \
|
||||||
--with-systemdunitdir="/%{_lib}/systemd/system"
|
--with-systemdunitdir=%{_unitdir}
|
||||||
|
|
||||||
make %{_smp_mflags}
|
%make_build
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# run unit tests
|
# run unit tests
|
||||||
@@ -111,9 +107,9 @@ rm -rf %{buildroot}
|
|||||||
%make_install
|
%make_install
|
||||||
|
|
||||||
mkdir -p %{buildroot}/%{_sysconfdir}/ofono/push_forwarder.d
|
mkdir -p %{buildroot}/%{_sysconfdir}/ofono/push_forwarder.d
|
||||||
mkdir -p %{buildroot}/%{_lib}/systemd/system/network.target.wants
|
mkdir -p %{buildroot}%{_unitdir}/network.target.wants
|
||||||
mkdir -p %{buildroot}/var/lib/ofono
|
mkdir -p %{buildroot}/var/lib/ofono
|
||||||
ln -s ../ofono.service %{buildroot}/%{_lib}/systemd/system/network.target.wants/ofono.service
|
ln -s ../ofono.service %{buildroot}%{_unitdir}/network.target.wants/ofono.service
|
||||||
|
|
||||||
mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
|
mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
|
||||||
install -m0644 -t %{buildroot}%{_docdir}/%{name}-%{version} \
|
install -m0644 -t %{buildroot}%{_docdir}/%{name}-%{version} \
|
||||||
@@ -139,8 +135,8 @@ systemctl daemon-reload ||:
|
|||||||
%license COPYING
|
%license COPYING
|
||||||
%config %{_sysconfdir}/dbus-1/system.d/*.conf
|
%config %{_sysconfdir}/dbus-1/system.d/*.conf
|
||||||
%{_sbindir}/*
|
%{_sbindir}/*
|
||||||
/%{_lib}/systemd/system/network.target.wants/ofono.service
|
%{_unitdir}/network.target.wants/ofono.service
|
||||||
/%{_lib}/systemd/system/ofono.service
|
%{_unitdir}/ofono.service
|
||||||
%dir %{_sysconfdir}/ofono/
|
%dir %{_sysconfdir}/ofono/
|
||||||
%dir %{_sysconfdir}/ofono/push_forwarder.d
|
%dir %{_sysconfdir}/ofono/push_forwarder.d
|
||||||
# This file is part of phonesim and not needed with ofono.
|
# This file is part of phonesim and not needed with ofono.
|
||||||
|
|||||||
Reference in New Issue
Block a user