Huawei E176 - not online
Hi,
I can't get my Huawei E176 USB Stick into the online state.
Maybe commit cc6a43c477c1310643279139ba6808799a8c637e removed to much code? (rssi_notify)
OFONO_AT_DEBUG=1 ofonod -n -d '*' 2>atlog
./enable_modem
./list-modem output:
[ /huawei0 ]
Features = sim
Powered = 1
Interfaces = org.ofono.SimManager
Online = 0
Model = E176
Manufacturer = huawei
Serial = ***************
Revision = 11.104.14.01.55
[ org.ofono.SimManager ]
Present = 0
atlog output:
ofonod[15261]: oFono version 0.25
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,2,0,25\r\n
ofonod[15261]: Pcui:> ATE0\r
ofonod[15261]: Pcui:< \r\n^RSSI:99\r\n\r\n^SRVST:0\r\n\r\n^MODE:0,0\r\n\r\n^RSSI:10\r\n\r\n^SRVST:1\r\n\r\n^MODE:5,4\r\n\r\n^BOOT:********,0,0,0,25\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CFUN=1\r
ofonod[15261]: Pcui:< \r\nOK\r\n
ofonod[15261]: Pcui:> AT^SYSINFO\r
ofonod[15261]: Pcui:< \r\n^SYSINFO:1,0,1,5,0,,4\r\n\r\nOK\r\n
ofonod[15261]: Pcui:> AT+CGMI\r
ofonod[15261]: Pcui:< \r\nhuawei\r\n\r\nOK\r\n
ofonod[15261]: Pcui:> AT+CGMM\r
ofonod[15261]: Pcui:< \r\nE176\r\n\r\nOK\r\n
ofonod[15261]: Pcui:> AT+CGMR\r
ofonod[15261]: Pcui:< \r\n11.104.14.01.55\r\n\r\nOK\r\n
ofonod[15261]: Pcui:> AT+CGSN\r
ofonod[15261]: Pcui:< \r\n***************\r\n\r\nOK\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
Florian Steinel
Hi Florian,
Quoted 2 lines
I can't get my Huawei E176 USB Stick into the online state.
You won't be able to get into Online state unless your SIM is present. <snip>
Quoted 1 line
atlog output:
oFono huawei driver determines sim presense in two ways: ^SIMST:1 unsolicited notification, and by querying the ^SYSINFO.
Quoted 9 lines
ofonod[15261]: oFono version 0.25
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,2,0,25\r\n
ofonod[15261]: Pcui:> ATE0\r
ofonod[15261]: Pcui:< \r\n^RSSI:99\r\n\r\n^SRVST:0\r\n\r\n^MODE:0,0\r\n\r\n^RSSI:10\r\n\r\n^SRVST:1\r\n\r\n^MODE:5,4\r\n\r\n^BOOT:********,0,0,0,25\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CFUN=1\r
ofonod[15261]: Pcui:< \r\nOK\r\n
ofonod[15261]: Pcui:> AT^SYSINFO\r
ofonod[15261]: Pcui:< \r\n^SYSINFO:1,0,1,5,0,,4\r\n\r\nOK\r\n
According to Huawei docs, the 5th field is the SIM presence state. The above is telling us it isn't present.
Quoted 8 lines
ofonod[15261]: Pcui:> AT+CGMI\r
ofonod[15261]: Pcui:< \r\nhuawei\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGMM\r
ofonod[15261]: Pcui:< \r\nE176\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGMR\r
ofonod[15261]: Pcui:< \r\n11.104.14.01.55\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGSN\r
ofonod[15261]: Pcui:< \r\n***************\r\n\r\nOK\r\n
Quoted 9 lines
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
It sounds like your firmware never sends us the SIMST unsolicited notification. Can you check whether after sending CFUN=1, few seconds later ^SYSINFO goes to 1? See plugins/huawei.c for more details.
Regards,
-Denis
Hi Denis,
Quoted 20 lines
Quoted 2 lines
I can't get my Huawei E176 USB Stick into the online state.
You won't be able to get into Online state unless your SIM is present. <snip>
Quoted 1 line
atlog output:
oFono huawei driver determines sim presense in two ways: ^SIMST:1 unsolicited notification, and by querying the ^SYSINFO.
Quoted 9 lines
ofonod[15261]: oFono version 0.25
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,2,0,25\r\n
ofonod[15261]: Pcui:> ATE0\r
ofonod[15261]: Pcui:< \r\n^RSSI:99\r\n\r\n^SRVST:0\r\n\r\n^MODE:0,0\r\n\r\n^RSSI:10\r\n\r\n^SRVST:1\r\n\r\n^MODE:5,4\r\n\r\n^BOOT:********,0,0,0,25\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CFUN=1\r
ofonod[15261]: Pcui:< \r\nOK\r\n
ofonod[15261]: Pcui:> AT^SYSINFO\r
ofonod[15261]: Pcui:< \r\n^SYSINFO:1,0,1,5,0,,4\r\n\r\nOK\r\n
Quoted 2 lines
According to Huawei docs, the 5th field is the SIM presence state. The above is telling us it isn't present.
http://www.bez-kabli.pl/printview.php?t=20735&start=0
(Since i do not speak polish, I've used translate.google.com) The 5 field (the state of the SIM card)
0 - invalid SIM card or PIN code blocked
1 - normal SIM card
2 - SIM card not valid in CS mode
3 - SIM card not valid in PS mode
4 - SIM card not valid in PS or CS mode
255 - SIM not present
The SIM is present, but still PIN code blocked.
The notify_sim_state function needs be changed.
pseudo code:
If sim_state == 0 then
if 'AT+CPIN?' returns 'CPIN: SIM PIN' then
sim_state = 'present but sim locked'
else
sim_state = 'invalid SIM'
endif
else if sim_state == 255 then
sim_state = 'SIM not present'
endif
<snip>
Quoted 5 lines
It sounds like your firmware never sends us the SIMST unsolicited notification. Can you check whether after sending CFUN=1, few seconds later ^SYSINFO goes to 1? See
plugins/huawei.cfor more details.
I don't see any ^SIMST:1 or ^SYSINFO message.
Regards,
Florian
PATCH 1/1 (RFC) Huawei: Modify ^SYSINFO logic
--- plugins/huawei.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 105 insertions(+), 9 deletions(-)
plugins/huawei.c +105 -9
@@ -57,12 +57,22 @@static const char *none_prefix[] = {NULL };static const char *sysinfo_prefix[] = {"^SYSINFO:" ,NULL }; +static const char *cpin_prefix[] = {"CPIN:" ,NULL }; + +enum my_sim_state { +SIM_STATE_INVALID_OR_PIN_BLOCKED =0 , +SIM_STATE_NORMAL_SIM_CARD =1 , +SIM_STATE_SIM_NOT_VALID_IN_CS_MODE =2 , +SIM_STATE_SIM_NOT_VALID_IN_PS_MODE =3 , +SIM_STATE_SIM_NOT_VALID_IN_CS_OR_PS_MODE =4 , +SIM_STATE_SIM_NOT_PRESENT =255 +};struct huawei_data {GAtChat *modem;GAtChat *pcui;struct ofono_sim *sim; -gint sim_state; +enum my_sim_state sim_state;struct ofono_gprs *gprs;struct ofono_gprs_context *gc; };
@@ -101,19 +111,105 @@ static void huawei_debug(const char *str, void *user_data)ofono_info ("%s%s" , prefix, str); } -static void notify_sim_state (struct ofono_modem *modem,gint sim_state) +static void notify_sim_state (struct ofono_modem *modem,enum my_sim_state sim_state) {struct huawei_data *data =ofono_modem_get_data (modem); -if (data->sim_state ==0 && sim_state ==1 ) { -ofono_sim_inserted_notify (data->sim, TRUE); - data->sim_state = sim_state; - }else if (data->sim_state ==1 && sim_state ==0 ) { -ofono_sim_inserted_notify (data->sim, FALSE); - data->sim_state = sim_state; +switch (sim_state) { +case SIM_STATE_INVALID_OR_PIN_BLOCKED : +if (data->sim_state != sim_state) { +/* TODO copy code from mbm.c function init_simpin_check and ff */ +ofono_sim_inserted_notify (data->sim, TRUE); + } + +break ; + +case SIM_STATE_NORMAL_SIM_CARD : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, TRUE); + } + +break ; + +case SIM_STATE_SIM_NOT_VALID_IN_CS_MODE : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ; + +case SIM_STATE_SIM_NOT_VALID_IN_PS_MODE : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ; + +case SIM_STATE_SIM_NOT_VALID_IN_CS_OR_PS_MODE : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ; + +case SIM_STATE_SIM_NOT_PRESENT : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ; + +default : +break ; } + data->sim_state = sim_state; } +/* +* +* SYSINFO = a,b,c,d,e,f +* +* a : +* 0 - no network access +* 1 - limited access to the network +* 2 - normal access to the network +* 3 - limited access to networks in your area +* 4 - Power saving mode +* b: +* 0 - no access to the call date +* 1 - only the circuit switching +* 2 - only the packet switching +* 3 - PS + SC +* 4 - had not registered +* c: +* 0 - registered in your home network +* 1 - registered in roaming +* d: +* 0 - no network access +* 1 - APMs +* 2 - CDMA +* 3 - GSM / GPRS +* 4 - HDR +* 5 - WCDMA +* 6 - GPS +* e: +* 0 - invalid SIM card or PIN code blocked +* 1 - normal SIM card +* 2 - SIM card not valid in CS mode +* 3 - SIM card not valid in PS mode +* 4 - SIM card not valid in PS or CS mode +* f: +* 0 - no network access +* 1 - GSM mode +* 2 - GPRS +* 3 - Mode EDGE +* 4 - WCDMA mode +* 5 - HSDPA mode +* 6 - HSUPA mode +* 7 - mode HSPA +* 8 - HSPA + mode +* +*/ static void sysinfo_cb (gboolean ok,GAtResult *result,gpointer user_data) {struct ofono_modem *modem = user_data;
@@ -277,7 +373,7 @@ static int huawei_enable(struct ofono_modem *modem)return -EIO ; } - data->sim_state =0 ; + data->sim_state =SIM_STATE_SIM_NOT_PRESENT ;g_at_chat_send (data->pcui,"ATE0" , none_prefix,NULL ,NULL ,NULL );
Signature · 1 line
1.7.1
Re: [PATCH 1/1] (RFC) Huawei: Modify ^SYSINFO logic
Hi Florian,
Quoted 11 lines
plugins/huawei.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 105 insertions(+), 9 deletions(-)plugins/huawei.c +0
-0@@ -57,12 +57,22 @@static const char *none_prefix[] = {NULL };static const char *sysinfo_prefix[] = {"^SYSINFO:" ,NULL };
plugins/huawei.c line 69
Quoted 10 lines
plugins/huawei.c +10
-0+static const char *cpin_prefix[] = {"CPIN:" ,NULL }; + +enum my_sim_state { +SIM_STATE_INVALID_OR_PIN_BLOCKED =0 , +SIM_STATE_NORMAL_SIM_CARD =1 , +SIM_STATE_SIM_NOT_VALID_IN_CS_MODE =2 , +SIM_STATE_SIM_NOT_VALID_IN_PS_MODE =3 , +SIM_STATE_SIM_NOT_VALID_IN_CS_OR_PS_MODE =4 , +SIM_STATE_SIM_NOT_PRESENT =255 +};
Using my_ prefix is not really an option ;)
Anyhow, I think using #define here is as good. So just use define and leave it as gint sim_state in the source.
Quoted 22 lines
plugins/huawei.c +2
-6struct huawei_data {GAtChat *modem;GAtChat *pcui;struct ofono_sim *sim; -gint sim_state; +enum my_sim_state sim_state;struct ofono_gprs *gprs;struct ofono_gprs_context *gc; };@@ -101,19 +111,105 @@ static void huawei_debug(const char *str, void *user_data)ofono_info ("%s%s" , prefix, str); } -static void notify_sim_state (struct ofono_modem *modem,gint sim_state) +static void notify_sim_state (struct ofono_modem *modem,enum my_sim_state sim_state) {struct huawei_data *data =ofono_modem_get_data (modem); -if (data->sim_state ==0 && sim_state ==1 ) { -ofono_sim_inserted_notify (data->sim, TRUE); - data->sim_state = sim_state; - }else if (data->sim_state ==1 && sim_state ==0 ) {
plugins/huawei.c static void huawei_debug(const char *str, void *user_data) · line 125
Quoted 10 lines
plugins/huawei.c +8
-2-ofono_sim_inserted_notify (data->sim, FALSE); - data->sim_state = sim_state; +switch (sim_state) { +case SIM_STATE_INVALID_OR_PIN_BLOCKED : +if (data->sim_state != sim_state) { +/* TODO copy code from mbm.c function init_simpin_check and ff */ +ofono_sim_inserted_notify (data->sim, TRUE); + } + +break ;
No empty line needed before break here.
plugins/huawei.c static void huawei_debug(const char *str, void *user_data) · line 130
Quoted 4 lines
plugins/huawei.c +4
-0+case SIM_STATE_NORMAL_SIM_CARD : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, TRUE); + }
For single line statement we don't do { }
Quoted 20 lines
plugins/huawei.c +20
-0+ +break ; + +case SIM_STATE_SIM_NOT_VALID_IN_CS_MODE : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ; + +case SIM_STATE_SIM_NOT_VALID_IN_PS_MODE : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ; + +case SIM_STATE_SIM_NOT_VALID_IN_CS_OR_PS_MODE : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE);
plugins/huawei.c static void huawei_debug(const char *str, void *user_data) · line 160
Quoted 10 lines
plugins/huawei.c +10
-0+ } + +break ; + +case SIM_STATE_SIM_NOT_PRESENT : +if (data->sim_state != sim_state) { +ofono_sim_inserted_notify (data->sim, FALSE); + } + +break ;
Just combining these into one might be better:
case SIM_STATE_SIM_NOT_VALID_IN_CS_OR_PS_MODE:
case SIM_STATE_SIM_NOT_PRESENT:
and so on.
plugins/huawei.c static void huawei_debug(const char *str, void *user_data) · line 165
Quoted 5 lines
plugins/huawei.c +4
-0+ +default : +break ; } + data->sim_state = sim_state;
And here I would prefer an extra empty line after the switch block.
Quoted 37 lines
plugins/huawei.c +35
-0} +/* +* +* SYSINFO = a,b,c,d,e,f +* +* a : +* 0 - no network access +* 1 - limited access to the network +* 2 - normal access to the network +* 3 - limited access to networks in your area +* 4 - Power saving mode +* b: +* 0 - no access to the call date +* 1 - only the circuit switching +* 2 - only the packet switching +* 3 - PS + SC +* 4 - had not registered +* c: +* 0 - registered in your home network +* 1 - registered in roaming +* d: +* 0 - no network access +* 1 - APMs +* 2 - CDMA +* 3 - GSM / GPRS +* 4 - HDR +* 5 - WCDMA +* 6 - GPS +* e: +* 0 - invalid SIM card or PIN code blocked +* 1 - normal SIM card +* 2 - SIM card not valid in CS mode +* 3 - SIM card not valid in PS mode +* 4 - SIM card not valid in PS or CS mode +* f: +* 0 - no network access
plugins/huawei.c static void huawei_debug(const char *str, void *user_data) · line 212
Quoted 10 lines
plugins/huawei.c +10
-0+* 1 - GSM mode +* 2 - GPRS +* 3 - Mode EDGE +* 4 - WCDMA mode +* 5 - HSDPA mode +* 6 - HSUPA mode +* 7 - mode HSPA +* 8 - HSPA + mode +* +*/
Do we wanna keep this inside the source or better create doc/huawei.txt which explains all the Huawei specific vendor codes we know about. I think the latter might be more useful.
plugins/huawei.c static int huawei_enable(struct ofono_modem *modem) · line 379
Quoted 12 lines
plugins/huawei.c +1
-1static void sysinfo_cb (gboolean ok,GAtResult *result,gpointer user_data) {struct ofono_modem *modem = user_data;@@ -277,7 +373,7 @@ static int huawei_enable(struct ofono_modem *modem)return -EIO ; } - data->sim_state =0 ; + data->sim_state =SIM_STATE_SIM_NOT_PRESENT ;g_at_chat_send (data->pcui,"ATE0" , none_prefix,NULL ,NULL ,NULL );
Regards
Marcel
Hi Florian,
<snip>
Quoted 14 lines
The SIM is present, but still PIN code blocked.
Thenotify_sim_statefunction needs be changed.pseudo code:
Ifsim_state== 0 then
if 'AT+CPIN?' returns 'CPIN: SIM PIN' then
sim_state= 'present but sim locked'
else
sim_state= 'invalid SIM'
endif
else ifsim_state== 255 then
sim_state= 'SIM not present'
endif
I keep forgetting about modems behaving differently with PIN code set. You are of course correct. The mbm driver does something very similar for PIN / SIM inserted logic. Might be a good template to follow.
Regards,
-Denis
Quoted 2 lines · Florian Steinel
Hi,
Hi Florian,
Quoted 2 lines
I can't get my Huawei E176 USB Stick into the online state.
I'm travelling and I don't have access to my Huawei E1552 right now. But I'll test it as soon as I get back home.
Quoted 3 lines
Maybe commit
cc6a43c477c1310643279139ba6808799a8c637eremoved to much code? (rssi_notify)
Commit 6a480bb861f9a83c46368a2ee50a23f062edc207 added the same code to atmodem/network-registration.c, I doubt that's the cause here.
Quoted 16 lines
ofonod[15261]: oFono version 0.25
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,2,0,25\r\n ofonod[15261]: Pcui:> ATE0\r ofonod[15261]: Pcui:< \r\n^RSSI:99\r\n\r\n^SRVST:0\r\n\r\n^MODE:0,0\r\n\r\n^RSSI:10\r\n\r\n^SRVST:1\r\n\r\n^MODE:5,4\r\n\r\n^BOOT:********,0,0,0,25\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CFUN=1\r ofonod[15261]: Pcui:< \r\nOK\r\n ofonod[15261]: Pcui:> AT^SYSINFO\r ofonod[15261]: Pcui:< \r\n^SYSINFO:1,0,1,5,0,,4\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGMI\r ofonod[15261]: Pcui:< \r\nhuawei\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGMM\r ofonod[15261]: Pcui:< \r\nE176\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGMR\r ofonod[15261]: Pcui:< \r\n11.104.14.01.55\r\n\r\nOK\r\n ofonod[15261]: Pcui:> AT+CGSN\r ofonod[15261]: Pcui:< \r\n***************\r\n\r\nOK\r\n
Quoted 9 lines
ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n ofonod[15261]: Pcui:< \r\n^BOOT:********,0,0,0,25\r\n
SIM doesn't seem to be ready. I would expect to see ^SIMST messages in the log to notify when the SIM is ready, but for some reason there aren't any.
Do you know what was the last commit when your modem worked? You could also try to bisect it, it's really easy with git.
Kalle
Quoted 7 lines · Kalle Valo
On 07/18/2010 01:04 PM, Florian Steinel wrote:
SIM doesn't seem to be ready. I would expect to see ^SIMST messages in the log to notify when the SIM is ready, but for some reason there aren't any.Do you know what was the last commit when your modem worked? You could also try to bisect it, it's really easy with git.
Sorry, I now noticed that this was already discussed. Please forget my comment :)
Kalle