ublox: network-registration: Check ureg for tech also for L2 modems

It seems like the CREG reporting from the L2 modems are quite
buggy. An example for a L210 where CREG reports UTRAN while
COPS and UREG reports LTE. A manual poll also indicates LTE.

I also found that the technology mapping was incorrect,
probably confused with enum packet_bearer.

A commented log showing where CREG is not trustable:

UREG indicates LTE
21:59:29 : < \r\n+UREG: 7\r\n
21:59:29 : < \r\n+CIEV: 9,2\r\n
21:59:29 : < \r\n+CGEV: NW MODIFY 1,0,0\r\n
21:59:31 : < \r\n+CIEV: 2,2\r\n
21:59:39 : < \r\n+CIEV: 2,3\r\n
21:59:44 : < \r\n+CIEV: 2,2\r\n
22:01:38 : < \r\n+CIEV: 2,3\r\n
22:01:43 : < \r\n+CIEV: 2,2\r\n

A CREG indicating UTRAN with HSDPA and HSUPA
22:29:39 : < \r\n+CREG: 5,"0000","00000000",6\r\n
22:29:39 : > AT\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS=3,2\r
22:29:39 : < \r\n+CIEV: 9,2\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS?\r

An immediate cops indicating LTE
22:29:39 : < \r\n+COPS: 0,2,"24007",7\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CSQ\r
22:29:39 : < \r\n+CIEV: 2,4\r\n
22:29:39 : < \r\n+CSQ: 26,4\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CGATT=1\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS=3,0\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS?\r

Another cops also indicates LTE
22:29:39 : < \r\n+COPS: 0,0,"Tele2",7\r\n <- 7: LTE
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CGREG?\r

CGREG indicates unknown -> normal on LTE
22:29:39 : < \r\n+CGREG: 2,4\r\n
22:29:39 : < \r\nOK\r\n
22:29:44 : < \r\n+CIEV: 9,2\r\n
22:29:46 : < \r\n+CIEV: 2,2\r\n
22:56:23 : < \r\n+CIEV: 2,3\r\n
22:56:28 : < \r\n+CIEV: 2,2\r\n
22:59:40 : < \r\n+CIEV: 2,4\r\n

Manual poll shows we are running LTE
at+creg?
+CREG: 2,5,"2AFC","01DB0206",7

OK
This commit is contained in:
Richard Röjfors 2019-09-24 18:11:12 +02:00 committed by Denis Kenzior
parent 4e4c209c0b
commit 388248d6a1
1 changed files with 28 additions and 6 deletions

View File

@ -58,6 +58,7 @@ struct tech_query {
int status;
int lac;
int ci;
int tech;
struct ofono_netreg *netreg;
};
@ -235,20 +236,40 @@ static void ublox_query_tech_cb(gboolean ok, GAtResult *result,
return;
switch (state) {
case 0:
/* Not registered for PS, then we have to trust CREG... */
tech = tq->tech;
break;
case 1:
tech = ACCESS_TECHNOLOGY_GSM;
break;
case 2:
tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
break;
case 3:
tech = ACCESS_TECHNOLOGY_UTRAN;
break;
case 4:
tech = 5;
tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA;
break;
case 5:
tech = 4;
tech = ACCESS_TECHNOLOGY_UTRAN_HSUPA;
break;
case 6:
tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA;
break;
case 7:
tech = ACCESS_TECHNOLOGY_EUTRAN;
break;
case 8:
tech = 1;
tech = ACCESS_TECHNOLOGY_GSM;
break;
case 9:
tech = 2;
tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
break;
default:
tech = state;
/* Not registered for PS or something unknown, trust CREG... */
tech = tq->tech;
}
error:
@ -270,12 +291,13 @@ static void creg_notify(GAtResult *result, gpointer user_data)
if (status != 1 && status != 5)
goto notify;
if (ublox_is_toby_l4(nd->model)) {
if (ublox_is_toby_l4(nd->model) || ublox_is_toby_l2(nd->model)) {
tq = g_new0(struct tech_query, 1);
tq->status = status;
tq->lac = lac;
tq->ci = ci;
tq->tech = tech;
tq->netreg = netreg;
if (g_at_chat_send(nd->at_data.chat, "AT+UREG?", ureg_prefix,