Specify vendor ID for Huawei modem while creating GPRS context
PATCH 1/1 Specify vendor ID for Huawei modem while creating GPRS context
--- plugins/huawei.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
plugins/huawei.c +1 -1
@@ -454,7 +454,7 @@ static void huawei_disconnect(gpointer user_data) data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {ofono_info ("Reopened GPRS context channel" ); - data->gc = ofono_gprs_context_create(modem, 0, "atmodem", + data->gc = ofono_gprs_context_create(modem, OFONO_VENDOR_HUAWEI,
"atmodem",
data->modem);
if (data->gprs && data->gc)
@@ -631,12 +631,12 @@ static void huawei_post_online(struct ofono_modem *modem)
if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
- data->gprs = ofono_gprs_create(modem, 0, "atmodem", data->pcui);
+ data->gprs = ofono_gprs_create(modem, OFONO_VENDOR_HUAWEI, "atmodem",data->pcui);
if (data->ndis == TRUE)
- data->gc = ofono_gprs_context_create(modem, 0,
+ data->gc = ofono_gprs_context_create(modem, OFONO_VENDOR_HUAWEI,
"huaweimodem", data->pcui);
else
- data->gc = ofono_gprs_context_create(modem, 0,
+ data->gc = ofono_gprs_context_create(modem, OFONO_VENDOR_HUAWEI,
"atmodem", data->modem);
if (data->gprs && data->gc)
Signature · 1 line
1.7.2.2
Hi Tonny,
Quoted 9 lines · Tonny Tzeng
--- plugins/huawei.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)plugins/huawei.c +0
-0
plugins/huawei.c static void huawei_disconnect(gpointer user_data) · line 459
Quoted 7 lines
plugins/huawei.c +1
-1@@ -454,7 +454,7 @@ static void huawei_disconnect(gpointer user_data) data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {ofono_info ("Reopened GPRS context channel" ); - data->gc =ofono_gprs_context_create (modem,0 ,"atmodem" , + data->gc =ofono_gprs_context_create (modem,OFONO_VENDOR_HUAWEI ,"atmodem" , data->modem);
There's no need to pass the vendor flag here. The atmodem gprs_context driver does not have any vendor handling code inside it.
Quoted 4 lines
plugins/huawei.c +0
-0if (data->gprs && data->gc)@@ -631,12 +631,12 @@ static void huawei_post_online(struct ofono_modem *modem)
plugins/huawei.c static void huawei_post_online(struct ofono_modem · line 639
Quoted 10 lines
plugins/huawei.c +2
-2if (data->sim_state ==HUAWEI_SIM_STATE_VALID || data->sim_state ==HUAWEI_SIM_STATE_INVALID_CS ) { - data->gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->pcui); + data->gprs =ofono_gprs_create (modem,OFONO_VENDOR_HUAWEI ,"atmodem" , data->pcui);if (data->ndis == TRUE) - data->gc =ofono_gprs_context_create (modem,0 , + data->gc =ofono_gprs_context_create (modem,OFONO_VENDOR_HUAWEI ,"huaweimodem" , data->pcui);
Same comment as above
plugins/huawei.c static void huawei_post_online(struct ofono_modem · line 642
Quoted 4 lines
plugins/huawei.c +1
-1else - data->gc =ofono_gprs_context_create (modem,0 , + data->gc =ofono_gprs_context_create (modem,OFONO_VENDOR_HUAWEI ,"atmodem" , data->modem);
ditto.
Quoted 2 lines
if (
data->gprs&&data->gc)
Regards,
-Denis
Hi Denis,
Quoted 12 lines · Denis Kenzior
plugins/huawei.c static void huawei_disconnect(gpointer user_data) · line 457
Quoted 11 lines
plugins/huawei.c +1
-1@@ -454,7 +454,7 @@ static void huawei_disconnect(gpointer user_data) data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {ofono_info ("Reopened GPRS context channel" ); - data->gc = ofono_gprs_context_create(modem, 0, "atmodem", + data->gc = ofono_gprs_context_create(modem,
OFONO_VENDOR_HUAWEI,
Quoted 7 lines
plugins/huawei.c static void huawei_disconnect(gpointer user_data) · line 459
Quoted 2 lines
plugins/huawei.c +0
-0"atmodem",
data->modem);There's no need to pass the vendor flag here. The atmodem
gprs_contextdriver does not have any vendor handling code inside it.
But it seems to me the gprs context will be pass to modem plugins, so we need to set the vendor code for Huawei modems, because it sends unquoted strings.
For example, please correct me if wrong, when the network registration status changed, ofono will invoke modem's set_attached() to handle the modem attach/detach. Then, in gprs_attach_callback() in src/gprs.c, it will invokes modem's attached_status() to check the modem state, which has vendor dependent code in it. Most importantly, after ofono sending AT+CGREG? to query the solicited response, the at_cgreg_cb() requires the correct vendor
ID so that at_util_parse_reg() knows whether the lac and ci are quoted
strings or not? Did I misunderstand? Thanks.
Best Regards,
Tonny
Hi Tonny,
Quoted 3 lines
But it seems to me the gprs context will be pass to modem plugins, so we need to set the vendor code for Huawei modems, because it sends unquoted strings.
No, you don't. You are confusing gprs atom and the gprs-context atom. Grep for VENDOR in drivers/atmodem/gprs-context.c if you do not believe me. There is no vendor specific code in the atmodem gprs-context driver.
Quoted 9 lines
For example, please correct me if wrong, when the network registration status changed, ofono will invoke modem's
set_attached()to handle the modem attach/detach. Then, ingprs_attach_callback()insrc/gprs.c, it will invokes modem'sattached_status()to check the modem state, which has vendor dependent code in it. Most importantly, after ofono sending AT+CGREG? to query the solicited response, theat_cgreg_cb()requires the correct vendor ID so thatat_util_parse_reg()knows whether the lac and ci are quoted strings or not? Did I misunderstand? Thanks.
As I mentioned before, this is needed for the gprs atom driver which handles the CGREG parsing. Not for gprs-context driver.
Regards,
-Denis
Hi Denis,
No, you don't. You are confusing gprs atom and the gprs-context atom.
Quoted 3 lines
Grep for VENDOR in
drivers/atmodem/gprs-context.cif you do not believe me. There is no vendor specific code in the atmodem gprs-context driver.
Yes, my bad, I misunderstood the program flow...
So, is huawei_post_online() in plugins/huawei.c the right place to pass the vendor ID while calling to ofono_gprs_create()?
Together with the patch to fix parsing of unquoted CGREG, now I can get the CGREG status correctly from the Huawei modem. :) Thanks!
Best Regards,
Tonny
Hi Tonny,
Quoted 11 lines · Tonny Tzeng
Hi Denis,
No, you don't. You are confusing gprs atom and the gprs-context atom. Grep for VENDOR in
drivers/atmodem/gprs-context.cif you do not believe me. There is no vendor specific code in the atmodem gprs-context driver.Yes, my bad, I misunderstood the program flow...
So, ishuawei_post_online()inplugins/huawei.cthe right place to pass the vendor ID while calling toofono_gprs_create()?
Yes, I fixed this now as well.
Quoted 3 lines
Together with the patch to fix parsing of unquoted CGREG, now I can get the CGREG status correctly from the Huawei modem. :) Thanks!
My earlier patch has been applied, so please test the upstream version and report back any problems.
Regards,
-Denis
Hi Tonny,
Quoted 3 lines · Tonny Tzeng
--- plugins/huawei.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
Your commit log is empty. The most important part of the commit log is to answer the question "Why?" and this patch really would need that answer.
What's the bug are you fixing? Logs etc would help here. Also what is the exact model of the Huawei modem with you see the bug?
Signature · 1 line
Kalle Valo
Hi Tonny,
Quoted 8 lines
plugins/huawei.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)plugins/huawei.c +0
-0
plugins/huawei.c static void huawei_disconnect(gpointer user_data) · line 459
Quoted 7 lines
plugins/huawei.c +1
-1@@ -454,7 +454,7 @@ static void huawei_disconnect(gpointer user_data) data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {ofono_info ("Reopened GPRS context channel" ); - data->gc =ofono_gprs_context_create (modem,0 ,"atmodem" , + data->gc =ofono_gprs_context_create (modem,OFONO_VENDOR_HUAWEI ,"atmodem" , data->modem);
this not doing anything. Behavior is still the same.
plugins/huawei.c static void huawei_post_online(struct ofono_modem · line 639
Quoted 13 lines
plugins/huawei.c +2
-2if (data->gprs && data->gc)@@ -631,12 +631,12 @@ static void huawei_post_online(struct ofono_modem *modem)if (data->sim_state ==HUAWEI_SIM_STATE_VALID || data->sim_state ==HUAWEI_SIM_STATE_INVALID_CS ) { - data->gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->pcui); + data->gprs =ofono_gprs_create (modem,OFONO_VENDOR_HUAWEI ,"atmodem" , data->pcui);if (data->ndis == TRUE) - data->gc =ofono_gprs_context_create (modem,0 , + data->gc =ofono_gprs_context_create (modem,OFONO_VENDOR_HUAWEI ,"huaweimodem" , data->pcui);
This one makes no sense. It is Huawei specific already.
plugins/huawei.c static void huawei_post_online(struct ofono_modem · line 642
Quoted 5 lines
plugins/huawei.c +1
-1else - data->gc =ofono_gprs_context_create (modem,0 , + data->gc =ofono_gprs_context_create (modem,OFONO_VENDOR_HUAWEI ,"atmodem" , data->modem);
This is also not doing anything either actually.
Regards
Marcel