mirror of
https://github.com/sailfishos/ofono
synced 2025-11-25 20:01:05 +08:00
Compare commits
43 Commits
mer/1.17+g
...
upgrade-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bf4c9cda7 | ||
|
|
3b4ce1f47b | ||
|
|
d8aefd40c4 | ||
|
|
e79055354c | ||
|
|
5e75f650c3 | ||
|
|
ae782ca6f2 | ||
|
|
b929a8e8c8 | ||
|
|
530c3bc812 | ||
|
|
0e1a58781f | ||
|
|
77a26177e5 | ||
|
|
f6ea7e4c36 | ||
|
|
babea14604 | ||
|
|
e13ae6d5b3 | ||
|
|
40ce8f7185 | ||
|
|
f68585a784 | ||
|
|
16105b8ace | ||
|
|
91245de799 | ||
|
|
c52471132a | ||
|
|
a8e7b86733 | ||
|
|
8829682fad | ||
|
|
246e30d1a5 | ||
|
|
83267e1fa5 | ||
|
|
e1ab11ad25 | ||
|
|
a9193282d5 | ||
|
|
f80bb5c5bb | ||
|
|
66eb87777f | ||
|
|
e5291006fd | ||
|
|
c609d7cc07 | ||
|
|
0de562b019 | ||
|
|
60b11f712c | ||
|
|
80d347b964 | ||
|
|
97abd10984 | ||
|
|
5201fc0183 | ||
|
|
14e4ef8e07 | ||
|
|
22bc6d526e | ||
|
|
baa4fe30e5 | ||
|
|
d0d0793ccb | ||
|
|
55dd461ce7 | ||
|
|
4da1a30290 | ||
|
|
303f527d79 | ||
|
|
27e8621c0b | ||
|
|
200237372a | ||
|
|
9cae262c80 |
@@ -127,6 +127,7 @@ builtin_sources += drivers/ril/ril_call_barring.c \
|
||||
drivers/ril/ril_call_volume.c \
|
||||
drivers/ril/ril_cell_info.c \
|
||||
drivers/ril/ril_cell_info_dbus.c \
|
||||
drivers/ril/ril_config.c \
|
||||
drivers/ril/ril_cbs.c \
|
||||
drivers/ril/ril_data.c \
|
||||
drivers/ril/ril_devinfo.c \
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
Debug log control
|
||||
=================
|
||||
|
||||
Service org.ofono
|
||||
Interface org.ofono.DebugLog
|
||||
Object path /
|
||||
|
||||
Methods void Enable(string pattern)
|
||||
|
||||
Enables all logs that match the pattern.
|
||||
|
||||
void Disable(string pattern)
|
||||
|
||||
Disables all logs that match the pattern.
|
||||
|
||||
array(string,boolean) List()
|
||||
|
||||
Returns all available log names and their current
|
||||
states.
|
||||
|
||||
In order for Enable or Disable call to have any
|
||||
effect, the pattern must match one or more of
|
||||
these strings.
|
||||
|
||||
Signals Changed(string name, boolean enabled)
|
||||
|
||||
This signal indicates a changed log status of the
|
||||
given log module.
|
||||
@@ -1516,7 +1516,7 @@ static void at_lock_status_cb(gboolean ok, GAtResult *result,
|
||||
{
|
||||
struct cb_data *cbd = user_data;
|
||||
GAtResultIter iter;
|
||||
ofono_sim_locked_cb_t cb = cbd->cb;
|
||||
ofono_query_facility_lock_cb_t cb = cbd->cb;
|
||||
struct ofono_error error;
|
||||
int locked;
|
||||
|
||||
@@ -1541,9 +1541,9 @@ static void at_lock_status_cb(gboolean ok, GAtResult *result,
|
||||
cb(&error, locked, cbd->data);
|
||||
}
|
||||
|
||||
static void at_pin_query_enabled(struct ofono_sim *sim,
|
||||
static void at_query_clck(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type passwd_type,
|
||||
ofono_sim_locked_cb_t cb, void *data)
|
||||
ofono_query_facility_lock_cb_t cb, void *data)
|
||||
{
|
||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
@@ -1626,7 +1626,7 @@ static struct ofono_sim_driver driver = {
|
||||
.reset_passwd = at_pin_send_puk,
|
||||
.lock = at_pin_enable,
|
||||
.change_passwd = at_change_passwd,
|
||||
.query_locked = at_pin_query_enabled,
|
||||
.query_facility_lock = at_query_clck,
|
||||
};
|
||||
|
||||
static struct ofono_sim_driver driver_noef = {
|
||||
@@ -1640,7 +1640,7 @@ static struct ofono_sim_driver driver_noef = {
|
||||
.reset_passwd = at_pin_send_puk,
|
||||
.lock = at_pin_enable,
|
||||
.change_passwd = at_change_passwd,
|
||||
.query_locked = at_pin_query_enabled,
|
||||
.query_facility_lock = at_query_clck,
|
||||
};
|
||||
|
||||
void at_sim_init(void)
|
||||
|
||||
@@ -652,7 +652,7 @@ static void sec_code_state_resp_cb(const GIsiMessage *msg, void *opaque)
|
||||
|
||||
static void isi_query_locked(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type passwd_type,
|
||||
ofono_sim_locked_cb_t cb, void *data)
|
||||
ofono_query_facility_lock_cb_t cb, void *data)
|
||||
{
|
||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
struct isi_cb_data *cbd = isi_cb_data_new(sim, cb, data);
|
||||
@@ -963,7 +963,7 @@ static struct ofono_sim_driver driver = {
|
||||
.reset_passwd = isi_reset_passwd,
|
||||
.lock = isi_lock,
|
||||
.change_passwd = isi_change_passwd,
|
||||
.query_locked = isi_query_locked,
|
||||
.query_facility_lock = isi_query_locked,
|
||||
};
|
||||
|
||||
void isi_sim_init(void)
|
||||
|
||||
@@ -1032,14 +1032,6 @@ static void uicc_lock(struct ofono_sim *sim, enum ofono_sim_password_type type,
|
||||
CALLBACK_WITH_FAILURE(cb, data);
|
||||
}
|
||||
|
||||
static void uicc_query_locked(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type type,
|
||||
ofono_sim_locked_cb_t cb, void *data)
|
||||
{
|
||||
DBG("Not implemented");
|
||||
CALLBACK_WITH_FAILURE(cb, -1, data);
|
||||
}
|
||||
|
||||
static gboolean decode_fcp_pin_status(const GIsiSubBlockIter *iter, uint8_t read,
|
||||
uint8_t *pin1, uint8_t *pin2)
|
||||
{
|
||||
@@ -1677,7 +1669,6 @@ static struct ofono_sim_driver driver = {
|
||||
.reset_passwd = uicc_reset_passwd,
|
||||
.change_passwd = uicc_change_passwd,
|
||||
.lock = uicc_lock,
|
||||
.query_locked = uicc_query_locked,
|
||||
};
|
||||
|
||||
void isi_uicc_init(void)
|
||||
|
||||
@@ -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
|
||||
@@ -25,14 +25,16 @@ struct ril_call_forward {
|
||||
guint timer_id;
|
||||
};
|
||||
|
||||
enum ril_call_forward_cmd {
|
||||
enum ril_call_forward_action {
|
||||
CF_ACTION_DISABLE,
|
||||
CF_ACTION_ENABLE,
|
||||
CF_ACTION_UNUSED,
|
||||
CF_ACTION_INTERROGATE,
|
||||
CF_ACTION_REGISTRATION,
|
||||
CF_ACTION_ERASURE
|
||||
};
|
||||
|
||||
#define CF_TIME_DEFAULT (0)
|
||||
|
||||
struct ril_call_forward_cbd {
|
||||
struct ril_call_forward *fd;
|
||||
union _ofono_call_forward_cb {
|
||||
@@ -43,35 +45,57 @@ struct ril_call_forward_cbd {
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
#define ril_call_forward_cbd_free g_free
|
||||
|
||||
static inline struct ril_call_forward *ril_call_forward_get_data(
|
||||
struct ofono_call_forwarding *cf)
|
||||
{
|
||||
return ofono_call_forwarding_get_data(cf);
|
||||
}
|
||||
|
||||
static void ril_call_forward_cbd_free(gpointer cbd)
|
||||
{
|
||||
g_slice_free(struct ril_call_forward_cbd, cbd);
|
||||
}
|
||||
|
||||
static struct ril_call_forward_cbd *ril_call_forward_cbd_new(void *cb,
|
||||
void *data)
|
||||
{
|
||||
struct ril_call_forward_cbd *cbd;
|
||||
|
||||
cbd = g_new0(struct ril_call_forward_cbd, 1);
|
||||
cbd = g_slice_new0(struct ril_call_forward_cbd);
|
||||
cbd->cb.ptr = cb;
|
||||
cbd->data = data;
|
||||
return cbd;
|
||||
}
|
||||
|
||||
static inline void ril_call_forward_submit_request(struct ril_call_forward *fd,
|
||||
GRilIoRequest* req, guint code, GRilIoChannelResponseFunc response,
|
||||
void *cb, void *data)
|
||||
static GRilIoRequest *ril_call_forward_req(enum ril_call_forward_action action,
|
||||
int type, int cls, const struct ofono_phone_number *number, int time)
|
||||
{
|
||||
grilio_queue_send_request_full(fd->q, req, code, response,
|
||||
ril_call_forward_cbd_free,
|
||||
ril_call_forward_cbd_new(cb, data));
|
||||
GRilIoRequest *req = grilio_request_new();
|
||||
|
||||
/*
|
||||
* Modem seems to respond with error to all requests
|
||||
* made with bearer class BEARER_CLASS_DEFAULT.
|
||||
*/
|
||||
if (cls == BEARER_CLASS_DEFAULT) {
|
||||
cls = SERVICE_CLASS_NONE;
|
||||
}
|
||||
|
||||
grilio_request_append_int32(req, action);
|
||||
grilio_request_append_int32(req, type);
|
||||
grilio_request_append_int32(req, cls); /* Service class */
|
||||
if (number) {
|
||||
grilio_request_append_int32(req, number->type);
|
||||
grilio_request_append_utf8(req, number->number);
|
||||
} else {
|
||||
grilio_request_append_int32(req, 0x81); /* TOA unknown */
|
||||
grilio_request_append_utf8(req, NULL); /* No number */
|
||||
}
|
||||
grilio_request_append_int32(req, time);
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
static void ril_forward_set_cb(GRilIoChannel *io, int status,
|
||||
static void ril_call_forward_set_cb(GRilIoChannel *io, int status,
|
||||
const void *data, guint len, void *user_data)
|
||||
{
|
||||
struct ofono_error error;
|
||||
@@ -86,93 +110,51 @@ static void ril_forward_set_cb(GRilIoChannel *io, int status,
|
||||
}
|
||||
}
|
||||
|
||||
static void ril_call_forward_set(struct ofono_call_forwarding *cf,
|
||||
enum ril_call_forward_action cmd, int type, int cls,
|
||||
const struct ofono_phone_number *number, int time,
|
||||
ofono_call_forwarding_set_cb_t cb, void *data)
|
||||
{
|
||||
struct ril_call_forward *fd = ril_call_forward_get_data(cf);
|
||||
GRilIoRequest *req = ril_call_forward_req(cmd, type, cls, number, time);
|
||||
|
||||
grilio_queue_send_request_full(fd->q, req, RIL_REQUEST_SET_CALL_FORWARD,
|
||||
ril_call_forward_set_cb, ril_call_forward_cbd_free,
|
||||
ril_call_forward_cbd_new(cb, data));
|
||||
grilio_request_unref(req);
|
||||
}
|
||||
|
||||
static void ril_call_forward_registration(struct ofono_call_forwarding *cf,
|
||||
int type, int cls, const struct ofono_phone_number *number,
|
||||
int time, ofono_call_forwarding_set_cb_t cb, void *data)
|
||||
{
|
||||
struct ril_call_forward *fd = ril_call_forward_get_data(cf);
|
||||
GRilIoRequest *req = grilio_request_new();
|
||||
|
||||
ofono_info("cf registration");
|
||||
grilio_request_append_int32(req, CF_ACTION_REGISTRATION);
|
||||
grilio_request_append_int32(req, type);
|
||||
|
||||
/*
|
||||
* Modem seems to respond with error to all queries
|
||||
* or settings made with bearer class
|
||||
* BEARER_CLASS_DEFAULT. Design decision: If given
|
||||
* class is BEARER_CLASS_DEFAULT let's map it to
|
||||
* BEARER_CLASS_VOICE as per RIL design.
|
||||
*/
|
||||
if (cls == BEARER_CLASS_DEFAULT) {
|
||||
cls = BEARER_CLASS_VOICE;
|
||||
}
|
||||
|
||||
grilio_request_append_int32(req, cls);
|
||||
grilio_request_append_int32(req, number->type);
|
||||
grilio_request_append_utf8(req, number->number);
|
||||
grilio_request_append_int32(req, time);
|
||||
|
||||
ril_call_forward_submit_request(fd, req, RIL_REQUEST_SET_CALL_FORWARD,
|
||||
ril_forward_set_cb, cb, data);
|
||||
grilio_request_unref(req);
|
||||
}
|
||||
|
||||
static void ril_call_forward_send_cmd(struct ofono_call_forwarding *cf,
|
||||
int type, int cls, ofono_call_forwarding_set_cb_t cb,
|
||||
void *data, int action)
|
||||
{
|
||||
struct ril_call_forward *fd = ril_call_forward_get_data(cf);
|
||||
GRilIoRequest *req = grilio_request_new();
|
||||
|
||||
grilio_request_append_int32(req, action);
|
||||
grilio_request_append_int32(req, type);
|
||||
|
||||
/*
|
||||
* Modem seems to respond with error to all queries
|
||||
* or settings made with bearer class
|
||||
* BEARER_CLASS_DEFAULT. Design decision: If given
|
||||
* class is BEARER_CLASS_DEFAULT let's map it to
|
||||
* BEARER_CLASS_VOICE as per RIL design.
|
||||
*/
|
||||
if (cls == BEARER_CLASS_DEFAULT) {
|
||||
cls = BEARER_CLASS_VOICE;
|
||||
}
|
||||
|
||||
grilio_request_append_int32(req, cls); /* Service class */
|
||||
|
||||
/* Following 3 values have no real meaning in erasure
|
||||
* but apparently RIL expects them so fields need to
|
||||
* be filled. Otherwise there is no response
|
||||
*/
|
||||
grilio_request_append_int32(req, 0x81); /* TOA unknown */
|
||||
grilio_request_append_utf8(req, "1234567890");
|
||||
grilio_request_append_int32(req, 60);
|
||||
|
||||
ril_call_forward_submit_request(fd, req, RIL_REQUEST_SET_CALL_FORWARD,
|
||||
ril_forward_set_cb, cb, data);
|
||||
grilio_request_unref(req);
|
||||
ril_call_forward_set(cf, CF_ACTION_REGISTRATION, type, cls,
|
||||
number, time, cb, data);
|
||||
}
|
||||
|
||||
static void ril_call_forward_erasure(struct ofono_call_forwarding *cf,
|
||||
int type, int cls, ofono_call_forwarding_set_cb_t cb, void *data)
|
||||
{
|
||||
ofono_info("CF_ACTION_ERASURE");
|
||||
ril_call_forward_send_cmd(cf, type, cls, cb, data, CF_ACTION_ERASURE);
|
||||
ofono_info("cf erasure");
|
||||
ril_call_forward_set(cf, CF_ACTION_ERASURE, type, cls,
|
||||
NULL, CF_TIME_DEFAULT, cb, data);
|
||||
}
|
||||
|
||||
static void ril_call_forward_deactivate(struct ofono_call_forwarding *cf,
|
||||
int type, int cls, ofono_call_forwarding_set_cb_t cb, void *data)
|
||||
{
|
||||
ofono_info("CF_ACTION_DISABLE");
|
||||
ril_call_forward_send_cmd(cf, type, cls, cb, data, CF_ACTION_DISABLE);
|
||||
ofono_info("cf disable");
|
||||
ril_call_forward_set(cf, CF_ACTION_DISABLE, type, cls,
|
||||
NULL, CF_TIME_DEFAULT, cb, data);
|
||||
}
|
||||
|
||||
static void ril_call_forward_activate(struct ofono_call_forwarding *cf,
|
||||
int type, int cls, ofono_call_forwarding_set_cb_t cb, void *data)
|
||||
{
|
||||
ofono_info("CF_ACTION_ENABLE");
|
||||
ril_call_forward_send_cmd(cf, type, cls, cb, data, CF_ACTION_ENABLE);
|
||||
ofono_info("cf enable");
|
||||
ril_call_forward_set(cf, CF_ACTION_ENABLE, type, cls,
|
||||
NULL, CF_TIME_DEFAULT, cb, data);
|
||||
}
|
||||
|
||||
static void ril_call_forward_query_cb(GRilIoChannel *io, int status,
|
||||
@@ -223,36 +205,14 @@ static void ril_call_forward_query(struct ofono_call_forwarding *cf, int type,
|
||||
int cls, ofono_call_forwarding_query_cb_t cb, void *data)
|
||||
{
|
||||
struct ril_call_forward *fd = ril_call_forward_get_data(cf);
|
||||
GRilIoRequest *req = grilio_request_new();
|
||||
GRilIoRequest *req = ril_call_forward_req(CF_ACTION_INTERROGATE,
|
||||
type, cls, NULL, CF_TIME_DEFAULT);
|
||||
|
||||
ofono_info("cf query");
|
||||
grilio_request_append_int32(req, 2);
|
||||
grilio_request_append_int32(req, type);
|
||||
|
||||
/*
|
||||
* Modem seems to respond with error to all queries
|
||||
* or settings made with bearer class
|
||||
* BEARER_CLASS_DEFAULT. Design decision: If given
|
||||
* class is BEARER_CLASS_DEFAULT let's map it to
|
||||
* SERVICE_CLASS_NONE as per RIL design.
|
||||
*/
|
||||
if (cls == BEARER_CLASS_DEFAULT) {
|
||||
cls = SERVICE_CLASS_NONE;
|
||||
}
|
||||
|
||||
grilio_request_append_int32(req, cls);
|
||||
|
||||
/* Following 3 values have no real meaning in query
|
||||
* but apparently RIL expects them so fields need to
|
||||
* be filled. Otherwise there is no response
|
||||
*/
|
||||
grilio_request_append_int32(req, 0x81); /* TOA unknown */
|
||||
grilio_request_append_utf8(req, "1234567890");
|
||||
grilio_request_append_int32(req, 0);
|
||||
|
||||
ril_call_forward_submit_request(fd, req,
|
||||
RIL_REQUEST_QUERY_CALL_FORWARD_STATUS,
|
||||
ril_call_forward_query_cb, cb, data);
|
||||
grilio_queue_send_request_full(fd->q, req,
|
||||
RIL_REQUEST_QUERY_CALL_FORWARD_STATUS,
|
||||
ril_call_forward_query_cb, ril_call_forward_cbd_free,
|
||||
ril_call_forward_cbd_new(cb, data));
|
||||
grilio_request_unref(req);
|
||||
}
|
||||
|
||||
@@ -286,7 +246,7 @@ static void ril_call_forward_remove(struct ofono_call_forwarding *cf)
|
||||
DBG("");
|
||||
ofono_call_forwarding_set_data(cf, NULL);
|
||||
|
||||
if (fd->timer_id > 0) {
|
||||
if (fd->timer_id) {
|
||||
g_source_remove(fd->timer_id);
|
||||
}
|
||||
|
||||
|
||||
115
ofono/drivers/ril/ril_config.c
Normal file
115
ofono/drivers/ril/ril_config.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* oFono - Open Source Telephony - RIL-based devices
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "ril_config.h"
|
||||
|
||||
/* Utilities for parsing ril_subscription.conf */
|
||||
|
||||
char* ril_config_get_string(GKeyFile *file, const char *group, const char *key)
|
||||
{
|
||||
char *val = g_key_file_get_string(file, group, key, NULL);
|
||||
|
||||
if (!val && strcmp(group, RILCONF_SETTINGS_GROUP)) {
|
||||
/* Check the common section */
|
||||
val = g_key_file_get_string(file, RILCONF_SETTINGS_GROUP, key,
|
||||
NULL);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
gboolean ril_config_get_integer(GKeyFile *file, const char *group,
|
||||
const char *key, int *out_value)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int value = g_key_file_get_integer(file, group, key, &error);
|
||||
|
||||
if (!error) {
|
||||
if (out_value) {
|
||||
*out_value = value;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
g_error_free(error);
|
||||
if (strcmp(group, RILCONF_SETTINGS_GROUP)) {
|
||||
/* Check the common section */
|
||||
error = NULL;
|
||||
value = g_key_file_get_integer(file,
|
||||
RILCONF_SETTINGS_GROUP, key, &error);
|
||||
if (!error) {
|
||||
if (out_value) {
|
||||
*out_value = value;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
g_error_free(error);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean ril_config_get_boolean(GKeyFile *file, const char *group,
|
||||
const char *key, gboolean *out_value)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gboolean value = g_key_file_get_boolean(file, group, key, &error);
|
||||
|
||||
if (!error) {
|
||||
if (out_value) {
|
||||
*out_value = value;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
g_error_free(error);
|
||||
if (strcmp(group, RILCONF_SETTINGS_GROUP)) {
|
||||
/* Check the common section */
|
||||
error = NULL;
|
||||
value = g_key_file_get_boolean(file,
|
||||
RILCONF_SETTINGS_GROUP, key, &error);
|
||||
if (!error) {
|
||||
if (out_value) {
|
||||
*out_value = value;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
g_error_free(error);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean ril_config_get_flag(GKeyFile *file, const char *group,
|
||||
const char *key, int flag, int *flags)
|
||||
{
|
||||
gboolean value;
|
||||
|
||||
if (ril_config_get_boolean(file, group, key, &value)) {
|
||||
if (value) {
|
||||
*flags |= flag;
|
||||
} else {
|
||||
*flags &= ~flag;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 8
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
41
ofono/drivers/ril/ril_config.h
Normal file
41
ofono/drivers/ril/ril_config.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* oFono - Open Source Telephony - RIL-based devices
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef RIL_CONFIG_H
|
||||
#define RIL_CONFIG_H
|
||||
|
||||
#include "ril_types.h"
|
||||
|
||||
/* Utilities for parsing ril_subscription.conf */
|
||||
|
||||
#define RILCONF_SETTINGS_GROUP "Settings"
|
||||
|
||||
char* ril_config_get_string(GKeyFile *file, const char *group, const char *key);
|
||||
gboolean ril_config_get_integer(GKeyFile *file, const char *group,
|
||||
const char *key, int *value);
|
||||
gboolean ril_config_get_boolean(GKeyFile *file, const char *group,
|
||||
const char *key, gboolean *value);
|
||||
gboolean ril_config_get_flag(GKeyFile *file, const char *group,
|
||||
const char *key, int flag, int *flags);
|
||||
|
||||
#endif /* RIL_CONFIG_H */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 8
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
@@ -99,6 +99,7 @@ struct ril_data_priv {
|
||||
struct ril_data_request *req_queue;
|
||||
struct ril_data_request *pending_req;
|
||||
|
||||
enum ril_data_allow_data_opt allow_data;
|
||||
char *log_prefix;
|
||||
guint query_id;
|
||||
gulong io_event_id;
|
||||
@@ -158,6 +159,7 @@ struct ril_data_request_setup {
|
||||
char *password;
|
||||
enum ofono_gprs_proto proto;
|
||||
enum ofono_gprs_auth_method auth_method;
|
||||
int retry_count;
|
||||
};
|
||||
|
||||
struct ril_data_request_deact {
|
||||
@@ -686,8 +688,6 @@ static void ril_data_call_setup_cb(GRilIoChannel *io, int ril_status,
|
||||
struct ril_data_call_list *list = NULL;
|
||||
struct ril_data_call *call = NULL;
|
||||
|
||||
ril_data_request_completed(req);
|
||||
|
||||
if (ril_status == RIL_E_SUCCESS) {
|
||||
list = ril_data_call_list_parse(data, len);
|
||||
}
|
||||
@@ -701,6 +701,22 @@ static void ril_data_call_setup_cb(GRilIoChannel *io, int ril_status,
|
||||
}
|
||||
}
|
||||
|
||||
if (call && call->status == PDP_FAIL_ERROR_UNSPECIFIED &&
|
||||
!setup->retry_count) {
|
||||
/*
|
||||
* Retry silently according to comment in ril.h
|
||||
* (no more than once though)
|
||||
*/
|
||||
DBG("retrying silently");
|
||||
setup->retry_count++;
|
||||
req->pending_id = 0;
|
||||
req->submit(req);
|
||||
ril_data_call_list_free(list);
|
||||
return;
|
||||
}
|
||||
|
||||
ril_data_request_completed(req);
|
||||
|
||||
if (call && call->status == PDP_FAIL_NONE) {
|
||||
if (ril_data_call_list_move_calls(self->data_calls, list) > 0) {
|
||||
DBG("data call(s) added");
|
||||
@@ -1004,7 +1020,7 @@ static void ril_data_settings_changed(struct ril_sim_settings *settings,
|
||||
|
||||
struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
|
||||
struct ril_radio *radio, struct ril_network *network,
|
||||
GRilIoChannel *io)
|
||||
GRilIoChannel *io, enum ril_data_allow_data_opt opt)
|
||||
{
|
||||
GASSERT(dm);
|
||||
if (G_LIKELY(dm)) {
|
||||
@@ -1013,6 +1029,21 @@ struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
|
||||
struct ril_sim_settings *settings = network->settings;
|
||||
GRilIoRequest *req = grilio_request_new();
|
||||
|
||||
switch (opt) {
|
||||
case RIL_ALLOW_DATA_ON:
|
||||
case RIL_ALLOW_DATA_OFF:
|
||||
priv->allow_data = opt;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* When RIL_REQUEST_ALLOW_DATA first appeared in ril.h
|
||||
* RIL_VERSION was 10
|
||||
*/
|
||||
priv->allow_data = (io->ril_version > 10) ?
|
||||
RIL_ALLOW_DATA_ON : RIL_ALLOW_DATA_OFF;
|
||||
break;
|
||||
}
|
||||
|
||||
priv->log_prefix = (name && name[0]) ?
|
||||
g_strconcat(name, " ", NULL) : g_strdup("");
|
||||
|
||||
@@ -1449,11 +1480,8 @@ static void ril_data_manager_switch_data_on(struct ril_data_manager *self,
|
||||
OFONO_RADIO_ACCESS_MODE_ANY, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* RIL_VERSION in ril.h was 10 when RIL_REQUEST_ALLOW_DATA first
|
||||
* appeared there.
|
||||
*/
|
||||
if (priv->io->ril_version >= 10) {
|
||||
|
||||
if (priv->allow_data == RIL_ALLOW_DATA_ON) {
|
||||
ril_data_request_queue(ril_data_allow_new(data));
|
||||
} else {
|
||||
priv->flags |= RIL_DATA_FLAG_ON;
|
||||
|
||||
@@ -54,6 +54,12 @@ enum ril_data_manager_flags {
|
||||
RIL_DATA_MANAGER_3GLTE_HANDOVER = 0x01
|
||||
};
|
||||
|
||||
enum ril_data_allow_data_opt {
|
||||
RIL_ALLOW_DATA_AUTO,
|
||||
RIL_ALLOW_DATA_ON,
|
||||
RIL_ALLOW_DATA_OFF
|
||||
};
|
||||
|
||||
enum ril_data_role {
|
||||
RIL_DATA_ROLE_NONE, /* Data not allowed */
|
||||
RIL_DATA_ROLE_MMS, /* Data is allowed at any speed */
|
||||
@@ -74,7 +80,7 @@ typedef void (*ril_data_call_deactivate_cb_t)(struct ril_data *data,
|
||||
|
||||
struct ril_data *ril_data_new(struct ril_data_manager *dm, const char *name,
|
||||
struct ril_radio *radio, struct ril_network *network,
|
||||
GRilIoChannel *io);
|
||||
GRilIoChannel *io, enum ril_data_allow_data_opt opt);
|
||||
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);
|
||||
|
||||
@@ -456,6 +456,15 @@ struct ril_modem *ril_modem_create(GRilIoChannel *io, const char *log_prefix,
|
||||
ofono_modem_set_powered(modem->ofono, FALSE);
|
||||
ofono_modem_set_powered(modem->ofono, TRUE);
|
||||
md->power_state = POWERED_ON;
|
||||
|
||||
/*
|
||||
* With some RIL implementations, querying available
|
||||
* band modes causes some magic Android properties to
|
||||
* appear. Otherwise this request is pretty harmless
|
||||
* and useless.
|
||||
*/
|
||||
grilio_queue_send_request(md->q, NULL,
|
||||
RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE);
|
||||
return modem;
|
||||
} else {
|
||||
ofono_error("Error %d registering %s",
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*
|
||||
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
* Copyright (C) ST-Ericsson SA 2010.
|
||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||
* Copyright (C) 2013 Jolla Ltd
|
||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||
* Copyright (C) 2013-2016 Jolla Ltd
|
||||
* Contact: Jussi Kangas <jussi.kangas@tieto.com>
|
||||
* Copyright (C) 2014 Canonical Ltd
|
||||
*
|
||||
@@ -17,11 +17,6 @@
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ril_plugin.h"
|
||||
@@ -31,24 +26,6 @@
|
||||
#include "simutil.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cb_data {
|
||||
void *cb;
|
||||
void *data;
|
||||
void *user;
|
||||
};
|
||||
|
||||
static inline struct cb_data *cb_data_new(void *cb, void *data, void *user)
|
||||
{
|
||||
struct cb_data *ret;
|
||||
|
||||
ret = g_new0(struct cb_data, 1);
|
||||
ret->cb = cb;
|
||||
ret->data = data;
|
||||
ret->user = user;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define CALLBACK_WITH_FAILURE(cb, args...) \
|
||||
do { \
|
||||
struct ofono_error cb_e; \
|
||||
@@ -155,6 +132,8 @@ struct pb_data {
|
||||
const unsigned char *df_path;
|
||||
guint register_id;
|
||||
size_t df_size;
|
||||
ofono_phonebook_cb_t cb;
|
||||
void *cb_data;
|
||||
};
|
||||
|
||||
static void read_info_cb(int ok, unsigned char file_status,
|
||||
@@ -588,6 +567,20 @@ static void decode_read_response(const struct record_to_read *rec_data,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean free_entry(gpointer key, gpointer value, gpointer data)
|
||||
{
|
||||
struct phonebook_entry *entry = value;
|
||||
|
||||
g_free(entry->name);
|
||||
g_free(entry->number);
|
||||
g_free(entry->email);
|
||||
g_free(entry->anr);
|
||||
g_free(entry->sne);
|
||||
g_free(entry);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean export_entry(gpointer key, gpointer value, gpointer data)
|
||||
{
|
||||
struct ofono_phonebook *pb = data;
|
||||
@@ -602,29 +595,18 @@ static gboolean export_entry(gpointer key, gpointer value, gpointer data)
|
||||
entry->email,
|
||||
NULL, NULL);
|
||||
|
||||
g_free(entry->name);
|
||||
g_free(entry->number);
|
||||
g_free(entry->email);
|
||||
g_free(entry->anr);
|
||||
g_free(entry->sne);
|
||||
g_free(entry);
|
||||
|
||||
return FALSE;
|
||||
return free_entry(key, value, NULL);
|
||||
}
|
||||
|
||||
static void export_and_return(gboolean ok, struct cb_data *cbd)
|
||||
static void free_pb_refs(struct pb_data *pbd, GTraverseFunc entry_func,
|
||||
struct ofono_phonebook *pb)
|
||||
{
|
||||
struct ofono_phonebook *pb = cbd->user;
|
||||
ofono_phonebook_cb_t cb = cbd->cb;
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
GSList *l;
|
||||
|
||||
DBG("phonebook fully read");
|
||||
|
||||
for (l = pbd->pb_refs; l != NULL; l = l->next) {
|
||||
struct pb_ref_rec *ref = l->data;
|
||||
|
||||
g_tree_foreach(ref->phonebook, export_entry, pb);
|
||||
g_tree_foreach(ref->phonebook, entry_func, pb);
|
||||
g_tree_destroy(ref->phonebook);
|
||||
g_slist_free_full(ref->pending_records, g_free);
|
||||
g_slist_free_full(ref->pb_files, g_free);
|
||||
@@ -632,28 +614,38 @@ static void export_and_return(gboolean ok, struct cb_data *cbd)
|
||||
|
||||
g_slist_free_full(pbd->pb_refs, g_free);
|
||||
pbd->pb_refs = NULL;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
||||
else
|
||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
||||
static void export_and_return(struct ofono_phonebook *pb, gboolean ok)
|
||||
{
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
|
||||
g_free(cbd);
|
||||
DBG("phonebook fully read");
|
||||
free_pb_refs(pbd, export_entry, pb);
|
||||
|
||||
if (pbd->cb) {
|
||||
if (ok) {
|
||||
CALLBACK_WITH_SUCCESS(pbd->cb, pbd->cb_data);
|
||||
} else {
|
||||
CALLBACK_WITH_FAILURE(pbd->cb, pbd->cb_data);
|
||||
}
|
||||
pbd->cb = NULL;
|
||||
pbd->cb_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_record_cb(int ok, int total_length, int record,
|
||||
const unsigned char *data,
|
||||
int record_length, void *userdata)
|
||||
{
|
||||
struct cb_data *cbd = userdata;
|
||||
struct ofono_phonebook *pb = cbd->user;
|
||||
struct ofono_phonebook *pb = userdata;
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
struct pb_ref_rec *ref = pbd->pb_ref_next->data;
|
||||
struct record_to_read *rec;
|
||||
|
||||
if (!ok) {
|
||||
ofono_error("%s: error %d", __func__, ok);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -679,13 +671,13 @@ static void read_record_cb(int ok, int total_length, int record,
|
||||
rec->record,
|
||||
rec->record_length,
|
||||
pbd->df_path, pbd->df_size,
|
||||
read_record_cb, cbd);
|
||||
read_record_cb, pb);
|
||||
} else {
|
||||
/* Read files from next EF_PBR record, if any */
|
||||
|
||||
pbd->pb_ref_next = pbd->pb_ref_next->next;
|
||||
if (pbd->pb_ref_next == NULL) {
|
||||
export_and_return(TRUE, cbd);
|
||||
export_and_return(pb, TRUE);
|
||||
} else {
|
||||
struct pb_ref_rec *ref;
|
||||
|
||||
@@ -694,7 +686,7 @@ static void read_record_cb(int ok, int total_length, int record,
|
||||
ref = pbd->pb_ref_next->data;
|
||||
|
||||
if (!ref->pb_files) {
|
||||
export_and_return(TRUE, cbd);
|
||||
export_and_return(pb, TRUE);
|
||||
} else {
|
||||
struct pb_file_info *file_info;
|
||||
|
||||
@@ -705,7 +697,7 @@ static void read_record_cb(int ok, int total_length, int record,
|
||||
file_info->file_id,
|
||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||
pbd->df_path, pbd->df_size,
|
||||
read_info_cb, cbd);
|
||||
read_info_cb, pb);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -715,15 +707,14 @@ static void pb_adn_cb(int ok, int total_length, int record,
|
||||
const unsigned char *data,
|
||||
int record_length, void *userdata)
|
||||
{
|
||||
struct cb_data *cbd = userdata;
|
||||
struct ofono_phonebook *pb = cbd->user;
|
||||
struct ofono_phonebook *pb = userdata;
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
struct pb_ref_rec *ref = pbd->pb_ref_next->data;
|
||||
GSList *l;
|
||||
|
||||
if (!ok) {
|
||||
ofono_error("%s: error %d", __func__, ok);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -769,9 +760,9 @@ static void pb_adn_cb(int ok, int total_length, int record,
|
||||
rec->record,
|
||||
rec->record_length,
|
||||
pbd->df_path, pbd->df_size,
|
||||
read_record_cb, cbd);
|
||||
read_record_cb, pb);
|
||||
} else {
|
||||
export_and_return(TRUE, cbd);
|
||||
export_and_return(pb, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -780,8 +771,7 @@ static void read_info_cb(int ok, unsigned char file_status,
|
||||
int total_length, int record_length,
|
||||
void *userdata)
|
||||
{
|
||||
struct cb_data *cbd = userdata;
|
||||
struct ofono_phonebook *pb = cbd->user;
|
||||
struct ofono_phonebook *pb = userdata;
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
struct pb_file_info *file_info;
|
||||
struct pb_ref_rec *ref = pbd->pb_ref_next->data;
|
||||
@@ -804,7 +794,7 @@ static void read_info_cb(int ok, unsigned char file_status,
|
||||
if (ref->pb_next == NULL) {
|
||||
if (ref->pb_files == NULL) {
|
||||
ofono_warn("%s: no phonebook on SIM", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -814,20 +804,19 @@ static void read_info_cb(int ok, unsigned char file_status,
|
||||
ofono_sim_read_path(pbd->sim_context, file_info->file_id,
|
||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||
pbd->df_path, pbd->df_size,
|
||||
pb_adn_cb, cbd);
|
||||
pb_adn_cb, pb);
|
||||
} else {
|
||||
file_info = ref->pb_next->data;
|
||||
|
||||
ofono_sim_read_info(pbd->sim_context, file_info->file_id,
|
||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||
pbd->df_path, pbd->df_size,
|
||||
read_info_cb, cbd);
|
||||
read_info_cb, pb);
|
||||
}
|
||||
}
|
||||
|
||||
static void start_sim_app_read(struct cb_data *cbd)
|
||||
static void start_sim_app_read(struct ofono_phonebook *pb)
|
||||
{
|
||||
struct ofono_phonebook *pb = cbd->user;
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
struct pb_ref_rec *ref_rec;
|
||||
struct pb_file_info *f_info;
|
||||
@@ -839,7 +828,7 @@ static void start_sim_app_read(struct cb_data *cbd)
|
||||
ref_rec = g_try_malloc0(sizeof(*ref_rec));
|
||||
if (ref_rec == NULL) {
|
||||
ofono_error("%s: OOM", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -850,7 +839,7 @@ static void start_sim_app_read(struct cb_data *cbd)
|
||||
f_info = g_try_malloc0(sizeof(*f_info));
|
||||
if (f_info == NULL) {
|
||||
ofono_error("%s: OOM", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -862,7 +851,7 @@ static void start_sim_app_read(struct cb_data *cbd)
|
||||
f_ext1 = g_try_malloc0(sizeof(*f_ext1));
|
||||
if (f_ext1 == NULL) {
|
||||
ofono_error("%s: OOM", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -880,15 +869,14 @@ static void start_sim_app_read(struct cb_data *cbd)
|
||||
ofono_sim_read_info(pbd->sim_context, f_info->file_id,
|
||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||
pbd->df_path, pbd->df_size,
|
||||
read_info_cb, cbd);
|
||||
read_info_cb, pb);
|
||||
}
|
||||
|
||||
static void pb_reference_data_cb(int ok, int total_length, int record,
|
||||
const unsigned char *sdata,
|
||||
int record_length, void *userdata)
|
||||
{
|
||||
struct cb_data *cbd = userdata;
|
||||
struct ofono_phonebook *pb = cbd->user;
|
||||
struct ofono_phonebook *pb = userdata;
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
const unsigned char *ptr = sdata;
|
||||
gboolean finished = FALSE;
|
||||
@@ -900,14 +888,14 @@ static void pb_reference_data_cb(int ok, int total_length, int record,
|
||||
if (!ok) {
|
||||
/* We migh have a SIM instead of USIM application: try that */
|
||||
DBG("%s: error %d, trying SIM files", __func__, ok);
|
||||
start_sim_app_read(cbd);
|
||||
start_sim_app_read(pb);
|
||||
return;
|
||||
}
|
||||
|
||||
ref_rec = g_try_malloc0(sizeof(*ref_rec));
|
||||
if (ref_rec == NULL) {
|
||||
ofono_error("%s: OOM", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -931,7 +919,7 @@ static void pb_reference_data_cb(int ok, int total_length, int record,
|
||||
g_try_new0(struct pb_file_info, 1);
|
||||
if (!file_info) {
|
||||
ofono_error("%s: OOM", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -973,7 +961,7 @@ static void pb_reference_data_cb(int ok, int total_length, int record,
|
||||
|
||||
if (ref->pb_files == NULL) {
|
||||
ofono_error("%s: no files to read", __func__);
|
||||
export_and_return(FALSE, cbd);
|
||||
export_and_return(pb, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -985,7 +973,7 @@ static void pb_reference_data_cb(int ok, int total_length, int record,
|
||||
ofono_sim_read_info(pbd->sim_context, file_info->file_id,
|
||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||
pbd->df_path, pbd->df_size,
|
||||
read_info_cb, cbd);
|
||||
read_info_cb, pb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -994,7 +982,6 @@ static void ril_export_entries(struct ofono_phonebook *pb,
|
||||
ofono_phonebook_cb_t cb, void *data)
|
||||
{
|
||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||
struct cb_data *cbd;
|
||||
|
||||
DBG("Storage %s", storage);
|
||||
|
||||
@@ -1004,7 +991,8 @@ static void ril_export_entries(struct ofono_phonebook *pb,
|
||||
return;
|
||||
}
|
||||
|
||||
cbd = cb_data_new(cb, data, pb);
|
||||
pbd->cb = cb;
|
||||
pbd->cb_data = data;
|
||||
|
||||
/* Assume USIM, change in case EF_PBR is not present */
|
||||
pbd->df_path = usim_path;
|
||||
@@ -1012,7 +1000,7 @@ static void ril_export_entries(struct ofono_phonebook *pb,
|
||||
|
||||
ofono_sim_read(pbd->sim_context, SIM_EFPBR_FILEID,
|
||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||
pb_reference_data_cb, cbd);
|
||||
pb_reference_data_cb, pb);
|
||||
}
|
||||
|
||||
static gboolean ril_delayed_register(gpointer user_data)
|
||||
@@ -1059,6 +1047,7 @@ static void ril_phonebook_remove(struct ofono_phonebook *pb)
|
||||
ofono_phonebook_set_data(pb, NULL);
|
||||
ofono_sim_context_free(pbd->sim_context);
|
||||
|
||||
free_pb_refs(pbd, free_entry, NULL);
|
||||
g_free(pbd);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "ril_plugin.h"
|
||||
#include "ril_config.h"
|
||||
#include "ril_sim_card.h"
|
||||
#include "ril_sim_info.h"
|
||||
#include "ril_sim_settings.h"
|
||||
@@ -49,10 +50,11 @@
|
||||
#define RILMODEM_DEFAULT_SLOT 0xffffffff
|
||||
#define RILMODEM_DEFAULT_TIMEOUT 0 /* No timeout */
|
||||
#define RILMODEM_DEFAULT_SIM_FLAGS RIL_SIM_CARD_V9_UICC_SUBSCRIPTION_WORKAROUND
|
||||
#define RILMODEM_DEFAULT_DATA_OPT RIL_ALLOW_DATA_AUTO
|
||||
#define RILMODEM_DEFAULT_DM_FLAGS RIL_DATA_MANAGER_3GLTE_HANDOVER
|
||||
#define RILMODEM_DEFAULT_EMPTY_PIN_QUERY TRUE /* optimistic */
|
||||
|
||||
#define RILMODEM_CONF_GROUP "Settings"
|
||||
#define RILMODEM_CONF_3GHANDOVER "3GLTEHandover"
|
||||
#define RILCONF_SETTINGS_3GHANDOVER "3GLTEHandover"
|
||||
|
||||
#define RILCONF_DEV_PREFIX "ril_"
|
||||
#define RILCONF_PATH_PREFIX "/" RILCONF_DEV_PREFIX
|
||||
@@ -64,6 +66,8 @@
|
||||
#define RILCONF_4G "enable4G"
|
||||
#define RILCONF_UICC_WORKAROUND "uiccWorkaround"
|
||||
#define RILCONF_ECCLIST_FILE "ecclistFile"
|
||||
#define RILCONF_ALLOW_DATA_REQ "allowDataReq"
|
||||
#define RILCONF_EMPTY_PIN_QUERY "emptyPinQuery"
|
||||
|
||||
#define RIL_STORE "ril"
|
||||
#define RIL_STORE_GROUP "Settings"
|
||||
@@ -106,9 +110,10 @@ struct ril_slot {
|
||||
char *sockpath;
|
||||
char *sub;
|
||||
char *ecclist_file;
|
||||
gint timeout; /* RIL timeout, in milliseconds */
|
||||
int timeout; /* RIL timeout, in milliseconds */
|
||||
int index;
|
||||
int sim_flags;
|
||||
enum ril_data_allow_data_opt allow_data_opt;
|
||||
struct ril_slot_config config;
|
||||
struct ril_plugin_priv *plugin;
|
||||
struct ril_modem *modem;
|
||||
@@ -942,7 +947,7 @@ static void ril_plugin_slot_connected(struct ril_slot *slot)
|
||||
|
||||
GASSERT(!slot->data);
|
||||
slot->data = ril_data_new(slot->plugin->data_manager, log_prefix,
|
||||
slot->radio, slot->network, slot->io);
|
||||
slot->radio, slot->network, slot->io, slot->allow_data_opt);
|
||||
|
||||
GASSERT(!slot->cell_info);
|
||||
if (slot->io->ril_version > 8) {
|
||||
@@ -1023,45 +1028,43 @@ static void ril_plugin_retry_init_io(struct ril_slot *slot)
|
||||
ril_plugin_retry_init_io_cb, slot);
|
||||
}
|
||||
|
||||
static struct ril_slot *ril_plugin_slot_new(const char *sockpath,
|
||||
const char *path, const char *name, guint slot_index)
|
||||
{
|
||||
struct ril_slot *slot = g_new0(struct ril_slot, 1);
|
||||
|
||||
slot->sockpath = g_strdup(sockpath);
|
||||
slot->path = g_strdup(path);
|
||||
slot->name = g_strdup(name);
|
||||
slot->config.slot = slot_index;
|
||||
slot->config.enable_4g = RILMODEM_DEFAULT_4G;
|
||||
slot->config.empty_pin_query = RILMODEM_DEFAULT_EMPTY_PIN_QUERY;
|
||||
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
||||
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
||||
slot->allow_data_opt = RILMODEM_DEFAULT_DATA_OPT;
|
||||
return slot;
|
||||
}
|
||||
|
||||
static GSList *ril_plugin_create_default_config()
|
||||
{
|
||||
GSList *list = NULL;
|
||||
|
||||
if (g_file_test(RILMODEM_DEFAULT_SOCK, G_FILE_TEST_EXISTS)) {
|
||||
struct ril_slot *slot;
|
||||
|
||||
if (g_file_test(RILMODEM_DEFAULT_SOCK2, G_FILE_TEST_EXISTS)) {
|
||||
DBG("Falling back to default 2-SIM config");
|
||||
|
||||
slot = g_new0(struct ril_slot, 1);
|
||||
slot->path = g_strdup(RILCONF_PATH_PREFIX "0");
|
||||
slot->sockpath = g_strdup(RILMODEM_DEFAULT_SOCK);
|
||||
slot->name = g_strdup("RIL1");
|
||||
slot->config.enable_4g = RILMODEM_DEFAULT_4G;
|
||||
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
||||
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
||||
list = g_slist_append(list, slot);
|
||||
|
||||
slot = g_new0(struct ril_slot, 1);
|
||||
slot->path = g_strdup(RILCONF_PATH_PREFIX "1");
|
||||
slot->sockpath = g_strdup(RILMODEM_DEFAULT_SOCK2);
|
||||
slot->name = g_strdup("RIL2");
|
||||
slot->config.enable_4g = RILMODEM_DEFAULT_4G;
|
||||
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
||||
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
||||
slot->config.slot = 1;
|
||||
list = g_slist_append(list, slot);
|
||||
DBG("Falling back to default dual SIM config");
|
||||
list = g_slist_append(list,
|
||||
ril_plugin_slot_new(RILMODEM_DEFAULT_SOCK,
|
||||
RILCONF_PATH_PREFIX "0", "RIL1", 0));
|
||||
list = g_slist_append(list,
|
||||
ril_plugin_slot_new(RILMODEM_DEFAULT_SOCK2,
|
||||
RILCONF_PATH_PREFIX "1", "RIL2", 1));
|
||||
} else {
|
||||
DBG("Falling back to default Jolla1 config");
|
||||
struct ril_slot * slot =
|
||||
ril_plugin_slot_new(RILMODEM_DEFAULT_SOCK,
|
||||
RILCONF_PATH_PREFIX "0", "RIL", 0);
|
||||
|
||||
slot = g_new0(struct ril_slot, 1);
|
||||
slot->path = g_strdup(RILCONF_PATH_PREFIX "0");
|
||||
slot->sockpath = g_strdup(RILMODEM_DEFAULT_SOCK);
|
||||
DBG("Falling back to default single SIM config");
|
||||
slot->sub = g_strdup(RILMODEM_DEFAULT_SUB);
|
||||
slot->name = g_strdup("");
|
||||
slot->config.enable_4g = RILMODEM_DEFAULT_4G;
|
||||
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
||||
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
||||
list = g_slist_append(list, slot);
|
||||
}
|
||||
} else {
|
||||
@@ -1071,20 +1074,6 @@ static GSList *ril_plugin_create_default_config()
|
||||
return list;
|
||||
}
|
||||
|
||||
static void ril_plugin_read_config_flag(GKeyFile *file, const char *group,
|
||||
const char *key, int flag, int *flags)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
if (g_key_file_get_boolean(file, group, key, &err)) {
|
||||
*flags |= flag;
|
||||
} else if (!err) {
|
||||
*flags &= ~flag;
|
||||
} else {
|
||||
g_error_free(err);
|
||||
}
|
||||
}
|
||||
|
||||
static struct ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
||||
const char *group)
|
||||
{
|
||||
@@ -1092,16 +1081,14 @@ static struct ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
||||
char *sock = g_key_file_get_string(file, group, RILCONF_SOCKET, NULL);
|
||||
if (sock) {
|
||||
int value;
|
||||
GError *err = NULL;
|
||||
char *sub = g_key_file_get_string(file, group, RILCONF_SUB,
|
||||
NULL);
|
||||
char* strval;
|
||||
char *sub = ril_config_get_string(file, group, RILCONF_SUB);
|
||||
|
||||
slot = g_new0(struct ril_slot, 1);
|
||||
slot = ril_plugin_slot_new(NULL, NULL, NULL,
|
||||
RILMODEM_DEFAULT_SLOT);
|
||||
slot->sockpath = sock;
|
||||
slot->path = g_strconcat("/", group, NULL);
|
||||
slot->name = g_key_file_get_string(file, group, RILCONF_NAME,
|
||||
NULL);
|
||||
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
|
||||
slot->name = ril_config_get_string(file, group, RILCONF_NAME);
|
||||
|
||||
if (sub && strlen(sub) == RIL_SUB_SIZE) {
|
||||
DBG("%s: %s:%s", group, sock, sub);
|
||||
@@ -1111,53 +1098,55 @@ static struct ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
||||
g_free(sub);
|
||||
}
|
||||
|
||||
value = g_key_file_get_integer(file, group, RILCONF_SLOT, &err);
|
||||
if (!err && value >= 0) {
|
||||
if (ril_config_get_integer(file, group, RILCONF_SLOT, &value) &&
|
||||
value >= 0) {
|
||||
slot->config.slot = value;
|
||||
DBG("%s: slot %u", group, slot->config.slot);
|
||||
} else {
|
||||
slot->config.slot = RILMODEM_DEFAULT_SLOT;
|
||||
if (err) {
|
||||
g_error_free(err);
|
||||
err = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
value = g_key_file_get_integer(file, group, RILCONF_TIMEOUT,
|
||||
&err);
|
||||
if (!err) {
|
||||
slot->timeout = value;
|
||||
if (ril_config_get_integer(file, group, RILCONF_TIMEOUT,
|
||||
&slot->timeout)) {
|
||||
DBG("%s: timeout %d", group, slot->timeout);
|
||||
} else {
|
||||
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
|
||||
if (err) {
|
||||
g_error_free(err);
|
||||
err = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
slot->config.enable_4g = g_key_file_get_boolean(file, group,
|
||||
RILCONF_4G, &err);
|
||||
if (err) {
|
||||
/* Set to default */
|
||||
slot->config.enable_4g = RILMODEM_DEFAULT_4G;
|
||||
g_error_free(err);
|
||||
err = NULL;
|
||||
}
|
||||
ril_config_get_boolean(file, group, RILCONF_4G,
|
||||
&slot->config.enable_4g);
|
||||
DBG("%s: 4G %s", group, slot->config.enable_4g ? "on" : "off");
|
||||
|
||||
ril_plugin_read_config_flag(file, group,
|
||||
RILCONF_UICC_WORKAROUND,
|
||||
RIL_SIM_CARD_V9_UICC_SUBSCRIPTION_WORKAROUND,
|
||||
&slot->sim_flags);
|
||||
DBG("%s: UICC workaround %s", group, (slot->sim_flags &
|
||||
RIL_SIM_CARD_V9_UICC_SUBSCRIPTION_WORKAROUND) ?
|
||||
"on" : "off");
|
||||
if (ril_config_get_boolean(file, group, RILCONF_EMPTY_PIN_QUERY,
|
||||
&slot->config.empty_pin_query)) {
|
||||
DBG("%s: %s %s", group, RILCONF_EMPTY_PIN_QUERY,
|
||||
slot->config.empty_pin_query ? "on" : "off");
|
||||
}
|
||||
|
||||
slot->ecclist_file = g_key_file_get_string(file, group,
|
||||
RILCONF_ECCLIST_FILE, NULL);
|
||||
if (ril_config_get_flag(file, group, RILCONF_UICC_WORKAROUND,
|
||||
RIL_SIM_CARD_V9_UICC_SUBSCRIPTION_WORKAROUND,
|
||||
&slot->sim_flags)) {
|
||||
DBG("%s: %s %s", group, RILCONF_UICC_WORKAROUND,
|
||||
(slot->sim_flags &
|
||||
RIL_SIM_CARD_V9_UICC_SUBSCRIPTION_WORKAROUND) ?
|
||||
"on" : "off");
|
||||
}
|
||||
|
||||
strval = ril_config_get_string(file, group,
|
||||
RILCONF_ALLOW_DATA_REQ);
|
||||
if (strval) {
|
||||
slot->allow_data_opt =
|
||||
!strcasecmp(strval, "on") ? RIL_ALLOW_DATA_ON :
|
||||
!strcasecmp(strval, "off")? RIL_ALLOW_DATA_OFF :
|
||||
RIL_ALLOW_DATA_AUTO;
|
||||
DBG("%s: %s %s", group, RILCONF_ALLOW_DATA_REQ,
|
||||
slot->allow_data_opt==RIL_ALLOW_DATA_ON? "on":
|
||||
slot->allow_data_opt==RIL_ALLOW_DATA_OFF? "off":
|
||||
"auto");
|
||||
g_free(strval);
|
||||
}
|
||||
|
||||
slot->ecclist_file = ril_config_get_string(file, group,
|
||||
RILCONF_ECCLIST_FILE);
|
||||
if (slot->ecclist_file && slot->ecclist_file[0]) {
|
||||
DBG("%s: ecclist file %s", group, slot->ecclist_file);
|
||||
DBG("%s: %s %s", group, RILCONF_ECCLIST_FILE,
|
||||
slot->ecclist_file);
|
||||
slot->pub.ecclist_file = slot->ecclist_file;
|
||||
} else {
|
||||
g_free(slot->ecclist_file);
|
||||
@@ -1240,10 +1229,10 @@ static GSList *ril_plugin_parse_config_file(GKeyFile *file,
|
||||
if (slot) {
|
||||
list = ril_plugin_add_slot(list, slot);
|
||||
}
|
||||
} else if (!strcmp(group, RILMODEM_CONF_GROUP)) {
|
||||
} else if (!strcmp(group, RILCONF_SETTINGS_GROUP)) {
|
||||
/* Plugin configuration */
|
||||
ril_plugin_read_config_flag(file, group,
|
||||
RILMODEM_CONF_3GHANDOVER,
|
||||
ril_config_get_flag(file, group,
|
||||
RILCONF_SETTINGS_3GHANDOVER,
|
||||
RIL_DATA_MANAGER_3GLTE_HANDOVER,
|
||||
&ps->dm_flags);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -57,6 +57,7 @@ struct ril_sim_info_priv {
|
||||
char *sim_spn;
|
||||
char *public_spn;
|
||||
char default_spn[RIL_SIM_DEFAULT_SPN_BUFSIZE];
|
||||
int public_spn_block;
|
||||
struct ofono_sim *sim;
|
||||
struct ril_sim_info_watch state_watch;
|
||||
struct ril_sim_info_watch iccid_watch;
|
||||
@@ -209,14 +210,18 @@ static void ril_sim_info_set_imsi(struct ril_sim_info *self, const char *imsi)
|
||||
static void ril_sim_info_update_public_spn(struct ril_sim_info *self)
|
||||
{
|
||||
struct ril_sim_info_priv *priv = self->priv;
|
||||
const char *spn = priv->sim_spn ? priv->sim_spn :
|
||||
|
||||
GASSERT(priv->public_spn_block >= 0);
|
||||
if (!priv->public_spn_block) {
|
||||
const char *spn = priv->sim_spn ? priv->sim_spn :
|
||||
priv->cached_spn ? priv->cached_spn :
|
||||
priv->default_spn;
|
||||
|
||||
if (g_strcmp0(priv->public_spn, spn)) {
|
||||
g_free(priv->public_spn);
|
||||
self->spn = priv->public_spn = g_strdup(spn);
|
||||
ril_sim_info_signal_emit(self, SIGNAL_SPN_CHANGED);
|
||||
if (g_strcmp0(priv->public_spn, spn)) {
|
||||
g_free(priv->public_spn);
|
||||
self->spn = priv->public_spn = g_strdup(spn);
|
||||
ril_sim_info_signal_emit(self, SIGNAL_SPN_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,11 +231,15 @@ static void ril_sim_info_set_cached_spn(struct ril_sim_info *self,
|
||||
struct ril_sim_info_priv *priv = self->priv;
|
||||
|
||||
if (g_strcmp0(priv->cached_spn, spn)) {
|
||||
DBG_(self, "cached spn \"%s\"", spn);
|
||||
g_free(priv->cached_spn);
|
||||
priv->cached_spn = g_strdup(spn);
|
||||
priv->update_imsi_cache = TRUE;
|
||||
ril_sim_info_update_imsi_cache(self);
|
||||
if (spn) {
|
||||
DBG_(self, "cached spn \"%s\"", spn);
|
||||
priv->cached_spn = g_strdup(spn);
|
||||
priv->update_imsi_cache = TRUE;
|
||||
ril_sim_info_update_imsi_cache(self);
|
||||
} else {
|
||||
priv->cached_spn = NULL;
|
||||
}
|
||||
ril_sim_info_update_public_spn(self);
|
||||
}
|
||||
}
|
||||
@@ -505,6 +514,7 @@ void ril_sim_info_set_ofono_sim(struct ril_sim_info *self,
|
||||
struct ril_sim_info_priv *priv = self->priv;
|
||||
|
||||
if (priv->sim != sim) {
|
||||
priv->public_spn_block++;
|
||||
ril_sim_info_watch_remove(&priv->state_watch);
|
||||
ril_sim_info_watch_remove(&priv->iccid_watch);
|
||||
ril_sim_info_watch_remove(&priv->imsi_watch);
|
||||
@@ -524,9 +534,14 @@ void ril_sim_info_set_ofono_sim(struct ril_sim_info *self,
|
||||
DBG_(self, "attached to sim");
|
||||
ril_sim_info_handle_sim_state(self,
|
||||
ofono_sim_get_state(sim));
|
||||
} else {
|
||||
DBG_(self, "detached from sim");
|
||||
ril_sim_info_update_default_spn(self);
|
||||
ril_sim_info_network_check(self);
|
||||
}
|
||||
|
||||
ril_sim_info_network_check(self);
|
||||
priv->public_spn_block--;
|
||||
ril_sim_info_update_public_spn(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# This is a sample configuration file for the ril driver
|
||||
# This is a sample configuration file for Jolla ril driver
|
||||
#
|
||||
# This file is expected to be installed in /etc/ofono
|
||||
#
|
||||
@@ -6,6 +6,10 @@
|
||||
# common settings are in the [Settings] section, all other sections
|
||||
# are ignored.
|
||||
#
|
||||
# If any value from [ril_x] section (except "socket") is defined
|
||||
# in the [Settings] section, it becomes the default for all modems.
|
||||
# Default values can still be redefined at [ril_x] level.
|
||||
#
|
||||
|
||||
[Settings]
|
||||
|
||||
@@ -83,3 +87,21 @@ socket=/dev/socket/rild
|
||||
# chmod 0644 /var/lib/ofono/ril.ecclist
|
||||
#
|
||||
#ecclistFile=/var/lib/ofono/ril.ecclist
|
||||
|
||||
# RIL_REQUEST_ALLOW_DATA may or may not be supported by your RIL.
|
||||
# This option allows you to forcibly enable or disable use of this request.
|
||||
# Possible values are auto, on and off
|
||||
#
|
||||
# Default is auto (usage based on the RIL version)
|
||||
#
|
||||
#allowDataReq=auto
|
||||
|
||||
# Since RIL interface doesn't provide the standard way of querying the
|
||||
# number of pin retries left, some RIL implementation (namely Qualcomm)
|
||||
# allow to query the retry count by sending the empty pin. If your RIL
|
||||
# actually does check the empty pin (and decrements the retry count)
|
||||
# then you should turn this feature off.
|
||||
#
|
||||
# Default is true
|
||||
#
|
||||
#emptyPinQuery=true
|
||||
|
||||
@@ -52,6 +52,7 @@ struct ril_cell_info;
|
||||
struct ril_slot_config {
|
||||
guint slot;
|
||||
gboolean enable_4g;
|
||||
gboolean empty_pin_query;
|
||||
};
|
||||
|
||||
#endif /* RIL_TYPES_H */
|
||||
|
||||
@@ -50,17 +50,15 @@ static struct ril_ussd_cbd *ril_ussd_cbd_new(ofono_ussd_cb_t cb, void *data)
|
||||
return cbd;
|
||||
}
|
||||
|
||||
static void ril_ussd_cb(GRilIoChannel *io, int status,
|
||||
static void ril_ussd_cancel_cb(GRilIoChannel *io, int status,
|
||||
const void *data, guint len, void *user_data)
|
||||
{
|
||||
struct ofono_error error;
|
||||
struct ril_ussd_cbd *cbd = user_data;
|
||||
|
||||
if (status == RIL_E_SUCCESS) {
|
||||
cbd->cb(ril_error_ok(&error), cbd->data);
|
||||
} else {
|
||||
cbd->cb(ril_error_failure(&error), cbd->data);
|
||||
}
|
||||
/* Always report sucessful completion, otherwise ofono may get
|
||||
* stuck in the USSD_STATE_ACTIVE state */
|
||||
cbd->cb(ril_error_ok(&error), cbd->data);
|
||||
}
|
||||
|
||||
static void ril_ussd_request(struct ofono_ussd *ussd, int dcs,
|
||||
@@ -120,7 +118,8 @@ static void ril_ussd_cancel(struct ofono_ussd *ussd,
|
||||
|
||||
ofono_info("send ussd cancel");
|
||||
grilio_queue_send_request_full(ud->q, NULL, RIL_REQUEST_CANCEL_USSD,
|
||||
ril_ussd_cb, ril_ussd_cbd_free, ril_ussd_cbd_new(cb, data));
|
||||
ril_ussd_cancel_cb, ril_ussd_cbd_free,
|
||||
ril_ussd_cbd_new(cb, data));
|
||||
}
|
||||
|
||||
static void ril_ussd_notify(GRilIoChannel *io, guint code,
|
||||
@@ -128,32 +127,32 @@ static void ril_ussd_notify(GRilIoChannel *io, guint code,
|
||||
{
|
||||
struct ril_ussd *ud = user_data;
|
||||
GRilIoParser rilp;
|
||||
char *ussd_from_network = NULL;
|
||||
char *type = NULL;
|
||||
int ussdtype = 0;
|
||||
char *type;
|
||||
guint32 n = 0;
|
||||
|
||||
ofono_info("ussd_received");
|
||||
ofono_info("ussd received");
|
||||
|
||||
GASSERT(code == RIL_UNSOL_ON_USSD);
|
||||
grilio_parser_init(&rilp, data, len);
|
||||
grilio_parser_get_uint32(&rilp, NULL);
|
||||
grilio_parser_get_uint32(&rilp, &n);
|
||||
type = grilio_parser_get_utf8(&rilp);
|
||||
ussd_from_network = grilio_parser_get_utf8(&rilp);
|
||||
|
||||
ussdtype = g_ascii_xdigit_value(*type);
|
||||
if (type) {
|
||||
int ussdtype = g_ascii_xdigit_value(*type);
|
||||
char *msg = (n > 1) ? grilio_parser_get_utf8(&rilp) : NULL;
|
||||
|
||||
if (ussd_from_network) {
|
||||
const int data_len = strlen(ussd_from_network);
|
||||
DBG("ussd_received, length %d", data_len);
|
||||
ofono_ussd_notify(ud->ussd, ussdtype, 0xFF,
|
||||
(const unsigned char *) ussd_from_network, data_len);
|
||||
} else {
|
||||
ofono_ussd_notify(ud->ussd, ussdtype, 0, NULL, 0);
|
||||
if (msg) {
|
||||
const int msglen = strlen(msg);
|
||||
DBG("ussd length %d", msglen);
|
||||
ofono_ussd_notify(ud->ussd, ussdtype, 0xFF,
|
||||
(const unsigned char *)msg, msglen);
|
||||
/* msg is freed by core if dcs is 0xFF */
|
||||
} else {
|
||||
ofono_ussd_notify(ud->ussd, ussdtype, 0, NULL, 0);
|
||||
}
|
||||
|
||||
g_free(type);
|
||||
}
|
||||
|
||||
/* ussd_from_network not freed because core does that if dcs is 0xFF */
|
||||
g_free(type);
|
||||
return;
|
||||
}
|
||||
|
||||
static gboolean ril_ussd_register(gpointer user_data)
|
||||
@@ -170,7 +169,7 @@ static gboolean ril_ussd_register(gpointer user_data)
|
||||
ril_ussd_notify, RIL_UNSOL_ON_USSD, ud);
|
||||
|
||||
/* Single-shot */
|
||||
return FALSE;
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static int ril_ussd_probe(struct ofono_ussd *ussd, unsigned int vendor,
|
||||
|
||||
@@ -32,9 +32,12 @@ gboolean ril_parse_mcc_mnc(const char *str, struct ofono_network_operator *op);
|
||||
((err)->error = 0, (err)->type = OFONO_ERROR_TYPE_NO_ERROR)
|
||||
#define ril_error_init_failure(err) \
|
||||
((err)->error = 0, (err)->type = OFONO_ERROR_TYPE_FAILURE)
|
||||
#define ril_error_init_sim_error(err,sw1,sw2) \
|
||||
((err)->error = ((sw1) << 8)|(sw2), (err)->type = OFONO_ERROR_TYPE_SIM)
|
||||
|
||||
#define ril_error_ok(err) (ril_error_init_ok(err), err)
|
||||
#define ril_error_failure(err) (ril_error_init_failure(err), err)
|
||||
#define ril_error_sim(err,sw1,sw2) (ril_error_init_sim_error(err,sw1,sw2), err)
|
||||
|
||||
#endif /* RIL_UTIL_H */
|
||||
|
||||
|
||||
@@ -650,20 +650,11 @@ static void ril_voicecall_clear_dtmf_queue(struct ril_voicecall *vd)
|
||||
}
|
||||
}
|
||||
|
||||
static void ril_voicecall_clcc_poll_on_success(GRilIoChannel *io,
|
||||
int status, const void *data, guint len, void *user_data)
|
||||
{
|
||||
if (status == RIL_E_SUCCESS) {
|
||||
ril_voicecall_clcc_poll((struct ril_voicecall *)user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void ril_voicecall_create_multiparty(struct ofono_voicecall *vc,
|
||||
ofono_voicecall_cb_t cb, void *data)
|
||||
{
|
||||
struct ril_voicecall *vd = ril_voicecall_get_data(vc);
|
||||
grilio_queue_send_request_full(vd->q, NULL, RIL_REQUEST_CONFERENCE,
|
||||
ril_voicecall_clcc_poll_on_success, NULL, vd);
|
||||
ril_voicecall_request(RIL_REQUEST_CONFERENCE,
|
||||
vc, 0, NULL, cb, data);
|
||||
}
|
||||
|
||||
static void ril_voicecall_transfer(struct ofono_voicecall *vc,
|
||||
@@ -676,14 +667,17 @@ static void ril_voicecall_transfer(struct ofono_voicecall *vc,
|
||||
static void ril_voicecall_private_chat(struct ofono_voicecall *vc, int id,
|
||||
ofono_voicecall_cb_t cb, void *data)
|
||||
{
|
||||
struct ril_voicecall *vd = ril_voicecall_get_data(vc);
|
||||
GRilIoRequest *req = grilio_request_sized_new(8);
|
||||
struct ofono_error error;
|
||||
|
||||
DBG("Private chat with id %d", id);
|
||||
grilio_request_append_int32(req, 1);
|
||||
grilio_request_append_int32(req, id);
|
||||
grilio_queue_send_request_full(vd->q, req,
|
||||
RIL_REQUEST_SEPARATE_CONNECTION,
|
||||
ril_voicecall_clcc_poll_on_success, NULL, vd);
|
||||
|
||||
ril_voicecall_request(RIL_REQUEST_SEPARATE_CONNECTION,
|
||||
vc, 0, req, NULL, NULL);
|
||||
grilio_request_unref(req);
|
||||
cb(ril_error_ok(&error), data);
|
||||
}
|
||||
|
||||
static void ril_voicecall_swap_without_accept(struct ofono_voicecall *vc,
|
||||
|
||||
@@ -123,8 +123,8 @@ typedef void (*ofono_sim_pin_retries_cb_t)(const struct ofono_error *error,
|
||||
typedef void (*ofono_sim_lock_unlock_cb_t)(const struct ofono_error *error,
|
||||
void *data);
|
||||
|
||||
typedef void (*ofono_sim_locked_cb_t)(const struct ofono_error *error,
|
||||
int locked, void *data);
|
||||
typedef void (*ofono_query_facility_lock_cb_t)(const struct ofono_error *error,
|
||||
ofono_bool_t status, void *data);
|
||||
|
||||
struct ofono_sim_driver {
|
||||
const char *name;
|
||||
@@ -175,9 +175,9 @@ struct ofono_sim_driver {
|
||||
void (*lock)(struct ofono_sim *sim, enum ofono_sim_password_type type,
|
||||
int enable, const char *passwd,
|
||||
ofono_sim_lock_unlock_cb_t cb, void *data);
|
||||
void (*query_locked)(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type type,
|
||||
ofono_sim_locked_cb_t cb, void *data);
|
||||
void (*query_facility_lock)(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type lock,
|
||||
ofono_query_facility_lock_cb_t cb, void *data);
|
||||
};
|
||||
|
||||
int ofono_sim_driver_register(const struct ofono_sim_driver *d);
|
||||
|
||||
@@ -60,6 +60,7 @@ struct ofono_call_forwarding {
|
||||
GSList *cf_conditions[4];
|
||||
int flags;
|
||||
DBusMessage *pending;
|
||||
GSList *pending_get_prop;
|
||||
int query_next;
|
||||
int query_end;
|
||||
struct cf_ss_request *ss_req;
|
||||
@@ -529,6 +530,14 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
|
||||
return reply;
|
||||
}
|
||||
|
||||
static void cf_send_properties(gpointer data, gpointer user_data)
|
||||
{
|
||||
DBusMessage *msg = data;
|
||||
DBusMessage *reply = cf_get_properties_reply(msg, user_data);
|
||||
|
||||
__ofono_dbus_pending_reply(&msg, reply);
|
||||
}
|
||||
|
||||
static void get_query_cf_callback(const struct ofono_error *error, int total,
|
||||
const struct ofono_call_forwarding_condition *list,
|
||||
void *data)
|
||||
@@ -549,8 +558,9 @@ static void get_query_cf_callback(const struct ofono_error *error, int total,
|
||||
}
|
||||
|
||||
if (cf->query_next == CALL_FORWARDING_TYPE_NOT_REACHABLE) {
|
||||
__ofono_dbus_pending_reply(&cf->pending,
|
||||
cf_get_properties_reply(cf->pending, cf));
|
||||
g_slist_foreach(cf->pending_get_prop, cf_send_properties, cf);
|
||||
g_slist_free(cf->pending_get_prop);
|
||||
cf->pending_get_prop = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -577,11 +587,18 @@ static DBusMessage *cf_get_properties(DBusConnection *conn, DBusMessage *msg,
|
||||
if (cf->driver->query == NULL)
|
||||
return __ofono_error_not_implemented(msg);
|
||||
|
||||
if (cf->pending_get_prop) {
|
||||
/* GetProperties is already in progress */
|
||||
cf->pending_get_prop = g_slist_append(cf->pending_get_prop,
|
||||
dbus_message_ref(msg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (__ofono_call_forwarding_is_busy(cf) ||
|
||||
__ofono_ussd_is_busy(cf->ussd))
|
||||
return __ofono_error_busy(msg);
|
||||
|
||||
cf->pending = dbus_message_ref(msg);
|
||||
cf->pending_get_prop = g_slist_append(NULL, dbus_message_ref(msg));
|
||||
cf->query_next = 0;
|
||||
|
||||
get_query_next_cf_cond(cf);
|
||||
@@ -1268,7 +1285,7 @@ static void cf_unregister_ss_controls(struct ofono_call_forwarding *cf)
|
||||
|
||||
gboolean __ofono_call_forwarding_is_busy(struct ofono_call_forwarding *cf)
|
||||
{
|
||||
return cf->pending ? TRUE : FALSE;
|
||||
return cf->pending || cf->pending_get_prop;
|
||||
}
|
||||
|
||||
static void sim_cfis_read_cb(int ok, int total_length, int record,
|
||||
@@ -1378,6 +1395,13 @@ static void sim_cphs_cff_read_cb(int ok, int total_length, int record,
|
||||
DBUS_TYPE_BOOLEAN, &cfu_voice);
|
||||
}
|
||||
|
||||
static void cf_cancel_get_prop(gpointer data)
|
||||
{
|
||||
DBusMessage *msg = data;
|
||||
|
||||
__ofono_dbus_pending_reply(&msg, __ofono_error_canceled(msg));
|
||||
}
|
||||
|
||||
static void call_forwarding_unregister(struct ofono_atom *atom)
|
||||
{
|
||||
struct ofono_call_forwarding *cf = __ofono_atom_get_data(atom);
|
||||
@@ -1385,6 +1409,11 @@ static void call_forwarding_unregister(struct ofono_atom *atom)
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
struct ofono_modem *modem = __ofono_atom_get_modem(cf->atom);
|
||||
|
||||
if (cf->pending_get_prop) {
|
||||
g_slist_free_full(cf->pending_get_prop, cf_cancel_get_prop);
|
||||
cf->pending_get_prop = NULL;
|
||||
}
|
||||
|
||||
ofono_modem_remove_interface(modem, OFONO_CALL_FORWARDING_INTERFACE);
|
||||
g_dbus_unregister_interface(conn, path,
|
||||
OFONO_CALL_FORWARDING_INTERFACE);
|
||||
|
||||
@@ -135,6 +135,7 @@ struct pri_context {
|
||||
struct ofono_gprs *gprs;
|
||||
};
|
||||
|
||||
static void gprs_attached_update(struct ofono_gprs *gprs);
|
||||
static void gprs_netreg_update(struct ofono_gprs *gprs);
|
||||
static void gprs_deactivate_next(struct ofono_gprs *gprs);
|
||||
static void write_context_settings(struct ofono_gprs *gprs,
|
||||
@@ -1133,6 +1134,16 @@ static void pri_deactivate_callback(const struct ofono_error *error, void *data)
|
||||
ofono_dbus_signal_property_changed(conn, ctx->path,
|
||||
OFONO_CONNECTION_CONTEXT_INTERFACE,
|
||||
"Active", DBUS_TYPE_BOOLEAN, &value);
|
||||
|
||||
/*
|
||||
* If "Attached" property was about to be signalled as TRUE but there
|
||||
* were still active contexts, try again to signal "Attached" property
|
||||
* to registered applications after active contexts have been released.
|
||||
*/
|
||||
if (ctx->gprs->flags & GPRS_FLAG_ATTACHED_UPDATE) {
|
||||
ctx->gprs->flags &= ~GPRS_FLAG_ATTACHED_UPDATE;
|
||||
gprs_attached_update(ctx->gprs);
|
||||
}
|
||||
}
|
||||
|
||||
static DBusMessage *pri_set_apn(struct pri_context *ctx, DBusConnection *conn,
|
||||
|
||||
@@ -2609,6 +2609,52 @@ static void sim_free_state(struct ofono_sim *sim)
|
||||
sim_free_main_state(sim);
|
||||
}
|
||||
|
||||
static void sim_set_locked_pin(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type type, gboolean locked)
|
||||
{
|
||||
char **locked_pins;
|
||||
|
||||
if (sim->locked_pins[type] == locked)
|
||||
return;
|
||||
|
||||
sim->locked_pins[type] = locked;
|
||||
locked_pins = get_locked_pins(sim);
|
||||
|
||||
ofono_dbus_signal_array_property_changed(ofono_dbus_get_connection(),
|
||||
__ofono_atom_get_path(sim->atom),
|
||||
OFONO_SIM_MANAGER_INTERFACE, "LockedPins",
|
||||
DBUS_TYPE_STRING, &locked_pins);
|
||||
|
||||
g_strfreev(locked_pins);
|
||||
}
|
||||
|
||||
static void sim_query_fac_imsilock_cb(const struct ofono_error *error,
|
||||
ofono_bool_t status, void *data)
|
||||
{
|
||||
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
|
||||
return;
|
||||
|
||||
sim_set_locked_pin(data, OFONO_SIM_PASSWORD_PHSIM_PIN, status);
|
||||
}
|
||||
|
||||
static void sim_query_fac_networklock_cb(const struct ofono_error *error,
|
||||
ofono_bool_t status, void *data)
|
||||
{
|
||||
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
|
||||
return;
|
||||
|
||||
sim_set_locked_pin(data, OFONO_SIM_PASSWORD_PHNET_PIN, status);
|
||||
}
|
||||
|
||||
static void sim_query_fac_pinlock_cb(const struct ofono_error *error,
|
||||
ofono_bool_t status, void *data)
|
||||
{
|
||||
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
|
||||
return;
|
||||
|
||||
sim_set_locked_pin(data, OFONO_SIM_PASSWORD_SIM_PIN, status);
|
||||
}
|
||||
|
||||
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
|
||||
{
|
||||
if (sim->state == OFONO_SIM_STATE_RESETTING && inserted) {
|
||||
@@ -2635,6 +2681,20 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
|
||||
call_state_watches(sim);
|
||||
|
||||
if (inserted) {
|
||||
if (sim->driver->query_facility_lock) {
|
||||
sim->driver->query_facility_lock(sim,
|
||||
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);
|
||||
}
|
||||
|
||||
sim_initialize(sim);
|
||||
} else {
|
||||
sim->pin_type = OFONO_SIM_PASSWORD_NONE;
|
||||
|
||||
@@ -18,7 +18,6 @@ Requires(postun): systemd
|
||||
BuildRequires: pkgconfig(glib-2.0)
|
||||
BuildRequires: pkgconfig(dbus-1)
|
||||
BuildRequires: pkgconfig(libudev) >= 145
|
||||
BuildRequires: pkgconfig(bluez) >= 4.85
|
||||
BuildRequires: pkgconfig(mobile-broadband-provider-info)
|
||||
BuildRequires: pkgconfig(libwspcodec) >= 2.0
|
||||
BuildRequires: pkgconfig(libgrilio) >= 1.0.10
|
||||
@@ -54,7 +53,6 @@ Scripts for testing oFono and its functionality
|
||||
%package configs-mer
|
||||
Summary: Package to provide default configs for ofono
|
||||
Group: Development/Tools
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Provides: ofono-configs
|
||||
|
||||
%description configs-mer
|
||||
@@ -87,6 +85,7 @@ rm -rf %{buildroot}
|
||||
|
||||
mkdir -p %{buildroot}/%{_sysconfdir}/ofono/push_forwarder.d
|
||||
mkdir -p %{buildroot}/%{_lib}/systemd/system/network.target.wants
|
||||
mkdir -p %{buildroot}/var/lib/ofono
|
||||
ln -s ../ofono.service %{buildroot}/%{_lib}/systemd/system/network.target.wants/ofono.service
|
||||
|
||||
%preun
|
||||
|
||||
Reference in New Issue
Block a user