forked from sailfishos/ofono
Compare commits
5 Commits
master
...
upgrade-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c572e83247 | ||
|
|
dd21e34a86 | ||
|
|
8de5892827 | ||
|
|
8b2ef760c7 | ||
|
|
0ee292e0f6 |
@@ -153,6 +153,7 @@ struct pb_data {
|
|||||||
struct ofono_sim *sim;
|
struct ofono_sim *sim;
|
||||||
struct ofono_sim_context *sim_context;
|
struct ofono_sim_context *sim_context;
|
||||||
const unsigned char *df_path;
|
const unsigned char *df_path;
|
||||||
|
guint register_id;
|
||||||
size_t df_size;
|
size_t df_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1017,7 +1018,9 @@ static void ril_export_entries(struct ofono_phonebook *pb,
|
|||||||
static gboolean ril_delayed_register(gpointer user_data)
|
static gboolean ril_delayed_register(gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_phonebook *pb = user_data;
|
struct ofono_phonebook *pb = user_data;
|
||||||
|
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||||
|
|
||||||
|
pbd->register_id = 0;
|
||||||
ofono_phonebook_register(pb);
|
ofono_phonebook_register(pb);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1040,7 +1043,7 @@ static int ril_phonebook_probe(struct ofono_phonebook *pb,
|
|||||||
|
|
||||||
ofono_phonebook_set_data(pb, pd);
|
ofono_phonebook_set_data(pb, pd);
|
||||||
|
|
||||||
g_idle_add(ril_delayed_register, pb);
|
pd->register_id = g_idle_add(ril_delayed_register, pb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1049,6 +1052,10 @@ static void ril_phonebook_remove(struct ofono_phonebook *pb)
|
|||||||
{
|
{
|
||||||
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
struct pb_data *pbd = ofono_phonebook_get_data(pb);
|
||||||
|
|
||||||
|
if (pbd->register_id) {
|
||||||
|
g_source_remove(pbd->register_id);
|
||||||
|
}
|
||||||
|
|
||||||
ofono_phonebook_set_data(pb, NULL);
|
ofono_phonebook_set_data(pb, NULL);
|
||||||
ofono_sim_context_free(pbd->sim_context);
|
ofono_sim_context_free(pbd->sim_context);
|
||||||
|
|
||||||
|
|||||||
@@ -518,8 +518,9 @@ static void ril_plugin_update_ready(struct ril_plugin_priv *plugin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plugin->pub.ready != ready) {
|
if (plugin->pub.ready != ready) {
|
||||||
DBG("%sready", ready ? "" : "not ");
|
|
||||||
plugin->pub.ready = ready;
|
plugin->pub.ready = ready;
|
||||||
|
ril_plugin_dbus_block_imei_requests(plugin->dbus, !ready);
|
||||||
|
DBG("%sready", ready ? "" : "not ");
|
||||||
ril_plugin_dbus_signal(plugin->dbus, RIL_PLUGIN_SIGNAL_READY);
|
ril_plugin_dbus_signal(plugin->dbus, RIL_PLUGIN_SIGNAL_READY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -827,16 +828,13 @@ static void ril_plugin_imei_cb(GRilIoChannel *io, int status,
|
|||||||
const void *data, guint len, void *user_data)
|
const void *data, guint len, void *user_data)
|
||||||
{
|
{
|
||||||
struct ril_slot *slot = user_data;
|
struct ril_slot *slot = user_data;
|
||||||
struct ril_plugin_priv *plugin = slot->plugin;
|
char *imei = NULL;
|
||||||
gboolean all_done = TRUE;
|
|
||||||
GSList *link;
|
|
||||||
|
|
||||||
GASSERT(slot->imei_req_id);
|
GASSERT(slot->imei_req_id);
|
||||||
slot->imei_req_id = 0;
|
slot->imei_req_id = 0;
|
||||||
|
|
||||||
if (status == RIL_E_SUCCESS) {
|
if (status == RIL_E_SUCCESS) {
|
||||||
GRilIoParser rilp;
|
GRilIoParser rilp;
|
||||||
char *imei;
|
|
||||||
|
|
||||||
grilio_parser_init(&rilp, data, len);
|
grilio_parser_init(&rilp, data, len);
|
||||||
imei = grilio_parser_get_utf8(&rilp);
|
imei = grilio_parser_get_utf8(&rilp);
|
||||||
@@ -849,26 +847,16 @@ static void ril_plugin_imei_cb(GRilIoChannel *io, int status,
|
|||||||
* IMEI (if rild crashed and we have reconnected)
|
* IMEI (if rild crashed and we have reconnected)
|
||||||
*/
|
*/
|
||||||
GASSERT(!slot->imei || !g_strcmp0(slot->imei, imei));
|
GASSERT(!slot->imei || !g_strcmp0(slot->imei, imei));
|
||||||
g_free(slot->imei);
|
|
||||||
slot->pub.imei = slot->imei = imei;
|
|
||||||
|
|
||||||
ril_plugin_check_modem(slot);
|
|
||||||
ril_plugin_update_ready(plugin);
|
|
||||||
} else {
|
} else {
|
||||||
ofono_error("Slot %u IMEI query error: %s", slot->config.slot,
|
ofono_error("Slot %u IMEI query error: %s", slot->config.slot,
|
||||||
ril_error_to_string(status));
|
ril_error_to_string(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (link = plugin->slots; link && all_done; link = link->next) {
|
g_free(slot->imei);
|
||||||
if (((struct ril_slot *)link->data)->imei_req_id) {
|
slot->pub.imei = slot->imei = (imei ? imei : g_strdup("ERROR"));
|
||||||
all_done = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (all_done) {
|
ril_plugin_check_modem(slot);
|
||||||
DBG("all done");
|
ril_plugin_update_ready(slot->plugin);
|
||||||
ril_plugin_dbus_block_imei_requests(plugin->dbus, FALSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -44,6 +44,16 @@
|
|||||||
|
|
||||||
#include "mbpi.h"
|
#include "mbpi.h"
|
||||||
|
|
||||||
|
const char *mbpi_database = MBPI_DATABASE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use IPv4 for MMS contexts because gprs.c assumes that MMS proxy
|
||||||
|
* address is IPv4.
|
||||||
|
*/
|
||||||
|
enum ofono_gprs_proto mbpi_default_internet_proto = OFONO_GPRS_PROTO_IPV4V6;
|
||||||
|
enum ofono_gprs_proto mbpi_default_mms_proto = OFONO_GPRS_PROTO_IP;
|
||||||
|
enum ofono_gprs_proto mbpi_default_proto = OFONO_GPRS_PROTO_IP;
|
||||||
|
|
||||||
#define _(x) case x: return (#x)
|
#define _(x) case x: return (#x)
|
||||||
|
|
||||||
enum MBPI_ERROR {
|
enum MBPI_ERROR {
|
||||||
@@ -111,7 +121,7 @@ static void mbpi_g_set_error(GMarkupParseContext *context, GError **error,
|
|||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
g_prefix_error(error, "%s:%d ", MBPI_DATABASE, line_number);
|
g_prefix_error(error, "%s:%d ", mbpi_database, line_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void text_handler(GMarkupParseContext *context,
|
static void text_handler(GMarkupParseContext *context,
|
||||||
@@ -166,7 +176,7 @@ static void authentication_start(GMarkupParseContext *context,
|
|||||||
static void usage_start(GMarkupParseContext *context,
|
static void usage_start(GMarkupParseContext *context,
|
||||||
const gchar **attribute_names,
|
const gchar **attribute_names,
|
||||||
const gchar **attribute_values,
|
const gchar **attribute_values,
|
||||||
enum ofono_gprs_context_type *type, GError **error)
|
struct ofono_gprs_provision_data *apn, GError **error)
|
||||||
{
|
{
|
||||||
const char *text = NULL;
|
const char *text = NULL;
|
||||||
int i;
|
int i;
|
||||||
@@ -182,12 +192,14 @@ static void usage_start(GMarkupParseContext *context,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(text, "internet") == 0)
|
if (strcmp(text, "internet") == 0) {
|
||||||
*type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
apn->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
||||||
else if (strcmp(text, "mms") == 0)
|
apn->proto = mbpi_default_internet_proto;
|
||||||
*type = OFONO_GPRS_CONTEXT_TYPE_MMS;
|
} else if (strcmp(text, "mms") == 0) {
|
||||||
else if (strcmp(text, "wap") == 0)
|
apn->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
|
||||||
*type = OFONO_GPRS_CONTEXT_TYPE_WAP;
|
apn->proto = mbpi_default_mms_proto;
|
||||||
|
} else if (strcmp(text, "wap") == 0)
|
||||||
|
apn->type = OFONO_GPRS_CONTEXT_TYPE_WAP;
|
||||||
else
|
else
|
||||||
mbpi_g_set_error(context, error, G_MARKUP_ERROR,
|
mbpi_g_set_error(context, error, G_MARKUP_ERROR,
|
||||||
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
|
||||||
@@ -220,7 +232,7 @@ static void apn_start(GMarkupParseContext *context, const gchar *element_name,
|
|||||||
&apn->message_proxy);
|
&apn->message_proxy);
|
||||||
else if (g_str_equal(element_name, "usage"))
|
else if (g_str_equal(element_name, "usage"))
|
||||||
usage_start(context, attribute_names, attribute_values,
|
usage_start(context, attribute_names, attribute_values,
|
||||||
&apn->type, error);
|
apn, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apn_end(GMarkupParseContext *context, const gchar *element_name,
|
static void apn_end(GMarkupParseContext *context, const gchar *element_name,
|
||||||
@@ -331,7 +343,7 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
|
|||||||
|
|
||||||
ap->apn = g_strdup(apn);
|
ap->apn = g_strdup(apn);
|
||||||
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
||||||
ap->proto = OFONO_GPRS_PROTO_IP;
|
ap->proto = mbpi_default_proto;
|
||||||
ap->auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
|
ap->auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
|
||||||
|
|
||||||
g_markup_parse_context_push(context, &apn_parser, ap);
|
g_markup_parse_context_push(context, &apn_parser, ap);
|
||||||
@@ -611,11 +623,11 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
|
|||||||
GMarkupParseContext *context;
|
GMarkupParseContext *context;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
fd = open(MBPI_DATABASE, O_RDONLY);
|
fd = open(mbpi_database, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
g_set_error(error, G_FILE_ERROR,
|
g_set_error(error, G_FILE_ERROR,
|
||||||
g_file_error_from_errno(errno),
|
g_file_error_from_errno(errno),
|
||||||
"open(%s) failed: %s", MBPI_DATABASE,
|
"open(%s) failed: %s", mbpi_database,
|
||||||
g_strerror(errno));
|
g_strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -624,7 +636,7 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
|
|||||||
close(fd);
|
close(fd);
|
||||||
g_set_error(error, G_FILE_ERROR,
|
g_set_error(error, G_FILE_ERROR,
|
||||||
g_file_error_from_errno(errno),
|
g_file_error_from_errno(errno),
|
||||||
"fstat(%s) failed: %s", MBPI_DATABASE,
|
"fstat(%s) failed: %s", mbpi_database,
|
||||||
g_strerror(errno));
|
g_strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -634,7 +646,7 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
|
|||||||
close(fd);
|
close(fd);
|
||||||
g_set_error(error, G_FILE_ERROR,
|
g_set_error(error, G_FILE_ERROR,
|
||||||
g_file_error_from_errno(errno),
|
g_file_error_from_errno(errno),
|
||||||
"mmap(%s) failed: %s", MBPI_DATABASE,
|
"mmap(%s) failed: %s", mbpi_database,
|
||||||
g_strerror(errno));
|
g_strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern const char *mbpi_database;
|
||||||
|
extern enum ofono_gprs_proto mbpi_default_internet_proto;
|
||||||
|
extern enum ofono_gprs_proto mbpi_default_mms_proto;
|
||||||
|
extern enum ofono_gprs_proto mbpi_default_proto;
|
||||||
|
|
||||||
const char *mbpi_ap_type(enum ofono_gprs_context_type type);
|
const char *mbpi_ap_type(enum ofono_gprs_context_type type);
|
||||||
|
|
||||||
void mbpi_ap_free(struct ofono_gprs_provision_data *data);
|
void mbpi_ap_free(struct ofono_gprs_provision_data *data);
|
||||||
|
|||||||
Reference in New Issue
Block a user