* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-04 16:47 ` Marcel Holtmann
@ 2012-12-02 19:40 ` Denis Kenzior
0 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2012-12-02 19:40 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3331 bytes --]
Hi Marcel,
On 12/04/2012 10:47 AM, Marcel Holtmann wrote:
> Hi Jonas,
>
>> In offline state where CFUN=4, the Telit HE910 also powers down the SIM
>> card so AT commands that query the SIM will fail. These failures result
>> in ofono not getting to POST_SIM state where it will export the GPRS
>> feature.
>>
>> This patch changes the Telit driver so it will not go immediately
>> to CFUN=4 after enable, but to wait for the post_sim state to be
>> reached before doing so. In addition, the HE910 might send QSS: 0
>> unsolicited reports while in CFUN=4 state... this patch makes it so
>> that these are ignored until the modem is onlined and the actual
>> SIM state can be queried again.
>> ---
>>
>> This patch has been tested with a Telit HE910 and it works fine there. It
>> would be great if someone with other Telit modems could check if
>> this works with those models or whether we need to wrap some of this with
>> checks for model type, firmware version, etc...
>>
>> Thanks,
>> Jonas
>>
>>
>> plugins/telit.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++----
>> 1 file changed, 60 insertions(+), 4 deletions(-)
>>
>> diff --git a/plugins/telit.c b/plugins/telit.c
>> index fe2ccd6..a0f7deb 100644
>> --- a/plugins/telit.c
>> +++ b/plugins/telit.c
>> @@ -62,6 +62,7 @@
>>
>> static const char *none_prefix[] = { NULL };
>> static const char *rsen_prefix[]= { "#RSEN:", NULL };
>> +static const char *qss_prefix[] = { "#QSS:", NULL };
>>
>> struct telit_data {
>> GAtChat *chat; /* AT chat */
>> @@ -219,7 +220,7 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
>>
>> switch (status) {
>> case 0: /* SIM not inserted */
>> - if (data->have_sim == TRUE) {
>> + if (data->have_sim == TRUE&& ofono_modem_get_online(modem)) {
>> ofono_sim_inserted_notify(data->sim, FALSE);
>> data->have_sim = FALSE;
>> data->sms_phonebook_added = FALSE;
>> @@ -233,6 +234,14 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
>> }
>> break;
>> case 3: /* SIM inserted, SMS and phonebook ready */
>> + /* It's possible that we arrive at QSS=3 state without
>> + * ever seeing QSS=2, so we need to make sure that we've
>> + * also done the QSS=2 work, as well
>> + */
>> + if (data->have_sim == FALSE) {
>> + ofono_sim_inserted_notify(data->sim, TRUE);
>> + data->have_sim = TRUE;
>> + }
>> if (data->sms_phonebook_added == FALSE) {
>> ofono_phonebook_create(modem, 0, "atmodem", data->chat);
>> ofono_sms_create(modem, 0, "atmodem", data->chat);
>
> I don't remember how this made it upstream. The SMS and Phonebook atom
> drivers should have vendor quirks to not register until the SIM is fully
> ready. We do that for IFX for Phonebook and I was going to add another
> one for IFX and SMS handling. Telit should do the same.
>
> I am surprised adding atoms outside of pre_sim, post_sim and post_online
> works as it should. Since that clearly has never been fully tested. And
> is not our recommended way of adding atoms.
>
There's no reason why it wouldn't. Those call-backs are strong hints,
however one can add atoms at any time. For example, emulators do this
at semi-random times.
Regards,
-Denis
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
@ 2012-12-04 15:46 Jonas Bonn
2012-12-04 16:47 ` Marcel Holtmann
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Jonas Bonn @ 2012-12-04 15:46 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5502 bytes --]
In offline state where CFUN=4, the Telit HE910 also powers down the SIM
card so AT commands that query the SIM will fail. These failures result
in ofono not getting to POST_SIM state where it will export the GPRS
feature.
This patch changes the Telit driver so it will not go immediately
to CFUN=4 after enable, but to wait for the post_sim state to be
reached before doing so. In addition, the HE910 might send QSS: 0
unsolicited reports while in CFUN=4 state... this patch makes it so
that these are ignored until the modem is onlined and the actual
SIM state can be queried again.
---
This patch has been tested with a Telit HE910 and it works fine there. It
would be great if someone with other Telit modems could check if
this works with those models or whether we need to wrap some of this with
checks for model type, firmware version, etc...
Thanks,
Jonas
plugins/telit.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 60 insertions(+), 4 deletions(-)
diff --git a/plugins/telit.c b/plugins/telit.c
index fe2ccd6..a0f7deb 100644
--- a/plugins/telit.c
+++ b/plugins/telit.c
@@ -62,6 +62,7 @@
static const char *none_prefix[] = { NULL };
static const char *rsen_prefix[]= { "#RSEN:", NULL };
+static const char *qss_prefix[] = { "#QSS:", NULL };
struct telit_data {
GAtChat *chat; /* AT chat */
@@ -219,7 +220,7 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
switch (status) {
case 0: /* SIM not inserted */
- if (data->have_sim == TRUE) {
+ if (data->have_sim == TRUE && ofono_modem_get_online(modem)) {
ofono_sim_inserted_notify(data->sim, FALSE);
data->have_sim = FALSE;
data->sms_phonebook_added = FALSE;
@@ -233,6 +234,14 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
}
break;
case 3: /* SIM inserted, SMS and phonebook ready */
+ /* It's possible that we arrive at QSS=3 state without
+ * ever seeing QSS=2, so we need to make sure that we've
+ * also done the QSS=2 work, as well
+ */
+ if (data->have_sim == FALSE) {
+ ofono_sim_inserted_notify(data->sim, TRUE);
+ data->have_sim = TRUE;
+ }
if (data->sms_phonebook_added == FALSE) {
ofono_phonebook_create(modem, 0, "atmodem", data->chat);
ofono_sms_create(modem, 0, "atmodem", data->chat);
@@ -245,6 +254,28 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
}
}
+/*
+ * telit_qss_cb gets invoked once when querying the QSS status immediately
+ * after enabling the modem.
+ */
+static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ int mode;
+ int status;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ DBG("%p", modem);
+ if (!g_at_result_iter_next(&iter, "#QSS:"))
+ return;
+ g_at_result_iter_next_number(&iter, &mode);
+ g_at_result_iter_next_number(&iter, &status);
+
+ switch_sim_state_status(modem, status);
+}
+
static void telit_qss_notify(GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -304,6 +335,12 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Enable sim state notification */
g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
+
+ /* Query current sim state so that we don't need to wait a long
+ * time for a notification in case SIM state is already 'ready'
+ */
+ g_at_chat_send(data->chat, "AT#QSS?", qss_prefix,
+ telit_qss_cb, modem, NULL);
}
static int telit_enable(struct ofono_modem *modem)
@@ -334,12 +371,19 @@ static int telit_enable(struct ofono_modem *modem)
/*
* Disable sim state notification so that we sure get a notification
- * when we enable it again later and don't have to query it.
+ * when we enable it again later and don't have to query it. For
+ * the HE910, this doesn't seem to work... querying appears to be
+ * necessary as there will be no notification unless there is an
+ * actual _change_ of state.
*/
g_at_chat_send(data->chat, "AT#QSS=0", none_prefix, NULL, NULL, NULL);
- /* Set phone functionality */
- g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix,
+ /* Set phone functionality.
+ * When enabling the modem, we need to have the modem powered
+ * up until we've been able to get to post_sim state... for this
+ * reason, we start off with CFUN=4
+ */
+ g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
cfun_enable_cb, modem, NULL);
return -EINPROGRESS;
@@ -565,6 +609,10 @@ static void telit_post_sim(struct ofono_modem *modem)
if (gprs && gc)
ofono_gprs_add_context(gprs, gc);
+
+ if (!ofono_modem_get_online(modem))
+ g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix,
+ NULL, NULL, NULL);
}
static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -588,6 +636,14 @@ static void telit_set_online(struct ofono_modem *modem, ofono_bool_t online,
g_at_chat_send(data->chat, command, none_prefix, set_online_cb,
cbd, g_free);
+
+ if (online) {
+ /* Query current sim state in case it changed while we
+ * were offline and ignoring the QSS: 0 reports.
+ */
+ g_at_chat_send(data->chat, "AT#QSS?", qss_prefix,
+ telit_qss_cb, modem, NULL);
+ }
}
static void telit_post_online(struct ofono_modem *modem)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-04 15:46 [PATCH 1/1] telit: stay 'online' until POST_SIM state reached Jonas Bonn
@ 2012-12-04 16:47 ` Marcel Holtmann
2012-12-02 19:40 ` Denis Kenzior
2012-12-05 5:55 ` Denis Kenzior
2012-12-18 17:28 ` Ming Li Wu
2 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2012-12-04 16:47 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3015 bytes --]
Hi Jonas,
> In offline state where CFUN=4, the Telit HE910 also powers down the SIM
> card so AT commands that query the SIM will fail. These failures result
> in ofono not getting to POST_SIM state where it will export the GPRS
> feature.
>
> This patch changes the Telit driver so it will not go immediately
> to CFUN=4 after enable, but to wait for the post_sim state to be
> reached before doing so. In addition, the HE910 might send QSS: 0
> unsolicited reports while in CFUN=4 state... this patch makes it so
> that these are ignored until the modem is onlined and the actual
> SIM state can be queried again.
> ---
>
> This patch has been tested with a Telit HE910 and it works fine there. It
> would be great if someone with other Telit modems could check if
> this works with those models or whether we need to wrap some of this with
> checks for model type, firmware version, etc...
>
> Thanks,
> Jonas
>
>
> plugins/telit.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 60 insertions(+), 4 deletions(-)
>
> diff --git a/plugins/telit.c b/plugins/telit.c
> index fe2ccd6..a0f7deb 100644
> --- a/plugins/telit.c
> +++ b/plugins/telit.c
> @@ -62,6 +62,7 @@
>
> static const char *none_prefix[] = { NULL };
> static const char *rsen_prefix[]= { "#RSEN:", NULL };
> +static const char *qss_prefix[] = { "#QSS:", NULL };
>
> struct telit_data {
> GAtChat *chat; /* AT chat */
> @@ -219,7 +220,7 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
>
> switch (status) {
> case 0: /* SIM not inserted */
> - if (data->have_sim == TRUE) {
> + if (data->have_sim == TRUE && ofono_modem_get_online(modem)) {
> ofono_sim_inserted_notify(data->sim, FALSE);
> data->have_sim = FALSE;
> data->sms_phonebook_added = FALSE;
> @@ -233,6 +234,14 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
> }
> break;
> case 3: /* SIM inserted, SMS and phonebook ready */
> + /* It's possible that we arrive at QSS=3 state without
> + * ever seeing QSS=2, so we need to make sure that we've
> + * also done the QSS=2 work, as well
> + */
> + if (data->have_sim == FALSE) {
> + ofono_sim_inserted_notify(data->sim, TRUE);
> + data->have_sim = TRUE;
> + }
> if (data->sms_phonebook_added == FALSE) {
> ofono_phonebook_create(modem, 0, "atmodem", data->chat);
> ofono_sms_create(modem, 0, "atmodem", data->chat);
I don't remember how this made it upstream. The SMS and Phonebook atom
drivers should have vendor quirks to not register until the SIM is fully
ready. We do that for IFX for Phonebook and I was going to add another
one for IFX and SMS handling. Telit should do the same.
I am surprised adding atoms outside of pre_sim, post_sim and post_online
works as it should. Since that clearly has never been fully tested. And
is not our recommended way of adding atoms.
Regards
Marcel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-04 15:46 [PATCH 1/1] telit: stay 'online' until POST_SIM state reached Jonas Bonn
2012-12-04 16:47 ` Marcel Holtmann
@ 2012-12-05 5:55 ` Denis Kenzior
2012-12-07 6:22 ` Jonas Bonn
2012-12-18 17:28 ` Ming Li Wu
2 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2012-12-05 5:55 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]
Hi Jonas,
On 12/04/2012 09:46 AM, Jonas Bonn wrote:
> In offline state where CFUN=4, the Telit HE910 also powers down the SIM
> card so AT commands that query the SIM will fail. These failures result
> in ofono not getting to POST_SIM state where it will export the GPRS
> feature.
Does the HE910 have a proper CFUN mode where it does not turn off the
SIM? You are making some nasty hacks because of it, and the other Telit
devices support this just fine.
>
> This patch changes the Telit driver so it will not go immediately
> to CFUN=4 after enable, but to wait for the post_sim state to be
> reached before doing so. In addition, the HE910 might send QSS: 0
> unsolicited reports while in CFUN=4 state... this patch makes it so
> that these are ignored until the modem is onlined and the actual
> SIM state can be queried again.
Also remember the modem can be 'Online' even without a SIM, or in
pre-SIM state for e.g. emergency calls. So much of the logic might break.
Regards,
-Denis
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-05 5:55 ` Denis Kenzior
@ 2012-12-07 6:22 ` Jonas Bonn
2012-12-07 8:09 ` Jonas Bonn
2012-12-07 13:58 ` Denis Kenzior
0 siblings, 2 replies; 13+ messages in thread
From: Jonas Bonn @ 2012-12-07 6:22 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]
Hi Denis,
On Tue, 2012-12-04 at 23:55 -0600, Denis Kenzior wrote:
> Hi Jonas,
>
> On 12/04/2012 09:46 AM, Jonas Bonn wrote:
> > In offline state where CFUN=4, the Telit HE910 also powers down the SIM
> > card so AT commands that query the SIM will fail. These failures result
> > in ofono not getting to POST_SIM state where it will export the GPRS
> > feature.
>
> Does the HE910 have a proper CFUN mode where it does not turn off the
> SIM? You are making some nasty hacks because of it, and the other Telit
> devices support this just fine.
No, the HE910 supports CFUN modes 0,1,4,5,7 where:
1: online
4: offline (airplane) mode with SIM powered off
0,5,7: online w/ power saving modes; SMS and phone calls are active in
these modes, but AT command handling seems to be turned off
See Telit Modules Software User Guide, 1vv0300784 rev 11, 2012-09-20,
section 3.6 (page 105) for a description of these modes.
>
> >
> > This patch changes the Telit driver so it will not go immediately
> > to CFUN=4 after enable, but to wait for the post_sim state to be
> > reached before doing so. In addition, the HE910 might send QSS: 0
> > unsolicited reports while in CFUN=4 state... this patch makes it so
> > that these are ignored until the modem is onlined and the actual
> > SIM state can be queried again.
>
> Also remember the modem can be 'Online' even without a SIM, or in
> pre-SIM state for e.g. emergency calls. So much of the logic might break.
OK, I need to check what CFUN mode we need in order to be able to make
emergency calls. I think 4 won't work... CFUN=4 is really 'airplane
mode' with antennas off.
My interpretation of modem 'enabled' in ofono is that it's 'airplane
mode'... is this not correct?
/Jonas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-07 6:22 ` Jonas Bonn
@ 2012-12-07 8:09 ` Jonas Bonn
2012-12-07 13:58 ` Denis Kenzior
1 sibling, 0 replies; 13+ messages in thread
From: Jonas Bonn @ 2012-12-07 8:09 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
On Fri, 2012-12-07 at 07:22 +0100, Jonas Bonn wrote:
> Hi Denis,
>
> On Tue, 2012-12-04 at 23:55 -0600, Denis Kenzior wrote:
> > Hi Jonas,
> >
> > On 12/04/2012 09:46 AM, Jonas Bonn wrote:
> > > In offline state where CFUN=4, the Telit HE910 also powers down the SIM
> > > card so AT commands that query the SIM will fail. These failures result
> > > in ofono not getting to POST_SIM state where it will export the GPRS
> > > feature.
>
> >
> > Does the HE910 have a proper CFUN mode where it does not turn off the
> > SIM? You are making some nasty hacks because of it, and the other Telit
> > devices support this just fine.
With the above patch, after the modem is enabled (telit_enable()) we end
up with this from list-modems:
[ /telit_0 ]
Features = sim
Emergency = 0
Powered = 1
Lockdown = 0
Interfaces = org.ofono.VoiceCallManager org.ofono.SimManager
Online = 0
Model = HE910
Revision = 12.00.003
Type = hardware
Serial = 357164040533674
Manufacturer = Telit
[ org.ofono.VoiceCallManager ]
EmergencyNumbers = 08 000 999 110 112 911 118 119
[ org.ofono.SimManager ]
Retries = [pin2 = 3] [puk2 = 10] [pin = 3] [puk = 10]
FixedDialing = 0
SubscriberNumbers =
BarredDialing = 0
CardIdentifier = 89..............
LockedPins =
PinRequired = none
Present = 1
Without the patch we get the following:
[ /telit_0 ]
Features = sim
Emergency = 0
Powered = 1
Lockdown = 0
Interfaces = org.ofono.VoiceCallManager org.ofono.SimManager
Online = 0
Model = HE910
Revision = 12.00.003
Type = hardware
Serial = 357164040533674
Manufacturer = Telit
[ org.ofono.VoiceCallManager ]
EmergencyNumbers = 08 000 999 110 112 911 118 119
[ org.ofono.SimManager ]
Present = 0
In this state, Connman will never try to "online" the modem.
/Jonas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-07 6:22 ` Jonas Bonn
2012-12-07 8:09 ` Jonas Bonn
@ 2012-12-07 13:58 ` Denis Kenzior
2012-12-10 10:52 ` Christopher Vogl
2012-12-10 12:20 ` Christopher Vogl
1 sibling, 2 replies; 13+ messages in thread
From: Denis Kenzior @ 2012-12-07 13:58 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2744 bytes --]
Hi Jonas,
On 12/07/2012 12:22 AM, Jonas Bonn wrote:
> Hi Denis,
>
> On Tue, 2012-12-04 at 23:55 -0600, Denis Kenzior wrote:
>> Hi Jonas,
>>
>> On 12/04/2012 09:46 AM, Jonas Bonn wrote:
>>> In offline state where CFUN=4, the Telit HE910 also powers down the SIM
>>> card so AT commands that query the SIM will fail. These failures result
>>> in ofono not getting to POST_SIM state where it will export the GPRS
>>> feature.
>
>>
>> Does the HE910 have a proper CFUN mode where it does not turn off the
>> SIM? You are making some nasty hacks because of it, and the other Telit
>> devices support this just fine.
>
> No, the HE910 supports CFUN modes 0,1,4,5,7 where:
> 1: online
> 4: offline (airplane) mode with SIM powered off
> 0,5,7: online w/ power saving modes; SMS and phone calls are active in
> these modes, but AT command handling seems to be turned off
>
> See Telit Modules Software User Guide, 1vv0300784 rev 11, 2012-09-20,
> section 3.6 (page 105) for a description of these modes.
>
I read the description of CFUN in that document and got lost rather
quickly. The bottom line is that oFono does not use any serial
signaling, so all of these DTR and RTS conditions do not apply. If the
Telit modems do not support radio off with SIM on, then you need to
structure the driver differently, most likely removing the 'online'
method implementation would do what you want, and use only
enable/disable. In theory that should work putting the modem online as
soon as the sim is in the ready state.
Better yet, ask Telit to fix their firmware and document what the <rst>
parameter to CFUN actually means.
>>
>>>
>>> This patch changes the Telit driver so it will not go immediately
>>> to CFUN=4 after enable, but to wait for the post_sim state to be
>>> reached before doing so. In addition, the HE910 might send QSS: 0
>>> unsolicited reports while in CFUN=4 state... this patch makes it so
>>> that these are ignored until the modem is onlined and the actual
>>> SIM state can be queried again.
>>
>> Also remember the modem can be 'Online' even without a SIM, or in
>> pre-SIM state for e.g. emergency calls. So much of the logic might break.
>
> OK, I need to check what CFUN mode we need in order to be able to make
> emergency calls. I think 4 won't work... CFUN=4 is really 'airplane
> mode' with antennas off.
>
> My interpretation of modem 'enabled' in ofono is that it's 'airplane
> mode'... is this not correct?
>
It follows the 'Powered' property meaning. E.g. 'is this thing on?'
Most regular modem devices enter airplane mode when the driver enabled()
function is called. However, that is not the case everywhere.
Regards,
-Denis
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-07 13:58 ` Denis Kenzior
@ 2012-12-10 10:52 ` Christopher Vogl
2012-12-10 16:49 ` Denis Kenzior
2012-12-10 12:20 ` Christopher Vogl
1 sibling, 1 reply; 13+ messages in thread
From: Christopher Vogl @ 2012-12-10 10:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2779 bytes --]
Hi Jonas & Denis,
On 07/12/12 14:58, Denis Kenzior wrote:
> Hi Jonas,
>
> On 12/07/2012 12:22 AM, Jonas Bonn wrote:
>> Hi Denis,
>>
>> On Tue, 2012-12-04 at 23:55 -0600, Denis Kenzior wrote:
>>> Hi Jonas,
>>>
>>> On 12/04/2012 09:46 AM, Jonas Bonn wrote:
>>>> In offline state where CFUN=4, the Telit HE910 also powers down the
>>>> SIM
>>>> card so AT commands that query the SIM will fail. These failures
>>>> result
>>>> in ofono not getting to POST_SIM state where it will export the GPRS
>>>> feature.
I suppose the failing of AT+CMER results in the missing of the GPRS atom.
AT+CMER fails because of the SIM being busy and in consequence the
network registration atom is removed - see Ming Li Wu's problem (Telit
HE910: CMER command problem).
I also tried the HE910 and had the same problem. In case a PIN is
required, the following solves the problem:
In /drivers/atmodem/sim.c, at_qss_notify()
case 2: /* PIN unlocked */
has to be changed to
case 3: /* SIM INSERTED and READY */
After the PIN was entered, we wait until the modem states that the SIM
is ready, i.e. #QSS: 3.
I haven't found a proper way to do this in case there is no PIN required.
We should only get to "post sim state" if we received #QSS: 3
>>
>>>
>>> Does the HE910 have a proper CFUN mode where it does not turn off the
>>> SIM? You are making some nasty hacks because of it, and the other
>>> Telit
>>> devices support this just fine.
>>
>> No, the HE910 supports CFUN modes 0,1,4,5,7 where:
>> 1: online
>> 4: offline (airplane) mode with SIM powered off
>> 0,5,7: online w/ power saving modes; SMS and phone calls are active in
>> these modes, but AT command handling seems to be turned off
>>
>> See Telit Modules Software User Guide, 1vv0300784 rev 11, 2012-09-20,
>> section 3.6 (page 105) for a description of these modes.
>>
>
> I read the description of CFUN in that document and got lost rather
> quickly. The bottom line is that oFono does not use any serial
> signaling, so all of these DTR and RTS conditions do not apply. If
> the Telit modems do not support radio off with SIM on, then you need
> to structure the driver differently, most likely removing the 'online'
> method implementation would do what you want, and use only
> enable/disable. In theory that should work putting the modem online
> as soon as the sim is in the ready state.
>
> Better yet, ask Telit to fix their firmware and document what the
> <rst> parameter to CFUN actually means.
Is it really unusual for a modem to deactivate the SIM in flight mode? I
had a look at some mobile phones and they seem to deactivate the SIM in
flight mode.
Regards,
Christopher
--
Scanned by MailScanner.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-07 13:58 ` Denis Kenzior
2012-12-10 10:52 ` Christopher Vogl
@ 2012-12-10 12:20 ` Christopher Vogl
1 sibling, 0 replies; 13+ messages in thread
From: Christopher Vogl @ 2012-12-10 12:20 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
Hi Denis,
>
> I read the description of CFUN in that document and got lost rather
> quickly. The bottom line is that oFono does not use any serial
> signaling, so all of these DTR and RTS conditions do not apply. If
> the Telit modems do not support radio off with SIM on, then you need
> to structure the driver differently, most likely removing the 'online'
> method implementation would do what you want, and use only
> enable/disable. In theory that should work putting the modem online
> as soon as the sim is in the ready state.
OFONO_SIM_STATE_READY is set in sim.c, sim_set_ready() when the IMSI was
obtained.
What do you think about letting modems (plugins), which have a SIM state
notification, set that state on their own?
Regards,
Christopher
--
Scanned by MailScanner.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-10 10:52 ` Christopher Vogl
@ 2012-12-10 16:49 ` Denis Kenzior
2012-12-10 17:11 ` Christopher Vogl
0 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2012-12-10 16:49 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]
Hi Christopher,
> I also tried the HE910 and had the same problem. In case a PIN is
> required, the following solves the problem:
>
> In /drivers/atmodem/sim.c, at_qss_notify()
> case 2: /* PIN unlocked */
> has to be changed to
> case 3: /* SIM INSERTED and READY */
>
>
> After the PIN was entered, we wait until the modem states that the SIM
> is ready, i.e. #QSS: 3.
>
>
> I haven't found a proper way to do this in case there is no PIN required.
> We should only get to "post sim state" if we received #QSS: 3
>
The current work around is to signal sim_inserted only when you know it
is ready. This is less than ideal since oFono can read non-PIN
protected files from the SIM as soon as the SIM is inserted (e.g. ICCID,
EFpl, etc). However, the modem behavior is quite strange in this area.
>
> Is it really unusual for a modem to deactivate the SIM in flight mode? I
> had a look at some mobile phones and they seem to deactivate the SIM in
> flight mode.
>
I've not seen one that turns off the SIM. After all, it would be pretty
inconvenient not to read SMS messages or access contacts, or mess with
MSISDN, or any other setting that is on the SIM.
Regards,
-Denis
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-10 16:49 ` Denis Kenzior
@ 2012-12-10 17:11 ` Christopher Vogl
2012-12-10 18:24 ` Denis Kenzior
0 siblings, 1 reply; 13+ messages in thread
From: Christopher Vogl @ 2012-12-10 17:11 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]
Hi Denis,
On 10/12/12 17:49, Denis Kenzior wrote:
> Hi Christopher,
>
>> I also tried the HE910 and had the same problem. In case a PIN is
>> required, the following solves the problem:
>>
>> In /drivers/atmodem/sim.c, at_qss_notify()
>> case 2: /* PIN unlocked */
>> has to be changed to
>> case 3: /* SIM INSERTED and READY */
>>
>>
>> After the PIN was entered, we wait until the modem states that the SIM
>> is ready, i.e. #QSS: 3.
>>
>>
>> I haven't found a proper way to do this in case there is no PIN
>> required.
>> We should only get to "post sim state" if we received #QSS: 3
>>
>
> The current work around is to signal sim_inserted only when you know
> it is ready.
But then we have the problem that we cannot enter a PIN code if there is
one.
We will be waiting for '#QSS: 3' (SIM ready), but this will only follow
after '#QSS: 2' (SIM unlocked).
> This is less than ideal since oFono can read non-PIN protected files
> from the SIM as soon as the SIM is inserted (e.g. ICCID, EFpl, etc).
> However, the modem behavior is quite strange in this area.
>
>>
>> Is it really unusual for a modem to deactivate the SIM in flight mode? I
>> had a look at some mobile phones and they seem to deactivate the SIM in
>> flight mode.
>>
>
> I've not seen one that turns off the SIM. After all, it would be
> pretty inconvenient not to read SMS messages or access contacts, or
> mess with MSISDN, or any other setting that is on the SIM.
My Samsung Galaxy Note seems to deactivate the SIM in flight mode - at
least the SIM contacts disappear, I have not tried the other things yet
With the HTC One X you have to enter the PIN when you exit the flight mode.
Regards,
Christopher
--
Scanned by MailScanner.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-10 17:11 ` Christopher Vogl
@ 2012-12-10 18:24 ` Denis Kenzior
0 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2012-12-10 18:24 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2306 bytes --]
Hi Christopher,
On 12/10/2012 11:11 AM, Christopher Vogl wrote:
> Hi Denis,
>
> On 10/12/12 17:49, Denis Kenzior wrote:
>> Hi Christopher,
>>
>>> I also tried the HE910 and had the same problem. In case a PIN is
>>> required, the following solves the problem:
>>>
>>> In /drivers/atmodem/sim.c, at_qss_notify()
>>> case 2: /* PIN unlocked */
>>> has to be changed to
>>> case 3: /* SIM INSERTED and READY */
>>>
>>>
>>> After the PIN was entered, we wait until the modem states that the SIM
>>> is ready, i.e. #QSS: 3.
>>>
>>>
>>> I haven't found a proper way to do this in case there is no PIN
>>> required.
>>> We should only get to "post sim state" if we received #QSS: 3
>>>
>>
>> The current work around is to signal sim_inserted only when you know
>> it is ready.
> But then we have the problem that we cannot enter a PIN code if there is
> one.
> We will be waiting for '#QSS: 3' (SIM ready), but this will only follow
> after '#QSS: 2' (SIM unlocked).
I'm still lost why we need to wait until QSS:3. However, the modem
driver can always check CPIN itself prior to calling inserted_notify.
>
>> This is less than ideal since oFono can read non-PIN protected files
>> from the SIM as soon as the SIM is inserted (e.g. ICCID, EFpl, etc).
>> However, the modem behavior is quite strange in this area.
>>
>>>
>>> Is it really unusual for a modem to deactivate the SIM in flight mode? I
>>> had a look at some mobile phones and they seem to deactivate the SIM in
>>> flight mode.
>>>
>>
>> I've not seen one that turns off the SIM. After all, it would be
>> pretty inconvenient not to read SMS messages or access contacts, or
>> mess with MSISDN, or any other setting that is on the SIM.
>
> My Samsung Galaxy Note seems to deactivate the SIM in flight mode - at
> least the SIM contacts disappear, I have not tried the other things yet
> With the HTC One X you have to enter the PIN when you exit the flight mode.
>
That seems really stupid/inconvenient. Particularly the PIN entry part.
If the modem does not support a mode where the RX/TX circuits are off
but the SIM card is powered, then the likely approach is to remove the
set_online method completely and make sure everything still behaves as
expected.
Regards,
-Denis
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/1] telit: stay 'online' until POST_SIM state reached
2012-12-04 15:46 [PATCH 1/1] telit: stay 'online' until POST_SIM state reached Jonas Bonn
2012-12-04 16:47 ` Marcel Holtmann
2012-12-05 5:55 ` Denis Kenzior
@ 2012-12-18 17:28 ` Ming Li Wu
2 siblings, 0 replies; 13+ messages in thread
From: Ming Li Wu @ 2012-12-18 17:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5280 bytes --]
Hi Christopher,
>
> plugins/telit.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 60 insertions(+), 4 deletions(-)
>
> diff --git a/plugins/telit.c b/plugins/telit.c
> index fe2ccd6..a0f7deb 100644
> --- a/plugins/telit.c
> +++ b/plugins/telit.c
> @@ -62,6 +62,7 @@
>
> static const char *none_prefix[] = { NULL };
> static const char *rsen_prefix[]= { "#RSEN:", NULL };
> +static const char *qss_prefix[] = { "#QSS:", NULL };
>
> struct telit_data {
> GAtChat *chat; /* AT chat */
> @@ -219,7 +220,7 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
>
> switch (status) {
> case 0: /* SIM not inserted */
> - if (data->have_sim == TRUE) {
> + if (data->have_sim == TRUE && ofono_modem_get_online(modem)) {
> ofono_sim_inserted_notify(data->sim, FALSE);
> data->have_sim = FALSE;
> data->sms_phonebook_added = FALSE;
> @@ -233,6 +234,14 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
> }
> break;
> case 3: /* SIM inserted, SMS and phonebook ready */
> + /* It's possible that we arrive at QSS=3 state without
> + * ever seeing QSS=2, so we need to make sure that we've
> + * also done the QSS=2 work, as well
> + */
> + if (data->have_sim == FALSE) {
> + ofono_sim_inserted_notify(data->sim, TRUE);
> + data->have_sim = TRUE;
> + }
> if (data->sms_phonebook_added == FALSE) {
> ofono_phonebook_create(modem, 0, "atmodem", data->chat);
> ofono_sms_create(modem, 0, "atmodem", data->chat);
> @@ -245,6 +254,28 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
> }
> }
>
> +/*
> + * telit_qss_cb gets invoked once when querying the QSS status immediately
> + * after enabling the modem.
> + */
> +static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> + struct ofono_modem *modem = user_data;
> + int mode;
> + int status;
> + GAtResultIter iter;
> +
> + g_at_result_iter_init(&iter, result);
> +
> + DBG("%p", modem);
> + if (!g_at_result_iter_next(&iter, "#QSS:"))
> + return;
> + g_at_result_iter_next_number(&iter, &mode);
> + g_at_result_iter_next_number(&iter, &status);
> +
> + switch_sim_state_status(modem, status);
> +}
> +
> static void telit_qss_notify(GAtResult *result, gpointer user_data)
> {
> struct ofono_modem *modem = user_data;
> @@ -304,6 +335,12 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
>
> /* Enable sim state notification */
> g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
> +
> + /* Query current sim state so that we don't need to wait a long
> + * time for a notification in case SIM state is already 'ready'
> + */
> + g_at_chat_send(data->chat, "AT#QSS?", qss_prefix,
> + telit_qss_cb, modem, NULL);
> }
>
> static int telit_enable(struct ofono_modem *modem)
> @@ -334,12 +371,19 @@ static int telit_enable(struct ofono_modem *modem)
>
> /*
> * Disable sim state notification so that we sure get a notification
> - * when we enable it again later and don't have to query it.
> + * when we enable it again later and don't have to query it. For
> + * the HE910, this doesn't seem to work... querying appears to be
> + * necessary as there will be no notification unless there is an
> + * actual _change_ of state.
> */
> g_at_chat_send(data->chat, "AT#QSS=0", none_prefix, NULL, NULL, NULL);
>
> - /* Set phone functionality */
> - g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix,
> + /* Set phone functionality.
> + * When enabling the modem, we need to have the modem powered
> + * up until we've been able to get to post_sim state... for this
> + * reason, we start off with CFUN=4
> + */
> + g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
> cfun_enable_cb, modem, NULL);
>
> return -EINPROGRESS;
> @@ -565,6 +609,10 @@ static void telit_post_sim(struct ofono_modem *modem)
>
> if (gprs && gc)
> ofono_gprs_add_context(gprs, gc);
> +
> + if (!ofono_modem_get_online(modem))
> + g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix,
> + NULL, NULL, NULL);
> }
>
> static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
> @@ -588,6 +636,14 @@ static void telit_set_online(struct ofono_modem *modem, ofono_bool_t online,
>
> g_at_chat_send(data->chat, command, none_prefix, set_online_cb,
> cbd, g_free);
> +
> + if (online) {
> + /* Query current sim state in case it changed while we
> + * were offline and ignoring the QSS: 0 reports.
> + */
> + g_at_chat_send(data->chat, "AT#QSS?", qss_prefix,
> + telit_qss_cb, modem, NULL);
> + }
> }
>
> static void telit_post_online(struct ofono_modem *modem)
Although this patch works for me, Is it a reasonable solution, or are
there any better solutions for this problem?
Thanks
Mingli
--
Mingli Wu South Pole AB
Phone: +46 8 56237100 Anderstorpsvägen 16
Mobile: +46 73 7628460 SE - 171 54 Solna
e-mail: mingli(a)southpole.se www.southpole.se
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-12-18 17:28 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-04 15:46 [PATCH 1/1] telit: stay 'online' until POST_SIM state reached Jonas Bonn
2012-12-04 16:47 ` Marcel Holtmann
2012-12-02 19:40 ` Denis Kenzior
2012-12-05 5:55 ` Denis Kenzior
2012-12-07 6:22 ` Jonas Bonn
2012-12-07 8:09 ` Jonas Bonn
2012-12-07 13:58 ` Denis Kenzior
2012-12-10 10:52 ` Christopher Vogl
2012-12-10 16:49 ` Denis Kenzior
2012-12-10 17:11 ` Christopher Vogl
2012-12-10 18:24 ` Denis Kenzior
2012-12-10 12:20 ` Christopher Vogl
2012-12-18 17:28 ` Ming Li Wu
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.