ofono.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X
@ 2020-08-11 11:42 poeschel
  2020-08-11 11:42 ` [PATCH v2 2/3] atmodem: Get strength and tech the quectel way on EC21 poeschel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: poeschel @ 2020-08-11 11:42 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3252 bytes --]

From: Lars Poeschel <poeschel@lemonage.de>

The distinction between OFONO_VENDOR_QUECTEL and
OFONO_VENDOR_QUECTEL_SERIAL does not suffice for EC21/EC25 in some
places, so introduce and use a new vendor:
OFONO_VENDOR_QUECTEL_EC2X
---
 drivers/atmodem/sim.c       | 1 +
 drivers/atmodem/sms.c       | 2 ++
 drivers/atmodem/vendor.h    | 1 +
 drivers/atmodem/voicecall.c | 3 ++-
 plugins/quectel.c           | 2 +-
 5 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index e750a139..6ab91655 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -1213,6 +1213,7 @@ static void at_pin_retries_query(struct ofono_sim *sim,
 			return;
 		break;
 	case OFONO_VENDOR_QUECTEL:
+	case OFONO_VENDOR_QUECTEL_EC2X:
 		if (g_at_chat_send(sd->chat, "AT+QPINC?", qpinc_prefix,
 					at_qpinc_cb, cbd, g_free) > 0)
 			return;
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index d502da72..ed3b1370 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -337,6 +337,7 @@ static inline void at_ack_delivery(struct ofono_sms *sms)
 	if (data->cnma_ack_pdu) {
 		switch (data->vendor) {
 		case OFONO_VENDOR_GEMALTO:
+		case OFONO_VENDOR_QUECTEL_EC2X:
 			snprintf(buf, sizeof(buf), "AT+CNMA=1");
 			break;
 		case OFONO_VENDOR_QUECTEL_SERIAL:
@@ -845,6 +846,7 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
 	case OFONO_VENDOR_ZTE:
 	case OFONO_VENDOR_SIMCOM:
 	case OFONO_VENDOR_QUECTEL:
+	case OFONO_VENDOR_QUECTEL_EC2X:
 		/* MSM devices advertise support for mode 2, but return an
 		 * error if we attempt to actually use it. */
 		mode = "1";
diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h
index d839d1e0..6bac7f89 100644
--- a/drivers/atmodem/vendor.h
+++ b/drivers/atmodem/vendor.h
@@ -44,6 +44,7 @@ enum ofono_vendor {
 	OFONO_VENDOR_WAVECOM_Q2XXX,
 	OFONO_VENDOR_ALCATEL,
 	OFONO_VENDOR_QUECTEL,
+	OFONO_VENDOR_QUECTEL_EC2X,
 	OFONO_VENDOR_QUECTEL_SERIAL,
 	OFONO_VENDOR_UBLOX,
 	OFONO_VENDOR_XMM,
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index e7f24b60..4797227e 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -1114,7 +1114,8 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
 	g_at_chat_send(vd->chat, "AT+CLIP=1", NULL, NULL, NULL, NULL);
 	g_at_chat_send(vd->chat, "AT+CDIP=1", NULL, NULL, NULL, NULL);
 
-	if (vd->vendor != OFONO_VENDOR_QUECTEL)
+	if ((vd->vendor != OFONO_VENDOR_QUECTEL) &&
+		(vd->vendor != OFONO_VENDOR_QUECTEL_EC2X))
 		g_at_chat_send(vd->chat, "AT+CNAP=1", NULL, NULL, NULL, NULL);
 
 	switch (vd->vendor) {
diff --git a/plugins/quectel.c b/plugins/quectel.c
index 203b702e..8ca901f2 100644
--- a/plugins/quectel.c
+++ b/plugins/quectel.c
@@ -1032,7 +1032,7 @@ static void cgmm_cb(int ok, GAtResult *result, void *user_data)
 		data->model = QUECTEL_MC60;
 	} else if (strcmp(model, "EC21") == 0) {
 		DBG("%p model EC21", modem);
-		data->vendor = OFONO_VENDOR_QUECTEL;
+		data->vendor = OFONO_VENDOR_QUECTEL_EC2X;
 		data->model = QUECTEL_EC21;
 	} else {
 		ofono_warn("%p unknown model: '%s'", modem, model);
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] atmodem: Get strength and tech the quectel way on EC21
  2020-08-11 11:42 [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X poeschel
@ 2020-08-11 11:42 ` poeschel
  2020-08-11 11:42 ` [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB poeschel
  2020-08-11 15:51 ` [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X Denis Kenzior
  2 siblings, 0 replies; 7+ messages in thread
From: poeschel @ 2020-08-11 11:42 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3966 bytes --]

From: Lars Poeschel <poeschel@lemonage.de>

I had some trouble getting network strengh and access technology the
standard way on Quectel EC21. It does work - but only kind of. I did not
get URCs when I am sure I should. This way through CIEV, CIND and CMER
is also not documented in Quectel documentation, so I suspect this to be
unsupported.
This is now changed to the "quectelish" way of gettings those values and
this does work more fine-grained and reliable on the Quectel EC21.
---
 drivers/atmodem/network-registration.c | 71 ++++++++++++++++++++++++++
 plugins/quectel.c                      |  2 +-
 2 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index cc702c2c..78b1994c 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -957,6 +957,66 @@ static void tlts_notify(GAtResult *result, gpointer user_data)
 	ofono_netreg_time_notify(netreg, &nd->time);
 }
 
+static void quectel_qind_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_netreg *netreg = user_data;
+	struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+	int rssi, ber, strength;
+	const char *str;
+	GAtResultIter iter;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+QIND:"))
+		return;
+
+	if (!g_at_result_iter_next_string(&iter, &str))
+		return;
+
+	if (g_str_equal("csq", str)) {
+		if (!g_at_result_iter_next_number(&iter, &rssi))
+			return;
+
+		if (!g_at_result_iter_next_number(&iter, &ber))
+			return;
+
+		DBG("rssi %d ber %d", rssi, ber);
+
+		if ((rssi == 99) || (rssi == 199))
+			strength = -1;
+		else if (rssi > 99) {
+			rssi -= 100;
+			strength = (rssi * 100) / 91;
+		} else
+			strength = (rssi * 100) / 31;
+
+		ofono_netreg_strength_notify(netreg, strength);
+		return;
+	}
+
+	if (g_str_equal("act", str)) {
+		nd->tech = -1;
+		if (!g_at_result_iter_next_string(&iter, &str))
+			return;
+
+		DBG("technology %s", str);
+		if (g_str_equal("GSM", str))
+			nd->tech = ACCESS_TECHNOLOGY_GSM;
+		else if (g_str_equal("EGPRS", str))
+			nd->tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
+		else if (g_str_equal("WCDMA", str))
+			nd->tech = ACCESS_TECHNOLOGY_UTRAN;
+		else if (g_str_equal("HSDPA", str))
+			nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA;
+		else if (g_str_equal("HSUPA", str))
+			nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSUPA;
+		else if (g_str_equal("HSDPA&HSUPA", str))
+			nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA;
+		else if (g_str_equal("LTE", str))
+			nd->tech = ACCESS_TECHNOLOGY_EUTRAN;
+	}
+}
+
 static gboolean notify_time(gpointer user_data)
 {
 	struct ofono_netreg *netreg = user_data;
@@ -2047,6 +2107,17 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	case OFONO_VENDOR_SAMSUNG:
 		/* Signal strength reporting via CIND is not supported */
 		break;
+	case OFONO_VENDOR_QUECTEL_EC2X:
+		g_at_chat_register(nd->chat, "+QIND:",
+				quectel_qind_notify, FALSE, netreg, NULL);
+		/* Register for specific signal strength reports */
+		g_at_chat_send(nd->chat, "AT+QINDCFG=\"csq\",1", none_prefix,
+				NULL, NULL, NULL);
+
+		/* Register for network technology updates */
+		g_at_chat_send(nd->chat, "AT+QINDCFG=\"act\",1", none_prefix,
+				NULL, NULL, NULL);
+		break;
 	default:
 		g_at_chat_send(nd->chat, "AT+CIND=?", cind_prefix,
 				cind_support_cb, netreg, NULL);
diff --git a/plugins/quectel.c b/plugins/quectel.c
index 8ca901f2..c3343008 100644
--- a/plugins/quectel.c
+++ b/plugins/quectel.c
@@ -1286,7 +1286,7 @@ static void quectel_post_online(struct ofono_modem *modem)
 
 	DBG("%p", modem);
 
-	ofono_netreg_create(modem, 0, "atmodem", data->aux);
+	ofono_netreg_create(modem, data->vendor, "atmodem", data->aux);
 }
 
 static struct ofono_modem_driver quectel_driver = {
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB
  2020-08-11 11:42 [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X poeschel
  2020-08-11 11:42 ` [PATCH v2 2/3] atmodem: Get strength and tech the quectel way on EC21 poeschel
@ 2020-08-11 11:42 ` poeschel
  2020-08-11 15:55   ` Denis Kenzior
  2020-08-11 15:51 ` [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X Denis Kenzior
  2 siblings, 1 reply; 7+ messages in thread
From: poeschel @ 2020-08-11 11:42 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

From: Lars Poeschel <poeschel@lemonage.de>

The Quectel EC21 modem does not understand the AT+CPSB command, so
aquire the current packet switched bearer from CGREG URC.
---
 drivers/atmodem/gprs.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index b637f733..5583d6fa 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -40,6 +40,7 @@
 #include "gatresult.h"
 
 #include "atmodem.h"
+#include "common.h"
 #include "vendor.h"
 
 #define MAX_CONTEXTS 255
@@ -98,6 +99,29 @@ static void list_contexts_data_unref(gpointer user_data)
 	g_free(ld);
 }
 
+static int act_to_bearer(int act)
+{
+	switch (act) {
+		case 0:
+		case 1:
+			return PACKET_BEARER_GPRS;
+		case 2:
+			return PACKET_BEARER_UMTS;
+		case 3:
+			return PACKET_BEARER_EGPRS;
+		case 4:
+			return PACKET_BEARER_HSDPA;
+		case 5:
+			return PACKET_BEARER_HSUPA;
+		case 6:
+			return PACKET_BEARER_HSUPA_HSDPA;
+		case 7:
+			return PACKET_BEARER_EPS;
+		default:
+			return PACKET_BEARER_NONE;
+	}
+};
+
 static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct cb_data *cbd = user_data;
@@ -342,11 +366,11 @@ static void at_gprs_list_active_contexts(struct ofono_gprs *gprs,
 static void cgreg_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_gprs *gprs = user_data;
-	int status;
+	int status, tech;
 	struct gprs_data *gd = ofono_gprs_get_data(gprs);
 
 	if (at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
-				NULL, NULL, NULL, gd->vendor) == FALSE)
+				NULL, NULL, &tech, gd->vendor) == FALSE)
 		return;
 
 	/*
@@ -372,6 +396,8 @@ static void cgreg_notify(GAtResult *result, gpointer user_data)
 	}
 
 	ofono_gprs_status_notify(gprs, status);
+	if (gd->vendor == OFONO_VENDOR_QUECTEL_EC2X)
+		ofono_gprs_bearer_notify(gprs, act_to_bearer(tech));
 }
 
 static void cgev_notify(GAtResult *result, gpointer user_data)
@@ -624,6 +650,8 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
 		g_at_chat_send(gd->chat, "AT#PSNT=1", none_prefix,
 						NULL, NULL, NULL);
 		break;
+	case OFONO_VENDOR_QUECTEL_EC2X:
+		break;
 	default:
 		g_at_chat_register(gd->chat, "+CPSB:", cpsb_notify,
 						FALSE, gprs, NULL);
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X
  2020-08-11 11:42 [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X poeschel
  2020-08-11 11:42 ` [PATCH v2 2/3] atmodem: Get strength and tech the quectel way on EC21 poeschel
  2020-08-11 11:42 ` [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB poeschel
@ 2020-08-11 15:51 ` Denis Kenzior
  2 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2020-08-11 15:51 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

Hi Lars,

On 8/11/20 6:42 AM, poeschel(a)lemonage.de wrote:
> From: Lars Poeschel <poeschel@lemonage.de>
> 
> The distinction between OFONO_VENDOR_QUECTEL and
> OFONO_VENDOR_QUECTEL_SERIAL does not suffice for EC21/EC25 in some
> places, so introduce and use a new vendor:
> OFONO_VENDOR_QUECTEL_EC2X
> ---
>   drivers/atmodem/sim.c       | 1 +
>   drivers/atmodem/sms.c       | 2 ++
>   drivers/atmodem/vendor.h    | 1 +
>   drivers/atmodem/voicecall.c | 3 ++-
>   plugins/quectel.c           | 2 +-
>   5 files changed, 7 insertions(+), 2 deletions(-)
> 

Patch 1 & 2 applied with minor style cleanups.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB
  2020-08-11 11:42 ` [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB poeschel
@ 2020-08-11 15:55   ` Denis Kenzior
  2020-08-12  9:20     ` Lars Poeschel
  0 siblings, 1 reply; 7+ messages in thread
From: Denis Kenzior @ 2020-08-11 15:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3010 bytes --]

Hi Lars,

On 8/11/20 6:42 AM, poeschel(a)lemonage.de wrote:
> From: Lars Poeschel <poeschel@lemonage.de>
> 
> The Quectel EC21 modem does not understand the AT+CPSB command, so
> aquire the current packet switched bearer from CGREG URC.
> ---
>   drivers/atmodem/gprs.c | 32 ++++++++++++++++++++++++++++++--
>   1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
> index b637f733..5583d6fa 100644
> --- a/drivers/atmodem/gprs.c
> +++ b/drivers/atmodem/gprs.c
> @@ -40,6 +40,7 @@
>   #include "gatresult.h"
>   
>   #include "atmodem.h"
> +#include "common.h"
>   #include "vendor.h"
>   
>   #define MAX_CONTEXTS 255
> @@ -98,6 +99,29 @@ static void list_contexts_data_unref(gpointer user_data)
>   	g_free(ld);
>   }
>   
> +static int act_to_bearer(int act)
> +{
> +	switch (act) {
> +		case 0:
> +		case 1:
> +			return PACKET_BEARER_GPRS;
> +		case 2:
> +			return PACKET_BEARER_UMTS;
> +		case 3:
> +			return PACKET_BEARER_EGPRS;
> +		case 4:
> +			return PACKET_BEARER_HSDPA;
> +		case 5:
> +			return PACKET_BEARER_HSUPA;
> +		case 6:
> +			return PACKET_BEARER_HSUPA_HSDPA;
> +		case 7:
> +			return PACKET_BEARER_EPS;
> +		default:
> +			return PACKET_BEARER_NONE;
> +	}
> +};
> +

oFono driver interface is based on 27.007.  So that means values defined in 
27.007 do not need to be 'converted'.  You can simply feed them in directly if 
they follow 27.007.

To me this looks like a no-op.  Is there a non-obvious reason why this code is 
needed?

>   static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
>   {
>   	struct cb_data *cbd = user_data;
> @@ -342,11 +366,11 @@ static void at_gprs_list_active_contexts(struct ofono_gprs *gprs,
>   static void cgreg_notify(GAtResult *result, gpointer user_data)
>   {
>   	struct ofono_gprs *gprs = user_data;
> -	int status;
> +	int status, tech;
>   	struct gprs_data *gd = ofono_gprs_get_data(gprs);
>   
>   	if (at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
> -				NULL, NULL, NULL, gd->vendor) == FALSE)
> +				NULL, NULL, &tech, gd->vendor) == FALSE)
>   		return;
>   
>   	/*
> @@ -372,6 +396,8 @@ static void cgreg_notify(GAtResult *result, gpointer user_data)
>   	}
>   
>   	ofono_gprs_status_notify(gprs, status);
> +	if (gd->vendor == OFONO_VENDOR_QUECTEL_EC2X)
> +		ofono_gprs_bearer_notify(gprs, act_to_bearer(tech));

To follow up from above, any reason not to omit act_to_bearer() here?

>   }
>   
>   static void cgev_notify(GAtResult *result, gpointer user_data)
> @@ -624,6 +650,8 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
>   		g_at_chat_send(gd->chat, "AT#PSNT=1", none_prefix,
>   						NULL, NULL, NULL);
>   		break;
> +	case OFONO_VENDOR_QUECTEL_EC2X:
> +		break;
>   	default:
>   		g_at_chat_register(gd->chat, "+CPSB:", cpsb_notify,
>   						FALSE, gprs, NULL);
> 

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB
  2020-08-11 15:55   ` Denis Kenzior
@ 2020-08-12  9:20     ` Lars Poeschel
  2020-08-12 14:44       ` Denis Kenzior
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Poeschel @ 2020-08-12  9:20 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 4031 bytes --]

On Tue, Aug 11, 2020 at 10:55:35AM -0500, Denis Kenzior wrote:
> Hi Lars,
> 
> On 8/11/20 6:42 AM, poeschel(a)lemonage.de wrote:
> > From: Lars Poeschel <poeschel@lemonage.de>
> > 
> > The Quectel EC21 modem does not understand the AT+CPSB command, so
> > aquire the current packet switched bearer from CGREG URC.
> > ---
> >   drivers/atmodem/gprs.c | 32 ++++++++++++++++++++++++++++++--
> >   1 file changed, 30 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
> > index b637f733..5583d6fa 100644
> > --- a/drivers/atmodem/gprs.c
> > +++ b/drivers/atmodem/gprs.c
> > @@ -40,6 +40,7 @@
> >   #include "gatresult.h"
> >   #include "atmodem.h"
> > +#include "common.h"
> >   #include "vendor.h"
> >   #define MAX_CONTEXTS 255
> > @@ -98,6 +99,29 @@ static void list_contexts_data_unref(gpointer user_data)
> >   	g_free(ld);
> >   }
> > +static int act_to_bearer(int act)
> > +{
> > +	switch (act) {
> > +		case 0:
> > +		case 1:
> > +			return PACKET_BEARER_GPRS;
> > +		case 2:
> > +			return PACKET_BEARER_UMTS;
> > +		case 3:
> > +			return PACKET_BEARER_EGPRS;
> > +		case 4:
> > +			return PACKET_BEARER_HSDPA;
> > +		case 5:
> > +			return PACKET_BEARER_HSUPA;
> > +		case 6:
> > +			return PACKET_BEARER_HSUPA_HSDPA;
> > +		case 7:
> > +			return PACKET_BEARER_EPS;
> > +		default:
> > +			return PACKET_BEARER_NONE;
> > +	}
> > +};
> > +
> 
> oFono driver interface is based on 27.007.  So that means values defined in
> 27.007 do not need to be 'converted'.  You can simply feed them in directly
> if they follow 27.007.

Well, yes. I saw this. But unfortunately at this point what is expected
are the 27.007 values from AT+CPSB defined in 7.29 (that EC21 quectel
modem does not support) and I get the values from AT+CGREG defined in 7.2.

> To me this looks like a no-op.  Is there a non-obvious reason why this code
> is needed?

These are the values defined in 7.2 (CGREG) called access technology
0 - GSM
2 - UTRAN
3 - GSM W/EGPRS
4 - UTRAN W/HSDPA
5 - UTRAN W/HSUPA
6 - UTRAN W/HSDPA and HSUPA
7 - E-UTRAN

and these are the values defined in 7.29 (CPSB / ofono) called current
bearer:

1 - GPRS
2 - EGPRS
3 - Non-HSUPA in uplink and non-HSDPA in downlink.
4 - HSUPA in uplink and non-HSDPA in downlink.
5 - Non-HSUPA in uplink and HSDPA in downlink.
6 - HSUPA in uplink and HSDPA in downlink.
7 - EPS
8 - 5GS

You see ? They are similar but not the same. So I opted for the
conversion function.

> >   static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
> >   {
> >   	struct cb_data *cbd = user_data;
> > @@ -342,11 +366,11 @@ static void at_gprs_list_active_contexts(struct ofono_gprs *gprs,
> >   static void cgreg_notify(GAtResult *result, gpointer user_data)
> >   {
> >   	struct ofono_gprs *gprs = user_data;
> > -	int status;
> > +	int status, tech;
> >   	struct gprs_data *gd = ofono_gprs_get_data(gprs);
> >   	if (at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
> > -				NULL, NULL, NULL, gd->vendor) == FALSE)
> > +				NULL, NULL, &tech, gd->vendor) == FALSE)
> >   		return;
> >   	/*
> > @@ -372,6 +396,8 @@ static void cgreg_notify(GAtResult *result, gpointer user_data)
> >   	}
> >   	ofono_gprs_status_notify(gprs, status);
> > +	if (gd->vendor == OFONO_VENDOR_QUECTEL_EC2X)
> > +		ofono_gprs_bearer_notify(gprs, act_to_bearer(tech));
> 
> To follow up from above, any reason not to omit act_to_bearer() here?

See above.

> >   }
> >   static void cgev_notify(GAtResult *result, gpointer user_data)
> > @@ -624,6 +650,8 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
> >   		g_at_chat_send(gd->chat, "AT#PSNT=1", none_prefix,
> >   						NULL, NULL, NULL);
> >   		break;
> > +	case OFONO_VENDOR_QUECTEL_EC2X:
> > +		break;
> >   	default:
> >   		g_at_chat_register(gd->chat, "+CPSB:", cpsb_notify,
> >   						FALSE, gprs, NULL);
> > 

Regards,
Lars

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB
  2020-08-12  9:20     ` Lars Poeschel
@ 2020-08-12 14:44       ` Denis Kenzior
  0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2020-08-12 14:44 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

Hi Lars,

>> oFono driver interface is based on 27.007.  So that means values defined in
>> 27.007 do not need to be 'converted'.  You can simply feed them in directly
>> if they follow 27.007.
> 
> Well, yes. I saw this. But unfortunately at this point what is expected
> are the 27.007 values from AT+CPSB defined in 7.29 (that EC21 quectel
> modem does not support) and I get the values from AT+CGREG defined in 7.2.
> 

Ok, I gotcha.  I see now what you're trying to do.

The problem is that +CGREG is not really the same as +CPSB.  +CGREG only reports 
the capability of the cell, not the actual bearer being used.  This could be for 
example due to signal strength being too low, etc.

If you look at the gprs driver, we never use +CGREG info this way and many 
modems have a vendor-specific unsolicited notification if +CPSB isn't supported.

Since the Bearer is an optional property, maybe its just easier to omit it. 
Unless you know +CGREG information is the same as +CPSB on Quectel firmware...

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-12 14:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 11:42 [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X poeschel
2020-08-11 11:42 ` [PATCH v2 2/3] atmodem: Get strength and tech the quectel way on EC21 poeschel
2020-08-11 11:42 ` [PATCH v2 3/3] gprs: Quectel EC21 does not understand AT+CPSB poeschel
2020-08-11 15:55   ` Denis Kenzior
2020-08-12  9:20     ` Lars Poeschel
2020-08-12 14:44       ` Denis Kenzior
2020-08-11 15:51 ` [PATCH v2 1/3] Add a vendor OFONO_VENDOR_QUECTEL_EC2X Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).