All of lore.kernel.org
 help / color / mirror / Atom feed
* [sim-fdn PATCH 0/4] Handle FDN
@ 2010-08-26 12:52 Pekka.Pessi
  2010-08-26 12:52 ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Pekka.Pessi
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka.Pessi @ 2010-08-26 12:52 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

Hi all,

These patches add FDN enable/disable to the SIM API. 

FDN is a SIM feature where calls can be dialled or SMSs sent only to numbers
listed on special FDN phonebook on the card. The phonebook as well as
activation and deactivation is protected by PIN2 password.

--Pekka


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods
  2010-08-26 12:52 [sim-fdn PATCH 0/4] Handle FDN Pekka.Pessi
@ 2010-08-26 12:52 ` Pekka.Pessi
  2010-08-26 12:52   ` [sim-fdn PATCH 2/4] atmodem/sim: implement enable_fdn Pekka.Pessi
  2010-08-26 15:23   ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Denis Kenzior
  0 siblings, 2 replies; 10+ messages in thread
From: Pekka.Pessi @ 2010-08-26 12:52 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3018 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Enable or disable Fixed Dialing Numbers feature on SIM card.

If enabled, calls can be dialled or SMSs sent only to numbers listed on
special FDN phonebook on the SIM card.
---
 include/sim.h |    3 ++
 src/sim.c     |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index d3e564c..4639671 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -157,6 +157,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 (*enable_fdn)(struct ofono_sim *sim,
+			int enable, const char *passwd,
+			ofono_sim_lock_unlock_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 bac77e0..7af4565 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -626,6 +626,61 @@ static DBusMessage *sim_unlock_pin(DBusConnection *conn, DBusMessage *msg,
 	return sim_lock_or_unlock(sim, 0, conn, msg);
 }
 
+static void sim_fdn_cb(const struct ofono_error *error, void *data)
+{
+	struct ofono_sim *sim = data;
+	DBusMessage *reply;
+
+	if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+		reply = dbus_message_new_method_return(sim->pending);
+	else
+		reply = __ofono_error_failed(sim->pending);
+
+	__ofono_dbus_pending_reply(&sim->pending, reply);
+}
+
+static DBusMessage *sim_fdn(struct ofono_sim *sim, int enable,
+				DBusConnection *conn, DBusMessage *msg)
+{
+	const char *pin;
+
+	if (!sim->driver->enable_fdn)
+		return __ofono_error_not_implemented(msg);
+
+	if (sim->pending)
+		return __ofono_error_busy(msg);
+
+	if (dbus_message_get_args(msg, NULL,
+					DBUS_TYPE_STRING, &pin,
+					DBUS_TYPE_INVALID) == FALSE)
+		return __ofono_error_invalid_args(msg);
+
+	if (!is_valid_pin(pin, PIN_TYPE_PIN))
+		return __ofono_error_invalid_format(msg);
+
+	sim->pending = dbus_message_ref(msg);
+
+	sim->driver->enable_fdn(sim, enable, pin, sim_fdn_cb, sim);
+
+	return NULL;
+}
+
+static DBusMessage *sim_enable_fdn(DBusConnection *conn, DBusMessage *msg,
+					void *data)
+{
+	struct ofono_sim *sim = data;
+
+	return sim_fdn(sim, 1, conn, msg);
+}
+
+static DBusMessage *sim_disable_fdn(DBusConnection *conn, DBusMessage *msg,
+					void *data)
+{
+	struct ofono_sim *sim = data;
+
+	return sim_fdn(sim, 0, conn, msg);
+}
+
 static void sim_change_pin_cb(const struct ofono_error *error, void *data)
 {
 	struct ofono_sim *sim = data;
@@ -787,6 +842,10 @@ static GDBusMethodTable sim_methods[] = {
 							G_DBUS_METHOD_FLAG_ASYNC },
 	{ "UnlockPin",		"ss",	"",		sim_unlock_pin,
 							G_DBUS_METHOD_FLAG_ASYNC },
+	{ "EnableFDN",		"s",	"",		sim_enable_fdn,
+							G_DBUS_METHOD_FLAG_ASYNC },
+	{ "DisableFDN",		"s",	"",		sim_disable_fdn,
+							G_DBUS_METHOD_FLAG_ASYNC },
 	{ }
 };
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [sim-fdn PATCH 2/4] atmodem/sim: implement enable_fdn
  2010-08-26 12:52 ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Pekka.Pessi
@ 2010-08-26 12:52   ` Pekka.Pessi
  2010-08-26 12:52     ` [sim-fdn PATCH 3/4] Added test/disable-fdn Pekka.Pessi
  2010-08-26 15:23   ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Denis Kenzior
  1 sibling, 1 reply; 10+ messages in thread
From: Pekka.Pessi @ 2010-08-26 12:52 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 drivers/atmodem/sim.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 2f68b5f..1a6b1f4 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -856,6 +856,35 @@ error:
 	CALLBACK_WITH_FAILURE(cb, -1, data);
 }
 
+static void at_enable_fdn(struct ofono_sim *sim,
+				int enable, const char *passwd,
+				ofono_sim_lock_unlock_cb_t cb, void *data)
+{
+	struct sim_data *sd = ofono_sim_get_data(sim);
+	struct cb_data *cbd = cb_data_new(cb, data);
+	char buf[64];
+	int ret;
+
+	if (!cbd)
+		goto error;
+
+	snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i,\"%s\"",
+			"FD", enable ? 1 : 0, passwd);
+
+	ret = g_at_chat_send(sd->chat, buf, none_prefix,
+				at_lock_unlock_cb, cbd, g_free);
+
+	memset(buf, 0, sizeof(buf));
+
+	if (ret > 0)
+		return;
+
+error:
+	g_free(cbd);
+
+	CALLBACK_WITH_FAILURE(cb, data);
+}
+
 static gboolean at_sim_register(gpointer user)
 {
 	struct ofono_sim *sim = user;
@@ -923,6 +952,7 @@ static struct ofono_sim_driver driver = {
 	.lock			= at_pin_enable,
 	.change_passwd		= at_change_passwd,
 	.query_locked		= at_pin_query_enabled,
+	.enable_fdn             = at_enable_fdn,
 };
 
 void at_sim_init()
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [sim-fdn PATCH 3/4] Added test/disable-fdn
  2010-08-26 12:52   ` [sim-fdn PATCH 2/4] atmodem/sim: implement enable_fdn Pekka.Pessi
@ 2010-08-26 12:52     ` Pekka.Pessi
  2010-08-26 12:52       ` [sim-fdn PATCH 4/4] Added test/enable-fdn Pekka.Pessi
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka.Pessi @ 2010-08-26 12:52 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 test/disable-fdn |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100755 test/disable-fdn

diff --git a/test/disable-fdn b/test/disable-fdn
new file mode 100755
index 0000000..61b731d
--- /dev/null
+++ b/test/disable-fdn
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+def default_modem():
+	manager = bus.get_object('org.ofono', '/')
+	properties = manager.GetProperties(dbus_interface = 'org.ofono.Manager')
+	modems = properties["Modems"]
+	if not modems:
+		sys.stderr.write("No modems available\n")
+		sys.exit(1)
+	return modems[0]
+
+if len(sys.argv) == 3:
+	path, pin = sys.argv[1:]
+elif len(sys.argv) == 2:
+	path, pin = default_modem(), sys.argv[1]
+else:
+	print "%s [PATH] pin2" % (sys.argv[0])
+	sys.exit(0)
+
+print "Disable FDN for modem %s..." % (path,)
+
+modem = bus.get_object('org.ofono', path)
+
+simmanager = dbus.Interface(modem, 'org.ofono.SimManager')
+
+simmanager.DisableFDN(pin)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [sim-fdn PATCH 4/4] Added test/enable-fdn
  2010-08-26 12:52     ` [sim-fdn PATCH 3/4] Added test/disable-fdn Pekka.Pessi
@ 2010-08-26 12:52       ` Pekka.Pessi
  0 siblings, 0 replies; 10+ messages in thread
From: Pekka.Pessi @ 2010-08-26 12:52 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 test/enable-fdn |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100755 test/enable-fdn

diff --git a/test/enable-fdn b/test/enable-fdn
new file mode 100755
index 0000000..3061e36
--- /dev/null
+++ b/test/enable-fdn
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+def default_modem():
+	manager = bus.get_object('org.ofono', '/')
+	properties = manager.GetProperties(dbus_interface = 'org.ofono.Manager')
+	modems = properties["Modems"]
+	if not modems:
+		sys.stderr.write("No modems available\n")
+		sys.exit(1)
+	return modems[0]
+
+if len(sys.argv) == 3:
+	path, pin = sys.argv[1:]
+elif len(sys.argv) == 2:
+	path, pin = default_modem(), sys.argv[1]
+else:
+	print "%s [PATH] pin2" % (sys.argv[0])
+	sys.exit(0)
+
+print "Enable FDN for modem %s..." % (path,)
+
+modem = bus.get_object('org.ofono', path)
+
+simmanager = dbus.Interface(modem, 'org.ofono.SimManager')
+
+simmanager.EnableFDN(pin)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods
  2010-08-26 12:52 ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Pekka.Pessi
  2010-08-26 12:52   ` [sim-fdn PATCH 2/4] atmodem/sim: implement enable_fdn Pekka.Pessi
@ 2010-08-26 15:23   ` Denis Kenzior
  2010-08-26 15:54     ` Pekka Pessi
  1 sibling, 1 reply; 10+ messages in thread
From: Denis Kenzior @ 2010-08-26 15:23 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Hi Pekka,

On 08/26/2010 07:52 AM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
> 
> Enable or disable Fixed Dialing Numbers feature on SIM card.
> 
> If enabled, calls can be dialled or SMSs sent only to numbers listed on
> special FDN phonebook on the SIM card.

FDN has serious implications for the rest of the system, particularly on
SMS atom and Sim Toolkit.  oFono will either have to support the entire
thing properly or use a 'limited' FDN mode (e.g. if FDN is enabled, we
only permit emergency calls.)

We have really not made our mind what makes sense here yet.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods
  2010-08-26 15:23   ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Denis Kenzior
@ 2010-08-26 15:54     ` Pekka Pessi
  2010-08-26 15:59       ` Denis Kenzior
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka Pessi @ 2010-08-26 15:54 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

2010/8/26 Denis Kenzior <denkenz@gmail.com>:
> Hi Pekka,
>
> On 08/26/2010 07:52 AM, Pekka.Pessi(a)nokia.com wrote:
>> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>>
>> Enable or disable Fixed Dialing Numbers feature on SIM card.
>>
>> If enabled, calls can be dialled or SMSs sent only to numbers listed on
>> special FDN phonebook on the SIM card.
>
> FDN has serious implications for the rest of the system, particularly on
> SMS atom and Sim Toolkit.  oFono will either have to support the entire
> thing properly or use a 'limited' FDN mode (e.g. if FDN is enabled, we
> only permit emergency calls.)

> We have really not made our mind what makes sense here yet.

I think most modems support FDN in the firmware. (Well, famous last
words.) I don't think it makes any sense to support or "support" it in
oFono.

-- 
Pekka.Pessi mail at nokia.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods
  2010-08-26 15:54     ` Pekka Pessi
@ 2010-08-26 15:59       ` Denis Kenzior
  2010-08-26 16:08         ` Pekka Pessi
  0 siblings, 1 reply; 10+ messages in thread
From: Denis Kenzior @ 2010-08-26 15:59 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]

Hi Pekka,

On 08/26/2010 10:54 AM, Pekka Pessi wrote:
> 2010/8/26 Denis Kenzior <denkenz@gmail.com>:
>> Hi Pekka,
>>
>> On 08/26/2010 07:52 AM, Pekka.Pessi(a)nokia.com wrote:
>>> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>>>
>>> Enable or disable Fixed Dialing Numbers feature on SIM card.
>>>
>>> If enabled, calls can be dialled or SMSs sent only to numbers listed on
>>> special FDN phonebook on the SIM card.
>>
>> FDN has serious implications for the rest of the system, particularly on
>> SMS atom and Sim Toolkit.  oFono will either have to support the entire
>> thing properly or use a 'limited' FDN mode (e.g. if FDN is enabled, we
>> only permit emergency calls.)
> 
>> We have really not made our mind what makes sense here yet.
> 
> I think most modems support FDN in the firmware. (Well, famous last
> words.) I don't think it makes any sense to support or "support" it in
> oFono.
> 

You're correct.  However, if FDN is enabled, carriers require that SMSes
to numbers not in FDN to be rejected.  It is quite unclear whether this
is done in the firmware or not.  If oFono has to handle it internally,
then we also require access to the FDN phonebook.

Sim Toolkit interactions require FDN to be explicitly ignored for Send
SMS, Setup Call.  If these are not handled in the firmware, then we
can't properly support FDN.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods
  2010-08-26 15:59       ` Denis Kenzior
@ 2010-08-26 16:08         ` Pekka Pessi
  2010-08-26 16:12           ` Denis Kenzior
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka Pessi @ 2010-08-26 16:08 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

Hi Denis,

2010/8/26 Denis Kenzior <denkenz@gmail.com>:
>>>> Enable or disable Fixed Dialing Numbers feature on SIM card.
>>>>
>>>> If enabled, calls can be dialled or SMSs sent only to numbers listed on
>>>> special FDN phonebook on the SIM card.
>>>
>>> FDN has serious implications for the rest of the system, particularly on
>>> SMS atom and Sim Toolkit.  oFono will either have to support the entire
>>> thing properly or use a 'limited' FDN mode (e.g. if FDN is enabled, we
>>> only permit emergency calls.)
>>
>>> We have really not made our mind what makes sense here yet.
>>
>> I think most modems support FDN in the firmware. (Well, famous last
>> words.) I don't think it makes any sense to support or "support" it in
>> oFono.
>
> You're correct.  However, if FDN is enabled, carriers require that SMSes
> to numbers not in FDN to be rejected.  It is quite unclear whether this
> is done in the firmware or not.  If oFono has to handle it internally,
> then we also require access to the FDN phonebook.
>
> Sim Toolkit interactions require FDN to be explicitly ignored for Send
> SMS, Setup Call.  If these are not handled in the firmware, then we
> can't properly support FDN.

Do you think oFono should reject the SIM if it happens to have FDN enabled? Why?

If we don't support FDN restrictions, we don't support. This has
nothing to do whether we should allow the user to disable the FDN on
the SIM card or not.

-- 
Pekka.Pessi mail at nokia.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods
  2010-08-26 16:08         ` Pekka Pessi
@ 2010-08-26 16:12           ` Denis Kenzior
  0 siblings, 0 replies; 10+ messages in thread
From: Denis Kenzior @ 2010-08-26 16:12 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]

Hi Pekka,

On 08/26/2010 11:08 AM, Pekka Pessi wrote:
> Hi Denis,
> 
> 2010/8/26 Denis Kenzior <denkenz@gmail.com>:
>>>>> Enable or disable Fixed Dialing Numbers feature on SIM card.
>>>>>
>>>>> If enabled, calls can be dialled or SMSs sent only to numbers listed on
>>>>> special FDN phonebook on the SIM card.
>>>>
>>>> FDN has serious implications for the rest of the system, particularly on
>>>> SMS atom and Sim Toolkit.  oFono will either have to support the entire
>>>> thing properly or use a 'limited' FDN mode (e.g. if FDN is enabled, we
>>>> only permit emergency calls.)
>>>
>>>> We have really not made our mind what makes sense here yet.
>>>
>>> I think most modems support FDN in the firmware. (Well, famous last
>>> words.) I don't think it makes any sense to support or "support" it in
>>> oFono.
>>
>> You're correct.  However, if FDN is enabled, carriers require that SMSes
>> to numbers not in FDN to be rejected.  It is quite unclear whether this
>> is done in the firmware or not.  If oFono has to handle it internally,
>> then we also require access to the FDN phonebook.
>>
>> Sim Toolkit interactions require FDN to be explicitly ignored for Send
>> SMS, Setup Call.  If these are not handled in the firmware, then we
>> can't properly support FDN.
> 
> Do you think oFono should reject the SIM if it happens to have FDN enabled? Why?

There is actually some 3GPP spec that mandates low-functionality mode if
FDN is not properly supported by the terminal.  e.g. 31.102:
"In case FDN is enabled, an ME which does not support FDN shall allow
emergency calls but shall not allow MO-CS calls and MO-SMS.
If BDN is enabled, an ME which does not support Call Control shall allow
emergency calls but shall not allow MO-CS calls."

> 
> If we don't support FDN restrictions, we don't support. This has
> nothing to do whether we should allow the user to disable the FDN on
> the SIM card or not.
> 

You might be right, I'm just saying we need to explore the issue more fully.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-08-26 16:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-26 12:52 [sim-fdn PATCH 0/4] Handle FDN Pekka.Pessi
2010-08-26 12:52 ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Pekka.Pessi
2010-08-26 12:52   ` [sim-fdn PATCH 2/4] atmodem/sim: implement enable_fdn Pekka.Pessi
2010-08-26 12:52     ` [sim-fdn PATCH 3/4] Added test/disable-fdn Pekka.Pessi
2010-08-26 12:52       ` [sim-fdn PATCH 4/4] Added test/enable-fdn Pekka.Pessi
2010-08-26 15:23   ` [sim-fdn PATCH 1/4] sim: add EnableFDN and DisableFDN methods Denis Kenzior
2010-08-26 15:54     ` Pekka Pessi
2010-08-26 15:59       ` Denis Kenzior
2010-08-26 16:08         ` Pekka Pessi
2010-08-26 16:12           ` Denis Kenzior

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.