All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Documented Present property in sim-api.txt.
@ 2010-06-28 18:20 Pekka Pessi
  2010-06-28 18:20 ` [PATCH 2/2] mbm: use cpin? to check if SIM is missing Pekka Pessi
  2010-06-29 17:22 ` [PATCH 1/2] Documented Present property in sim-api.txt Denis Kenzior
  0 siblings, 2 replies; 9+ messages in thread
From: Pekka Pessi @ 2010-06-28 18:20 UTC (permalink / raw)
  To: ofono

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

---
 doc/sim-api.txt |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/doc/sim-api.txt b/doc/sim-api.txt
index 74da31f..72e9ad9 100644
--- a/doc/sim-api.txt
+++ b/doc/sim-api.txt
@@ -7,7 +7,7 @@ Object path	[variable prefix]/{modem0,modem1,...}
 
 Methods		dict GetProperties()
 
-			Returns properties for the modem object. See
+			Returns SIM properties for the modem object.  See
 			the properties section for available properties.
 
 			Possible Errors: [service].Error.InvalidArguments
@@ -32,7 +32,7 @@ Methods		dict GetProperties()
 			Activates the lock for the particular pin type.  The
 			device will ask for a PIN automatically next time the
 			device is turned on or the SIM is removed and
-			re-inserter.  The current PIN is required for the
+			re-inserted.  The current PIN is required for the
 			operation to succeed.
 
 		void UnlockPin(string type, string pin)
@@ -45,9 +45,14 @@ Signals		PropertyChanged(string name, variant value)
 			This signal indicates a changed value of the given
 			property.
 
-Properties	string SubscriberIdentity [readonly, optional]
+Properties	boolean Present [readonly]
 
-			Contains the ISMI of the SIM, if available
+			True if a SIM card is detected.  There are
+			no other proprerties if false.
+
+		string SubscriberIdentity [readonly, optional]
+
+			Contains the IMSI of the SIM, if available.
 
 		string MobileCountryCode [readonly, optional]
 
@@ -119,4 +124,4 @@ Properties	string SubscriberIdentity [readonly, optional]
 		string CardIdentifier [readonly]
 
 			Contains the Intergrated Circuit Card Identifer (ICCID)
-			and is read directly from the SIM.
+			which is read directly from the SIM.
-- 
1.6.3.3


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

* [PATCH 2/2] mbm: use cpin? to check if SIM is missing
  2010-06-28 18:20 [PATCH 1/2] Documented Present property in sim-api.txt Pekka Pessi
@ 2010-06-28 18:20 ` Pekka Pessi
  2010-06-28 20:39   ` Andrzej Zaborowski
  2010-06-29 17:22 ` [PATCH 1/2] Documented Present property in sim-api.txt Denis Kenzior
  1 sibling, 1 reply; 9+ messages in thread
From: Pekka Pessi @ 2010-06-28 18:20 UTC (permalink / raw)
  To: ofono

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

Use AT+CPIN? in case AT+CRSM=242 is not supported.
---
 plugins/mbm.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/plugins/mbm.c b/plugins/mbm.c
index 9193539..bef8783 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -49,6 +49,7 @@
 
 static const char *cfun_prefix[] = { "+CFUN:", NULL };
 static const char *crsm_prefix[] = { "+CRSM:", NULL };
+static const char *cpin_prefix[] = { "+CPIN:", NULL };
 static const char *none_prefix[] = { NULL };
 
 struct mbm_data {
@@ -92,6 +93,18 @@ static void mbm_debug(const char *str, void *user_data)
 	ofono_info("%s %s", prefix, str);
 }
 
+static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	struct mbm_data *data = ofono_modem_get_data(modem);
+
+	DBG("");
+
+	data->have_sim = ok;
+
+	ofono_modem_set_powered(modem, TRUE);
+}
+
 static void status_check(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
@@ -101,8 +114,12 @@ static void status_check(gboolean ok, GAtResult *result, gpointer user_data)
 
 	DBG("");
 
-	if (!ok)
-		goto poweron;
+	if (!ok) {
+		/* If mbm does not support at+crsm=242, try at+cpin? */
+		g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
+			simpin_check, modem, NULL);
+		return;
+	}
 
 	/* Modem fakes a 94 04 response from card (File Id not found /
 	 * Pattern not found) when there's no card in the slot.
-- 
1.6.3.3


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

* Re: [PATCH 2/2] mbm: use cpin? to check if SIM is missing
  2010-06-28 18:20 ` [PATCH 2/2] mbm: use cpin? to check if SIM is missing Pekka Pessi
@ 2010-06-28 20:39   ` Andrzej Zaborowski
  2010-06-29 11:06     ` [PATCH] mbm: use CPIN? " Pekka Pessi
  2010-06-29 11:15     ` [PATCH 2/2] mbm: use cpin? " Pekka Pessi
  0 siblings, 2 replies; 9+ messages in thread
From: Andrzej Zaborowski @ 2010-06-28 20:39 UTC (permalink / raw)
  To: ofono

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

On 28 June 2010 20:20, Pekka Pessi <Pekka.Pessi@nokia.com> wrote:
> Use AT+CPIN? in case AT+CRSM=242 is not supported.

On the model where AT+CRSM works, AT+CPIN also works, so I propose to
use it always.  The firmware may cache information but when card is
extracted it notices.

Regards,
Andrew

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

* [PATCH] mbm: use CPIN? to check if SIM is missing
  2010-06-28 20:39   ` Andrzej Zaborowski
@ 2010-06-29 11:06     ` Pekka Pessi
  2010-06-29 17:25       ` Denis Kenzior
  2010-06-29 11:15     ` [PATCH 2/2] mbm: use cpin? " Pekka Pessi
  1 sibling, 1 reply; 9+ messages in thread
From: Pekka Pessi @ 2010-06-29 11:06 UTC (permalink / raw)
  To: ofono

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

AT+CRSM=242 is not supported by all mbm models.
---
 plugins/mbm.c |   28 ++++++----------------------
 1 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/plugins/mbm.c b/plugins/mbm.c
index 9193539..864b0df 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -48,7 +48,7 @@
 #include <drivers/atmodem/vendor.h>
 
 static const char *cfun_prefix[] = { "+CFUN:", NULL };
-static const char *crsm_prefix[] = { "+CRSM:", NULL };
+static const char *cpin_prefix[] = { "+CPIN:", NULL };
 static const char *none_prefix[] = { NULL };
 
 struct mbm_data {
@@ -92,32 +92,16 @@ static void mbm_debug(const char *str, void *user_data)
 	ofono_info("%s %s", prefix, str);
 }
 
-static void status_check(gboolean ok, GAtResult *result, gpointer user_data)
+static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
 	struct mbm_data *data = ofono_modem_get_data(modem);
-	GAtResultIter iter;
-	gint sw[2];
 
 	DBG("");
 
-	if (!ok)
-		goto poweron;
-
-	/* Modem fakes a 94 04 response from card (File Id not found /
-	 * Pattern not found) when there's no card in the slot.
-	 */
-	g_at_result_iter_init(&iter, result);
-
-	if (!g_at_result_iter_next(&iter, "+CRSM:"))
-		goto poweron;
-
-	g_at_result_iter_next_number(&iter, &sw[0]);
-	g_at_result_iter_next_number(&iter, &sw[1]);
-
-	data->have_sim = sw[0] != 0x94 || sw[1] != 0x04;
+	/* Modem returns error if there is no SIM in slot */
+	data->have_sim = ok;
 
-poweron:
 	ofono_modem_set_powered(modem, TRUE);
 }
 
@@ -133,8 +117,8 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 		return;
 	}
 
-	g_at_chat_send(data->modem_port, "AT+CRSM=242", crsm_prefix,
-			status_check, modem, NULL);
+	g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
+			simpin_check, modem, NULL);
 }
 
 static void cfun_query(gboolean ok, GAtResult *result, gpointer user_data)
-- 
1.6.3.3


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

* Re: [PATCH 2/2] mbm: use cpin? to check if SIM is missing
  2010-06-28 20:39   ` Andrzej Zaborowski
  2010-06-29 11:06     ` [PATCH] mbm: use CPIN? " Pekka Pessi
@ 2010-06-29 11:15     ` Pekka Pessi
  1 sibling, 0 replies; 9+ messages in thread
From: Pekka Pessi @ 2010-06-29 11:15 UTC (permalink / raw)
  To: ofono

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

2010/6/28 Andrzej Zaborowski <andrew.zaborowski@intel.com>:
> On 28 June 2010 20:20, Pekka Pessi <Pekka.Pessi@nokia.com> wrote:
>> Use AT+CPIN? in case AT+CRSM=242 is not supported.
>
> On the model where AT+CRSM works, AT+CPIN also works, so I propose to
> use it always.  The firmware may cache information but when card is
> extracted it notices.

OK, I sent another patch that removed the AT+CRSM command...

--Pekka

-- 
Pekka.Pessi mail at nokia.com

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

* Re: [PATCH 1/2] Documented Present property in sim-api.txt.
  2010-06-28 18:20 [PATCH 1/2] Documented Present property in sim-api.txt Pekka Pessi
  2010-06-28 18:20 ` [PATCH 2/2] mbm: use cpin? to check if SIM is missing Pekka Pessi
@ 2010-06-29 17:22 ` Denis Kenzior
  1 sibling, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2010-06-29 17:22 UTC (permalink / raw)
  To: ofono

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

Hi Pekka,

> ---
>  doc/sim-api.txt |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)

Applied, thanks.

Regards,
-Denis

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

* Re: [PATCH] mbm: use CPIN? to check if SIM is missing
  2010-06-29 11:06     ` [PATCH] mbm: use CPIN? " Pekka Pessi
@ 2010-06-29 17:25       ` Denis Kenzior
  0 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2010-06-29 17:25 UTC (permalink / raw)
  To: ofono

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

Hi Pekka,

> AT+CRSM=242 is not supported by all mbm models.
> ---
>  plugins/mbm.c |   28 ++++++----------------------
>  1 files changed, 6 insertions(+), 22 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH 1/2] Documented Present property in sim-api.txt.
       [not found] <-6283240161481769156@unknownmsgid>
@ 2010-06-28 18:21 ` Pekka Pessi
  0 siblings, 0 replies; 9+ messages in thread
From: Pekka Pessi @ 2010-06-28 18:21 UTC (permalink / raw)
  To: ofono

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

Oh my yes. ;)

-- 
Pekka.Pessi mail at nokia.com

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

* [PATCH 1/2] Documented Present property in sim-api.txt.
@ 2010-06-28 18:17 y
  0 siblings, 0 replies; 9+ messages in thread
From: y @ 2010-06-28 18:17 UTC (permalink / raw)
  To: ofono

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

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

---
 doc/sim-api.txt |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/doc/sim-api.txt b/doc/sim-api.txt
index 74da31f..72e9ad9 100644
--- a/doc/sim-api.txt
+++ b/doc/sim-api.txt
@@ -7,7 +7,7 @@ Object path	[variable prefix]/{modem0,modem1,...}
 
 Methods		dict GetProperties()
 
-			Returns properties for the modem object. See
+			Returns SIM properties for the modem object.  See
 			the properties section for available properties.
 
 			Possible Errors: [service].Error.InvalidArguments
@@ -32,7 +32,7 @@ Methods		dict GetProperties()
 			Activates the lock for the particular pin type.  The
 			device will ask for a PIN automatically next time the
 			device is turned on or the SIM is removed and
-			re-inserter.  The current PIN is required for the
+			re-inserted.  The current PIN is required for the
 			operation to succeed.
 
 		void UnlockPin(string type, string pin)
@@ -45,9 +45,14 @@ Signals		PropertyChanged(string name, variant value)
 			This signal indicates a changed value of the given
 			property.
 
-Properties	string SubscriberIdentity [readonly, optional]
+Properties	boolean Present [readonly]
 
-			Contains the ISMI of the SIM, if available
+			True if a SIM card is detected.  There are
+			no other proprerties if false.
+
+		string SubscriberIdentity [readonly, optional]
+
+			Contains the IMSI of the SIM, if available.
 
 		string MobileCountryCode [readonly, optional]
 
@@ -119,4 +124,4 @@ Properties	string SubscriberIdentity [readonly, optional]
 		string CardIdentifier [readonly]
 
 			Contains the Intergrated Circuit Card Identifer (ICCID)
-			and is read directly from the SIM.
+			which is read directly from the SIM.
-- 
1.6.3.3


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

end of thread, other threads:[~2010-06-29 17:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-28 18:20 [PATCH 1/2] Documented Present property in sim-api.txt Pekka Pessi
2010-06-28 18:20 ` [PATCH 2/2] mbm: use cpin? to check if SIM is missing Pekka Pessi
2010-06-28 20:39   ` Andrzej Zaborowski
2010-06-29 11:06     ` [PATCH] mbm: use CPIN? " Pekka Pessi
2010-06-29 17:25       ` Denis Kenzior
2010-06-29 11:15     ` [PATCH 2/2] mbm: use cpin? " Pekka Pessi
2010-06-29 17:22 ` [PATCH 1/2] Documented Present property in sim-api.txt Denis Kenzior
     [not found] <-6283240161481769156@unknownmsgid>
2010-06-28 18:21 ` Pekka Pessi
  -- strict thread matches above, loose matches on Subject: below --
2010-06-28 18:17 y

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.