From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/2] [sim] Emit LockedPins after pin_type is queried
Date: Wed, 17 Jun 2015 23:07:53 -0500 [thread overview]
Message-ID: <55824419.5080703@gmail.com> (raw)
In-Reply-To: <1434628017-28441-2-git-send-email-tommi.kenakkala@tieto.com>
[-- Attachment #1: Type: text/plain, Size: 2162 bytes --]
Hi Tommi,
On 06/18/2015 06:46 AM, Tommi Kenakkala wrote:
> Fixes property change not being emited when hot-swapping a
> PIN-enabled card.
> ---
> src/sim.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/src/sim.c b/src/sim.c
> index b5badf1..0bcafe0 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -2737,6 +2737,10 @@ static void sim_pin_query_cb(const struct ofono_error *error,
> DBusConnection *conn = ofono_dbus_get_connection();
> const char *path = __ofono_atom_get_path(sim->atom);
> const char *pin_name;
> + char **locked_pins;
> + gboolean lock_changed;
> +
> + DBG("sim->pin_type: %d, pin_type: %d", sim->pin_type, pin_type);
>
> if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
> ofono_error("Querying PIN authentication state failed");
> @@ -2751,9 +2755,23 @@ static void sim_pin_query_cb(const struct ofono_error *error,
> password_is_pin(pin_type) == FALSE)
> pin_type = puk2pin(pin_type);
>
> - if (pin_type != OFONO_SIM_PASSWORD_INVALID)
> + if (pin_type != OFONO_SIM_PASSWORD_INVALID) {
you might want to add && pin_type != OFONO_SIM_PASSWORD_NONE here. See
below.
> + lock_changed = !sim->locked_pins[pin_type];
> +
So when do you want to emit LockedPins here? Only when the list is
non-empty or always?
There is a subtlety here. OFONO_SIM_PASSWORD_NONE is never considered
when emitting LockedPins. However, in this proposal you can trigger a
LockedPins emission even if there's no PIN set.
To me it seems like emitting LockedPins with an empty value seems
unnecessary. Thoughts?
> sim->locked_pins[pin_type] = TRUE;
>
> + if (lock_changed) {
> + 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);
> + }
> + }
> ofono_dbus_signal_property_changed(conn, path,
> OFONO_SIM_MANAGER_INTERFACE,
> "PinRequired", DBUS_TYPE_STRING,
>
Regards,
-Denis
next prev parent reply other threads:[~2015-06-18 4:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-18 11:46 [PATCH 0/2] Improve support for card hot-swapping Tommi Kenakkala
2015-06-18 11:46 ` [PATCH 1/2] [sim] Emit LockedPins after pin_type is queried Tommi Kenakkala
2015-06-18 4:07 ` Denis Kenzior [this message]
2015-06-22 13:37 ` [PATCH 2/2] " Tommi Kenakkala
2015-06-18 19:59 ` Denis Kenzior
2015-06-18 11:46 ` [PATCH 2/2] [sim] Reset pin_type on card remove Tommi Kenakkala
2015-06-18 4:09 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55824419.5080703@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox