Skip to contentSkip to conversation

atutil: Parse CMS and CME error codes.

PATCH In review Andrzej Zaborowski 3 participants 8 messages Aug 5, 2010 – Aug 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 atutil: Parse CMS and CME error codes.

From: root <root@neo.(none)>

---
 drivers/atmodem/atutil.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/atmodem/atutil.c +6 -0
index 5dad679..e668602 100644
@@ -40,6 +40,12 @@ void decode_at_error(struct ofono_error *error, const char *final)
 	if (!strcmp(final, "OK")) {
 		error->type = OFONO_ERROR_TYPE_NO_ERROR;
 		error->error = 0;
+	} else if (g_str_has_prefix(final, "+CMS ERROR:")) {
+		error->type = OFONO_ERROR_TYPE_CMS;
+		error->error = strtol(&final[11], NULL, 0);
+	} else if (g_str_has_prefix(final, "+CME ERROR:")) {
+		error->type = OFONO_ERROR_TYPE_CME;
+		error->error = strtol(&final[11], NULL, 0);
 	} else {
 		error->type = OFONO_ERROR_TYPE_FAILURE;
 		error->error = 0;
Signature · 1 line
1.7.1.86.g0e460.dirty
#1 lore raw

PATCH 6/6 calypso: Create STK atom and reorder initialisation.

See comment in the code. The Sim Toolkit apps seem to work rather reliably with this, tested on both PIN-enabled and unprotected cards.

---
 plugins/calypso.c |   81 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 54 insertions(+), 27 deletions(-)
plugins/calypso.c +54 -27
index 5367684..6ef6968 100644
@@ -54,6 +54,7 @@
 #include <ofono/ssn.h>
 #include <ofono/ussd.h>
 #include <ofono/voicecall.h>
+#include <ofono/stk.h>
 
 #include <drivers/atmodem/vendor.h>
 
@@ -86,6 +87,7 @@ struct calypso_data {
 };
 
 static const char *cpin_prefix[] = { "+CPIN:", NULL };
+static const char *none_prefix[] = { NULL };
 
 static void calypso_debug(const char *str, void *data)
 {
@@ -197,31 +199,6 @@ static void setup_modem(struct ofono_modem *modem)
 			NULL, NULL, NULL);
 }
 
-static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data)
-{
-	struct ofono_modem *modem = user_data;
-	struct calypso_data *data = ofono_modem_get_data(modem);
-
-	DBG("");
-
-	if (ok == FALSE) {
-		int i;
-
-		for (i = 0; i < NUM_DLC; i++) {
-			g_at_chat_unref(data->dlcs[i]);
-			data->dlcs[i] = NULL;
-		}
-
-		g_at_mux_shutdown(data->mux);
-		g_at_mux_unref(data->mux);
-		data->mux = NULL;
-	} else {
-		setup_modem(modem);
-	}
-
-	ofono_modem_set_powered(modem, ok);
-}
-
 static void simpin_check_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct ofono_modem *modem = user_data;
@@ -232,8 +209,9 @@ static void simpin_check_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	/* Modem returns ERROR if there is no SIM in slot. */
 	data->have_sim = ok;
 
-	g_at_chat_send(data->dlcs[SETUP_DLC], "AT+CFUN=1", NULL,
-					cfun_set_on_cb, modem, NULL);
+	setup_modem(modem);
+
+	ofono_modem_set_powered(modem, TRUE);
 }
 
 static void init_simpin_check(struct ofono_modem *modem)
@@ -469,6 +447,55 @@ static void calypso_pre_sim(struct ofono_modem *modem)
 	sim = ofono_sim_create(modem, 0, "atmodem", data->dlcs[AUX_DLC]);
 	ofono_voicecall_create(modem, 0, "calypsomodem", data->dlcs[VOICE_DLC]);
 
+	/*
+	 * The STK atom is only useful after SIM has been initialised,
+	 * so really it belongs in post_sim.  However, the order of the
+	 * following three actions is adapted to work around different
+	 * issues with the Calypso's firmware in its different versions
+	 * (may have been fixed starting at some version, but this order
+	 * should work with any version).
+	 *
+	 * To deal with PIN-enabled and PIN-disabled SIM cards, the order
+	 * needs to be as follows:
+	 *
+	 * AT%SATC="..."
+	 * ...
+	 * AT+CFUN=1
+	 * ...
+	 * AT+CPIN="..."
+	 *
+	 * %SATC comes before the other two actions because it provides
+	 * the Terminal Profile data to the modem, which will be used
+	 * during the Profile Download either during +CFUN=1 (on
+	 * unprotected cards) or +CPIN="..." (on protected cards).
+	 * The STK atom needs to be present at this time because the
+	 * card may start issuing proactive commands immediately after
+	 * the Download.
+	 *
+	 * +CFUN=1 appears before PIN entry because switching from +CFUN
+	 * mode 0 later, on the Calypso has side effects at least on some
+	 * versions of the firmware:
+	 *
+	 * mode 0 -> 1 transition forces PIN re-authentication.
+	 * mode 0 -> 4 doesn't work at all.
+	 * mode 1 -> 4 and
+	 * mode 4 -> 1 transitions work and have no side effects.
+	 *
+	 * So in order to switch to Offline mode at startup,
+	 * AT+CFUN=1;+CFUN=4 would be needed.
+	 *
+	 * Additionally AT+CFUN=1 response is not checked: on PIN-enabled
+	 * cards, it will in most situations return "+CME ERROR: SIM PIN
+	 * required" (CME ERROR 11) even though the switch to mode 1
+	 * succeeds.  It will not perform Profile Download on those cards
+	 * though, until another +CPIN command.
+	 */
+	if (data->have_sim && sim)
+		ofono_stk_create(modem, 0, "calypsomodem", data->dlcs[AUX_DLC]);
+
+	g_at_chat_send(data->dlcs[AUX_DLC], "AT+CFUN=1",
+			none_prefix, NULL, NULL, NULL);
+
 	if (data->have_sim && sim)
 		ofono_sim_inserted_notify(sim, TRUE);
 }
Signature · 1 line
1.7.1.86.g0e460.dirty
#2 lore raw

Support of call hold for a single call

All,

We know that Ofono provide the function HoldAndAnswer() which put an active call on hold and answer the incoming call. Is Ofono support call hold feature for a single outgoing call ?
How does it work ?

Regards,

Alain Kouassu
Celad for Intel

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#3 lore raw

RE: Support of call hold for a single call

Quoted 9 lines

-----Original Message-----
From: ofono-bounces(a)ofono.org [mailto:ofono-bounces(a)ofono.org] On Behalf Of Kouassu, AlainX
Sent: 2010年8月6日 16:25
To: ofono(a)ofono.org
Subject: Support of call hold for a single call

Quoted 6 lines

All,

We know that Ofono provide the function HoldAndAnswer() which put an active call on hold and answer the incoming call.
Is Ofono support call hold feature for a single outgoing call ?
How does it work ?

Swapcalls() will hold/retrieve a signal call

Quoted 22 lines

Regards,

Alain Kouassu
Celad for Intel

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#4 lore raw

Ofono limit the max length for a phone number to 20 digit

In reply to Kouassu

Is there a particular motivation for Ofono to limit the max length of a phone number to 20 digit ?
The limit to 20 digit for a phone number could be a potential risk since according to IUT-T a phone number can have up to 15 digit + international prefix. Some country have international dialing prefix greater than 6 digit.

Regards,
Alain Kouassu
Celad for Intel

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#5 lore raw

Re: Ofono limit the max length for a phone number to 20 digit

Hi Alain,

Quoted 2 lines · AlainX

Is there a particular motivation for Ofono to limit the max length of a phone number to 20 digit ?
The limit to 20 digit for a phone number could be a potential risk since according to IUT-T a phone number can have up to 15 digit + international prefix. Some country have international dialing prefix greater than 6 digit.

Limit of 20 was chosen for several reasons:

- That is the maximum incoming party number size (24.008 Calling Party BCD Number)
- Most networks do not support Calling Party BCD number more than 20 characters (24.008 Calling Party BCD Number)
- SMS Address is limited to 20 characters (23.040)
- oFono does not support EFadn extensions, and thus numbers are limited to 20 characters (31.102)

There might be exceptions to this where more than 20 characters are required. Patches are of course always welcome.

Regards,
-Denis

#7 lore raw
In reply to Andrzej Zaborowski

Hi Andrew,

Quoted 2 lines · Andrzej Zaborowski

From: root <root@neo.(none)>

I had to manually edit this commit to fix the authorship information...
Please be careful with this one.

Regards,
-Denis

#6 lore raw

RE: Ofono limit the max length for a phone number to 20 digit

In reply to Denis Kenzior

Hi Denis,

Thanks for your answer.
Actually 24.008 states that the Called party BCD can have a maximum length of 43 octets, we are far from the 20 characters supported by Ofono. The Calling party BCD is not mandatory when making a mobile originated voice call (24.008).

I hope this could help.

Regards,

Alain

-----Original Message-----
From: Denis Kenzior [mailto:denkenz(a)gmail.com]
Sent: Friday, August 06, 2010 5:46 PM
To: ofono(a)ofono.org
Cc: Kouassu, AlainX
Subject: Re: Ofono limit the max length for a phone number to 20 digit

Hi Alain,

Quoted 2 lines · AlainX

Is there a particular motivation for Ofono to limit the max length of a phone number to 20 digit ?
The limit to 20 digit for a phone number could be a potential risk since according to IUT-T a phone number can have up to 15 digit + international prefix. Some country have international dialing prefix greater than 6 digit.

Limit of 20 was chosen for several reasons:

- That is the maximum incoming party number size (24.008 Calling Party BCD Number)
- Most networks do not support Calling Party BCD number more than 20 characters (24.008 Calling Party BCD Number)
- SMS Address is limited to 20 characters (23.040)
- oFono does not support EFadn extensions, and thus numbers are limited to 20 characters (31.102)

There might be exceptions to this where more than 20 characters are required. Patches are of course always welcome.

Regards,
-Denis
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.