* [RFC v0 0/3] use GEREG for when in LTE networks
@ 2016-03-12 14:51 Dragos Tatulea
2016-03-12 14:51 ` [PATCH 1/3] gprs.h: add api for reading access technology Dragos Tatulea
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dragos Tatulea @ 2016-03-12 14:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 772 bytes --]
Hi,
Here the first alternative to reading registration status on a LTE network
correctly. This is an aswer to the review request for the U-Blox Toby L2
support patches.
The other proposed alternative was to change how the gprs core handles
the attach status in LTE. But that needs a more thorough thinking. Until
then this would be a decent interim solution.
Thanks,
Dragos
Dragos Tatulea (3):
gprs.h: add api for reading access technology
gprs: add api for reading access technology
atmodem: gprs: do CEREG instead of CGREG for LTE
drivers/atmodem/gprs.c | 42 ++++++++++++++++++++++++++++++++++++++++--
include/gprs.h | 2 ++
src/gprs.c | 5 +++++
3 files changed, 47 insertions(+), 2 deletions(-)
--
2.5.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/3] gprs.h: add api for reading access technology 2016-03-12 14:51 [RFC v0 0/3] use GEREG for when in LTE networks Dragos Tatulea @ 2016-03-12 14:51 ` Dragos Tatulea 2016-03-12 14:51 ` [PATCH 2/3] gprs: " Dragos Tatulea 2016-03-12 14:51 ` [PATCH 3/3] atmodem: gprs: do CEREG instead of CGREG for LTE Dragos Tatulea 2 siblings, 0 replies; 4+ messages in thread From: Dragos Tatulea @ 2016-03-12 14:51 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 606 bytes --] --- include/gprs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/gprs.h b/include/gprs.h index 8d2a260..ab2c5f8 100644 --- a/include/gprs.h +++ b/include/gprs.h @@ -75,6 +75,8 @@ void ofono_gprs_remove(struct ofono_gprs *gprs); void ofono_gprs_set_data(struct ofono_gprs *gprs, void *data); void *ofono_gprs_get_data(struct ofono_gprs *gprs); +int ofono_gprs_get_technology(struct ofono_gprs *gprs); + void ofono_gprs_set_cid_range(struct ofono_gprs *gprs, unsigned int min, unsigned int max); void ofono_gprs_add_context(struct ofono_gprs *gprs, -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] gprs: add api for reading access technology 2016-03-12 14:51 [RFC v0 0/3] use GEREG for when in LTE networks Dragos Tatulea 2016-03-12 14:51 ` [PATCH 1/3] gprs.h: add api for reading access technology Dragos Tatulea @ 2016-03-12 14:51 ` Dragos Tatulea 2016-03-12 14:51 ` [PATCH 3/3] atmodem: gprs: do CEREG instead of CGREG for LTE Dragos Tatulea 2 siblings, 0 replies; 4+ messages in thread From: Dragos Tatulea @ 2016-03-12 14:51 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 449 bytes --] Result forwarded from network.c. --- src/gprs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gprs.c b/src/gprs.c index 9192e68..d9c0fe5 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -3248,3 +3248,8 @@ void *ofono_gprs_get_data(struct ofono_gprs *gprs) { return gprs->driver_data; } + +int ofono_gprs_get_technology(struct ofono_gprs *gprs) +{ + return ofono_netreg_get_technology(gprs->netreg); +} -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] atmodem: gprs: do CEREG instead of CGREG for LTE 2016-03-12 14:51 [RFC v0 0/3] use GEREG for when in LTE networks Dragos Tatulea 2016-03-12 14:51 ` [PATCH 1/3] gprs.h: add api for reading access technology Dragos Tatulea 2016-03-12 14:51 ` [PATCH 2/3] gprs: " Dragos Tatulea @ 2016-03-12 14:51 ` Dragos Tatulea 2 siblings, 0 replies; 4+ messages in thread From: Dragos Tatulea @ 2016-03-12 14:51 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2374 bytes --] If we do CGREG in LTE we might get a bad registration status. That is it will return unknown/out of coverage because it's registered on on LTE. --- drivers/atmodem/gprs.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c index 0165253..ba0c802 100644 --- a/drivers/atmodem/gprs.c +++ b/drivers/atmodem/gprs.c @@ -39,10 +39,12 @@ #include "gatchat.h" #include "gatresult.h" +#include "common.h" #include "atmodem.h" #include "vendor.h" static const char *cgreg_prefix[] = { "+CGREG:", NULL }; +static const char *cereg_prefix[] = { "+CEREG:", NULL }; static const char *cgdcont_prefix[] = { "+CGDCONT:", NULL }; static const char *none_prefix[] = { NULL }; @@ -104,12 +106,38 @@ static void at_cgreg_cb(gboolean ok, GAtResult *result, gpointer user_data) cb(&error, status, cbd->data); } +static void at_cereg_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct cb_data *cbd = user_data; + ofono_gprs_status_cb_t cb = cbd->cb; + struct ofono_error error; + int status; + struct gprs_data *gd = cbd->user; + + decode_at_error(&error, g_at_result_final_response(result)); + + if (!ok) { + cb(&error, -1, cbd->data); + return; + } + + if (at_util_parse_reg(result, "+CEREG:", NULL, &status, + NULL, NULL, NULL, gd->vendor) == FALSE) { + CALLBACK_WITH_FAILURE(cb, -1, cbd->data); + return; + } + + cb(&error, status, cbd->data); + +} + static void at_gprs_registration_status(struct ofono_gprs *gprs, ofono_gprs_status_cb_t cb, void *data) { struct gprs_data *gd = ofono_gprs_get_data(gprs); struct cb_data *cbd = cb_data_new(cb, data); + int ret; cbd->user = gd; @@ -132,8 +160,18 @@ static void at_gprs_registration_status(struct ofono_gprs *gprs, break; } - if (g_at_chat_send(gd->chat, "AT+CGREG?", cgreg_prefix, - at_cgreg_cb, cbd, g_free) > 0) + switch (ofono_gprs_get_technology(gprs)) { + case ACCESS_TECHNOLOGY_EUTRAN: + ret = g_at_chat_send(gd->chat, "AT+CEREG?", cereg_prefix, + at_cereg_cb, cbd, g_free); + break; + default: + ret = g_at_chat_send(gd->chat, "AT+CGREG?", cgreg_prefix, + at_cgreg_cb, cbd, g_free); + break; + } + + if (ret > 0) return; g_free(cbd); -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-12 14:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-12 14:51 [RFC v0 0/3] use GEREG for when in LTE networks Dragos Tatulea 2016-03-12 14:51 ` [PATCH 1/3] gprs.h: add api for reading access technology Dragos Tatulea 2016-03-12 14:51 ` [PATCH 2/3] gprs: " Dragos Tatulea 2016-03-12 14:51 ` [PATCH 3/3] atmodem: gprs: do CEREG instead of CGREG for LTE Dragos Tatulea
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox