[-]
[+]
|
Changed |
_service:tar_git:ofono.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:ofono.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://git.merproject.org/slava/ofono.git</param>
<param name="branch">master</param>
- <param name="revision">baa4fe3</param>
+ <param name="revision">246e30d1</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/drivers/atmodem/sim.c
^
|
@@ -1516,7 +1516,7 @@
{
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 @@
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 @@
.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 @@
.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)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/drivers/isimodem/sim.c
^
|
@@ -652,7 +652,7 @@
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 @@
.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)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/drivers/isimodem/uicc.c
^
|
@@ -1032,14 +1032,6 @@
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 @@
.reset_passwd = uicc_reset_passwd,
.change_passwd = uicc_change_passwd,
.lock = uicc_lock,
- .query_locked = uicc_query_locked,
};
void isi_uicc_init(void)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/drivers/ril/ril_phonebook.c
^
|
@@ -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 @@
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 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 @@
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 @@
g_slist_free_full(pbd->pb_refs, g_free);
pbd->pb_refs = NULL;
+}
+
+static void export_and_return(struct ofono_phonebook *pb, gboolean ok)
+{
+ struct pb_data *pbd = ofono_phonebook_get_data(pb);
- if (ok)
- CALLBACK_WITH_SUCCESS(cb, cbd->data);
- else
- CALLBACK_WITH_FAILURE(cb, cbd->data);
+ DBG("phonebook fully read");
+ free_pb_refs(pbd, export_entry, pb);
- g_free(cbd);
+ 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 @@
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 @@
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 @@
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 @@
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;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/drivers/ril/ril_sim.c
^
|
@@ -89,6 +89,7 @@
ofono_sim_file_info_cb_t file_info;
ofono_sim_read_cb_t read;
ofono_sim_imsi_cb_t imsi;
+ ofono_query_facility_lock_cb_t query_facility_lock;
gpointer ptr;
} cb;
gpointer data;
@@ -851,49 +852,46 @@
return id;
}
-static void ril_sim_pin_change_state(struct ofono_sim *sim,
- enum ofono_sim_password_type passwd_type, int enable,
- const char *passwd, ofono_sim_lock_unlock_cb_t cb, void *data)
+static const char *ril_sim_facility_code(enum ofono_sim_password_type type)
{
- struct ril_sim *sd = ril_sim_get_data(sim);
- struct ofono_error error;
- const char *type_str = NULL;
- guint id = 0;
-
- switch (passwd_type) {
+ switch (type) {
case OFONO_SIM_PASSWORD_SIM_PIN:
- type_str = "SC";
- break;
+ return "SC";
+ case OFONO_SIM_PASSWORD_SIM_PIN2:
+ return "P2";
case OFONO_SIM_PASSWORD_PHSIM_PIN:
- type_str = "PS";
- break;
+ return "PS";
case OFONO_SIM_PASSWORD_PHFSIM_PIN:
- type_str = "PF";
- break;
- case OFONO_SIM_PASSWORD_SIM_PIN2:
- type_str = "P2";
- break;
+ return "PF";
case OFONO_SIM_PASSWORD_PHNET_PIN:
- id = ril_perso_change_state(sim, passwd_type, enable, passwd,
- cb, data);
- break;
+ return "PN";
case OFONO_SIM_PASSWORD_PHNETSUB_PIN:
- type_str = "PU";
- break;
+ return "PU";
case OFONO_SIM_PASSWORD_PHSP_PIN:
- type_str = "PP";
- break;
+ return "PP";
case OFONO_SIM_PASSWORD_PHCORP_PIN:
- type_str = "PC";
- break;
+ return "PC";
default:
- break;
+ return NULL;
}
+};
+
+static void ril_sim_pin_change_state(struct ofono_sim *sim,
+ enum ofono_sim_password_type passwd_type, int enable,
+ const char *passwd, ofono_sim_lock_unlock_cb_t cb, void *data)
+{
+ struct ril_sim *sd = ril_sim_get_data(sim);
+ struct ofono_error error;
+ const char *type_str = ril_sim_facility_code(passwd_type);
+ guint id = 0;
DBG("%d,%s,%d,%s,0,aid=%s", passwd_type, type_str, enable, passwd,
ril_sim_app_id(sd));
- if (type_str) {
+ if (passwd_type == OFONO_SIM_PASSWORD_PHNET_PIN) {
+ id = ril_perso_change_state(sim, passwd_type, enable, passwd,
+ cb, data);
+ } else if (type_str) {
GRilIoRequest *req = grilio_request_sized_new(60);
grilio_request_append_int32(req, SET_FACILITY_LOCK_PARAMS);
grilio_request_append_utf8(req, type_str);
@@ -957,6 +955,47 @@
grilio_request_unref(req);
}
+static void ril_sim_query_facility_lock_cb(GRilIoChannel *io, int status,
+ const void *data, guint len, void *user_data)
+{
+ struct ofono_error error;
+ struct ril_sim_cbd *cbd = user_data;
+ ofono_query_facility_lock_cb_t cb = cbd->cb.query_facility_lock;
+
+ if (status == RIL_E_SUCCESS) {
+ int locked = 0;
+ GRilIoParser rilp;
+
+ grilio_parser_init(&rilp, data, len);
+ if (grilio_parser_get_int32(&rilp, NULL) &&
+ grilio_parser_get_int32(&rilp, &locked)) {
+ DBG("%d", locked);
+ cb(ril_error_ok(&error), locked != 0, cbd->data);
+ return;
+ }
+ }
+
+ cb(ril_error_failure(&error), FALSE, cbd->data);
+}
+
+static void ril_sim_query_facility_lock(struct ofono_sim *sim,
+ enum ofono_sim_password_type type,
+ ofono_query_facility_lock_cb_t cb, void *data)
+{
+ struct ril_sim *sd = ril_sim_get_data(sim);
+ GRilIoRequest *req = grilio_request_new();
+
+ grilio_request_append_int32(req, 4);
+ grilio_request_append_utf8(req, ril_sim_facility_code(type));
+ grilio_request_append_utf8(req, "");
+ grilio_request_append_utf8(req, "0"); /* class */
+ grilio_request_append_utf8(req, ril_sim_app_id(sd));
+ grilio_queue_send_request_full(sd->q, req,
+ RIL_REQUEST_QUERY_FACILITY_LOCK, ril_sim_query_facility_lock_cb,
+ ril_sim_cbd_free, ril_sim_cbd_new(sd, cb, data));
+ grilio_request_unref(req);
+}
+
static gboolean ril_sim_register(gpointer user)
{
struct ril_sim *sd = user;
@@ -1040,7 +1079,8 @@
.lock = ril_sim_pin_change_state,
.reset_passwd = ril_sim_pin_send_puk,
.change_passwd = ril_sim_change_passwd,
- .query_pin_retries = ril_sim_query_pin_retries
+ .query_pin_retries = ril_sim_query_pin_retries,
+ .query_facility_lock = ril_sim_query_facility_lock
/*
* TODO: Implementing SIM write file IO support requires
* the following functions to be defined.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/include/sim.h
^
|
@@ -123,8 +123,8 @@
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 @@
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);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.17+git30.tar.bz2/ofono/src/sim.c
^
|
@@ -2609,6 +2609,52 @@
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 @@
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;
|