Compare commits

...

5 Commits

Author SHA1 Message Date
Slava Monich
c572e83247 [ril] Fixed IMEI query at startup. Fixes JB#34937
IMEI related queries were being completed too early.
2016-04-22 14:08:07 +03:00
Slava Monich
dd21e34a86 [ril] Prevent crash in ril_delayed_register. Fixes JB#34928
Delayed registration needs to be cancelled by ril_phonebook_remove
if it (registration) hasn't been done yet.
2016-04-22 14:07:34 +03:00
Slava Monich
8de5892827 [ofono] Use IPV4V6 (dual) for internet context by default. Fixes JB#32750 2016-04-22 14:06:44 +03:00
Slava Monich
8b2ef760c7 [ofono] mbpi: Make default packet data protocol configurable. Contributes to JB#32750
Note that according to TS 23.401, UE which is IPv6 and IPv4 capable
should request IPv4v6.
2016-04-22 14:06:35 +03:00
Slava Monich
0ee292e0f6 [ofono] mbpi: Make MBPI database file configurable at runtime
Useful for provisioning unit tests, if nothing else.
2016-04-22 14:06:20 +03:00
4 changed files with 46 additions and 34 deletions

View File

@@ -153,6 +153,7 @@ struct pb_data {
struct ofono_sim *sim;
struct ofono_sim_context *sim_context;
const unsigned char *df_path;
guint register_id;
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)
{
struct ofono_phonebook *pb = user_data;
struct pb_data *pbd = ofono_phonebook_get_data(pb);
pbd->register_id = 0;
ofono_phonebook_register(pb);
return FALSE;
}
@@ -1040,7 +1043,7 @@ static int ril_phonebook_probe(struct ofono_phonebook *pb,
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;
}
@@ -1049,6 +1052,10 @@ static void ril_phonebook_remove(struct ofono_phonebook *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_sim_context_free(pbd->sim_context);

View File

@@ -518,8 +518,9 @@ static void ril_plugin_update_ready(struct ril_plugin_priv *plugin)
}
if (plugin->pub.ready != ready) {
DBG("%sready", ready ? "" : "not ");
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);
}
}
@@ -827,16 +828,13 @@ static void ril_plugin_imei_cb(GRilIoChannel *io, int status,
const void *data, guint len, void *user_data)
{
struct ril_slot *slot = user_data;
struct ril_plugin_priv *plugin = slot->plugin;
gboolean all_done = TRUE;
GSList *link;
char *imei = NULL;
GASSERT(slot->imei_req_id);
slot->imei_req_id = 0;
if (status == RIL_E_SUCCESS) {
GRilIoParser rilp;
char *imei;
grilio_parser_init(&rilp, data, len);
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)
*/
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 {
ofono_error("Slot %u IMEI query error: %s", slot->config.slot,
ril_error_to_string(status));
}
for (link = plugin->slots; link && all_done; link = link->next) {
if (((struct ril_slot *)link->data)->imei_req_id) {
all_done = FALSE;
}
}
g_free(slot->imei);
slot->pub.imei = slot->imei = (imei ? imei : g_strdup("ERROR"));
if (all_done) {
DBG("all done");
ril_plugin_dbus_block_imei_requests(plugin->dbus, FALSE);
}
ril_plugin_check_modem(slot);
ril_plugin_update_ready(slot->plugin);
}
/*

View File

@@ -44,6 +44,16 @@
#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)
enum MBPI_ERROR {
@@ -111,7 +121,7 @@ static void mbpi_g_set_error(GMarkupParseContext *context, GError **error,
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,
@@ -166,7 +176,7 @@ static void authentication_start(GMarkupParseContext *context,
static void usage_start(GMarkupParseContext *context,
const gchar **attribute_names,
const gchar **attribute_values,
enum ofono_gprs_context_type *type, GError **error)
struct ofono_gprs_provision_data *apn, GError **error)
{
const char *text = NULL;
int i;
@@ -182,12 +192,14 @@ static void usage_start(GMarkupParseContext *context,
return;
}
if (strcmp(text, "internet") == 0)
*type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
else if (strcmp(text, "mms") == 0)
*type = OFONO_GPRS_CONTEXT_TYPE_MMS;
else if (strcmp(text, "wap") == 0)
*type = OFONO_GPRS_CONTEXT_TYPE_WAP;
if (strcmp(text, "internet") == 0) {
apn->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
apn->proto = mbpi_default_internet_proto;
} else if (strcmp(text, "mms") == 0) {
apn->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
apn->proto = mbpi_default_mms_proto;
} else if (strcmp(text, "wap") == 0)
apn->type = OFONO_GPRS_CONTEXT_TYPE_WAP;
else
mbpi_g_set_error(context, error, G_MARKUP_ERROR,
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
@@ -220,7 +232,7 @@ static void apn_start(GMarkupParseContext *context, const gchar *element_name,
&apn->message_proxy);
else if (g_str_equal(element_name, "usage"))
usage_start(context, attribute_names, attribute_values,
&apn->type, error);
apn, error);
}
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->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;
g_markup_parse_context_push(context, &apn_parser, ap);
@@ -611,11 +623,11 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
GMarkupParseContext *context;
gboolean ret;
fd = open(MBPI_DATABASE, O_RDONLY);
fd = open(mbpi_database, O_RDONLY);
if (fd < 0) {
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
"open(%s) failed: %s", MBPI_DATABASE,
"open(%s) failed: %s", mbpi_database,
g_strerror(errno));
return FALSE;
}
@@ -624,7 +636,7 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
close(fd);
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
"fstat(%s) failed: %s", MBPI_DATABASE,
"fstat(%s) failed: %s", mbpi_database,
g_strerror(errno));
return FALSE;
}
@@ -634,7 +646,7 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
close(fd);
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
"mmap(%s) failed: %s", MBPI_DATABASE,
"mmap(%s) failed: %s", mbpi_database,
g_strerror(errno));
return FALSE;
}

View File

@@ -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);
void mbpi_ap_free(struct ofono_gprs_provision_data *data);