* [PATCH] sim: Add support for query facility lock
@ 2016-04-27 15:22 Samrat Guha Niyogi
2016-04-27 15:32 ` Denis Kenzior
0 siblings, 1 reply; 3+ messages in thread
From: Samrat Guha Niyogi @ 2016-04-27 15:22 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3430 bytes --]
---
include/sim.h | 6 ++++++
src/sim.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
diff --git a/include/sim.h b/include/sim.h
index ed850f9..9470d4d 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -121,6 +121,9 @@ typedef void (*ofono_sim_lock_unlock_cb_t)(const struct ofono_error *error,
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;
int (*probe)(struct ofono_sim *sim, unsigned int vendor, void *data);
@@ -173,6 +176,9 @@ struct ofono_sim_driver {
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);
diff --git a/src/sim.c b/src/sim.c
index 94d8840..aedc617 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -2449,6 +2449,60 @@ static void sim_free_state(struct ofono_sim *sim)
sim_free_main_state(sim);
}
+static void sim_query_fac_imsilock_cb(const struct ofono_error *error,
+ ofono_bool_t status,
+ void *data)
+{
+ struct ofono_sim *sim = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+ char **locked_pins;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ ofono_error("Querying Facility Lock for IMSI Lock failed");
+ return;
+ }
+
+ sim->locked_pins[OFONO_SIM_PASSWORD_PHSIM_PIN] = status;
+
+ locked_pins = get_locked_pins(sim);
+
+ ofono_dbus_signal_array_property_changed(conn,
+ path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "LockedPins", DBUS_TYPE_STRING,
+ &locked_pins);
+
+ g_strfreev(locked_pins);
+}
+
+static void sim_query_fac_networklock_cb(const struct ofono_error *error,
+ ofono_bool_t status,
+ void *data)
+{
+ struct ofono_sim *sim = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+ char **locked_pins;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ ofono_error("Querying Facility Lock for Network Lock failed");
+ return;
+ }
+
+ sim->locked_pins[OFONO_SIM_PASSWORD_PHNET_PIN] = status;
+
+ locked_pins = get_locked_pins(sim);
+
+ ofono_dbus_signal_array_property_changed(conn,
+ path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "LockedPins", DBUS_TYPE_STRING,
+ &locked_pins);
+
+ g_strfreev(locked_pins);
+}
+
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
{
if (sim->state == OFONO_SIM_STATE_RESETTING && inserted) {
@@ -2475,6 +2529,14 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
call_state_watches(sim);
if (inserted) {
+ 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_initialize(sim);
} else {
sim->pin_type = OFONO_SIM_PASSWORD_NONE;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: Add support for query facility lock
2016-04-27 15:22 [PATCH] sim: Add support for query facility lock Samrat Guha Niyogi
@ 2016-04-27 15:32 ` Denis Kenzior
2016-04-27 15:43 ` Guha
0 siblings, 1 reply; 3+ messages in thread
From: Denis Kenzior @ 2016-04-27 15:32 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
Hi Samrat,
On 04/27/2016 10:22 AM, Samrat Guha Niyogi wrote:
> ---
> include/sim.h | 6 ++++++
> src/sim.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 68 insertions(+)
>
Please split this up into two. One for include/sim.h and the other
src/sim.c
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] sim: Add support for query facility lock
2016-04-27 15:32 ` Denis Kenzior
@ 2016-04-27 15:43 ` Guha
0 siblings, 0 replies; 3+ messages in thread
From: Guha @ 2016-04-27 15:43 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]
Hi Denis,
I have sent you 3 fresh patches now.
Thanks & Regards,
Samrat Guha Niyogi
-----Original Message-----
From: Denis Kenzior [mailto:denkenz(a)gmail.com]
Sent: Wednesday, April 27, 2016 9:02 PM
To: ofono(a)ofono.org
Cc: Guha Niyogi, Samrat <samrat.guha.niyogi@intel.com>; Kenzior, Denis <denis.kenzior@intel.com>
Subject: Re: [PATCH] sim: Add support for query facility lock
Hi Samrat,
On 04/27/2016 10:22 AM, Samrat Guha Niyogi wrote:
> ---
> include/sim.h | 6 ++++++
> src/sim.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 68 insertions(+)
>
Please split this up into two. One for include/sim.h and the other src/sim.c
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-27 15:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 15:22 [PATCH] sim: Add support for query facility lock Samrat Guha Niyogi
2016-04-27 15:32 ` Denis Kenzior
2016-04-27 15:43 ` Guha
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.