Skip to contentSkip to conversation

Report technology for SIMCom A76XX modem series

PATCH Applied Sean Nyekjaer 2 participants 7 messages Aug 21, 2025 – Aug 27, 2025

lore
Share & tools
lore
#0 lore raw

cover Report technology for SIMCom A76XX modem series

---
Sean Nyekjaer (5):
sim7100: Update to handle broader A76XX modem series
atmodem: add explicit handling for netreg status in creg_notify()
atmodem: also handle EUTRAN networks in creg_notify()
atmodem: report cell technology capability for SIMCom A76XX Revert "atmodem: let +COPS: report access technology for SIMCom"

 drivers/atmodem/network-registration.c | 99 ++++++++++++++++++++++++++++++----
 plugins/sim7100.c                      |  2 +-
 2 files changed, 91 insertions(+), 10 deletions(-)

---
base-commit: d3a70b22ee370fc80de81d5f66be6084cf734036
change-id: 20250821-simcom-d97c2d5c83d4

Best regards,

Signature · 1 line
Sean Nyekjaer <[email protected]>
#1 lore raw

PATCH 1/5 sim7100: Update to handle broader A76XX modem series

Update the model detection logic in cgmm_cb. Change the prefix check from "A7672" to "A76" to support the broader A76XX series of modems.

---
 plugins/sim7100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/sim7100.c +1 -1
index 02f5b537f4d2dcd68046ab6dbac37d57706e2d3f..c4fc5798f746eb1e510302b575e38ca6924cd014 100644
@@ -174,7 +174,7 @@ static void cgmm_cb(gboolean ok, GAtResult *result, gpointer user_data)
 
 		DBG("modem model: %s", model);
 
-		if (g_str_has_prefix(model, "A7672"))
+		if (g_str_has_prefix(model, "A76"))
 			data->model = SIMCOM_A76XX;
 
 		break;
Signature · 1 line
2.50.1
#2 lore raw

PATCH 2/5 atmodem: add explicit handling for netreg status in creg_notify()

In reply to Sean Nyekjaer

Modify creg_notify() to use a switch statement with the network_registration_status enum.
Previously these statuses were checked using a conditional statement, which was less clear.

---
 drivers/atmodem/network-registration.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/atmodem/network-registration.c +8 -2
index 18e56f2bf9e2dbd6c96947ac57f66ddf0125391e..e13ea5b2405769825e8535648b1b0c283236f08e 100644
@@ -1572,8 +1572,14 @@ static void creg_notify(GAtResult *result, gpointer user_data)
 				&lac, &ci, &tech, nd->vendor) == FALSE)
 		return;
 
-	if (status != 1 && status != 5)
-		goto notify;
+	switch (status) {
+		case NETWORK_REGISTRATION_STATUS_REGISTERED:
+		case NETWORK_REGISTRATION_STATUS_ROAMING:
+			break;
+		default:
+			goto notify;
+			break;
+	}
 
 	tq = g_try_new0(struct tech_query, 1);
 	if (tq == NULL)
Signature · 1 line
2.50.1
#3 lore raw

PATCH 3/5 atmodem: also handle EUTRAN networks in creg_notify()

In reply to Sean Nyekjaer

SIMCom A76XX shows attached on LTE with +CREG <stat> so add more values from the network_registration_status enum.

---
 drivers/atmodem/network-registration.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/atmodem/network-registration.c +2 -0
index e13ea5b2405769825e8535648b1b0c283236f08e..8087543117b7abfce87240940e47264283f95234 100644
@@ -1575,6 +1575,8 @@ static void creg_notify(GAtResult *result, gpointer user_data)
 	switch (status) {
 		case NETWORK_REGISTRATION_STATUS_REGISTERED:
 		case NETWORK_REGISTRATION_STATUS_ROAMING:
+		case NETWORK_REGISTRATION_STATUS_REGISTERED_SMS_EUTRAN:
+		case NETWORK_REGISTRATION_STATUS_ROAMING_SMS_EUTRAN:
 			break;
 		default:
 			goto notify;
Signature · 1 line
2.50.1
#4 lore raw

PATCH 4/5 atmodem: report cell technology capability for SIMCom A76XX

In reply to Sean Nyekjaer
---
 drivers/atmodem/network-registration.c | 80 ++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
drivers/atmodem/network-registration.c +80 -0
index 8087543117b7abfce87240940e47264283f95234..7f03759b83b3cf8c45cc885a450cdf24ac9aed92 100644
@@ -38,6 +38,7 @@ static const char *csq_prefix[] = { "+CSQ:", NULL };
 static const char *cind_prefix[] = { "+CIND:", NULL };
 static const char *cmer_prefix[] = { "+CMER:", NULL };
 static const char *smoni_prefix[] = { "^SMONI:", NULL };
+static const char *simcom_tech_prefix[] = { "+CNSMOD:", NULL };
 static const char *zpas_prefix[] = { "+ZPAS:", NULL };
 static const char *option_tech_prefix[] = { "_OCTI:", "_OUWCTI:", NULL };
 
@@ -179,6 +180,45 @@ static int gemalto_parse_tech(GAtResult *result)
 	return tech;
 }
 
+static int simcom_parse_tech(GAtResult *result)
+{
+	GAtResultIter iter;
+	int s, stat, tech;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+CNSMOD:"))
+		return -1;
+
+	if (!g_at_result_iter_next_number(&iter, &s))
+		return -1;
+
+	if (!g_at_result_iter_next_number(&iter, &stat))
+		return -1;
+
+	switch (stat) {
+	case 1: /* GSM */
+		tech = ACCESS_TECHNOLOGY_GSM;
+		break;
+	case 2: /* GPRS */
+		tech = ACCESS_TECHNOLOGY_GSM;
+		break;
+	case 3: /* EDGE */
+		tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
+		break;
+	case 8: /* LTE */
+		tech = ACCESS_TECHNOLOGY_EUTRAN;
+		break;
+	default:
+		tech = -1;
+		break;
+	}
+
+	DBG("stat %d tech %d", stat, tech);
+
+	return tech;
+}
+
 static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
 	struct cb_data *cbd = user_data;
@@ -246,6 +286,18 @@ static void option_tech_cb(gboolean ok, GAtResult *result, gpointer user_data)
 		nd->tech = -1;
 }
 
+static void simcom_tech_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	struct ofono_netreg *netreg = cbd->data;
+	struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+
+	if (ok)
+		nd->tech = simcom_parse_tech(result);
+	else
+		nd->tech = -1;
+}
+
 void at_registration_status(struct ofono_netreg *netreg,
 					ofono_netreg_status_cb_t cb,
 					void *data)
@@ -299,6 +351,13 @@ void at_registration_status(struct ofono_netreg *netreg,
 					option_tech_cb, cbd, NULL) == 0)
 			nd->tech = -1;
 		break;
+	case OFONO_VENDOR_SIMCOM_A76XX:
+		/* Send AT+CNSMOD? to find out the current tech */
+		if (g_at_chat_send(nd->chat, "AT+CNSMOD?",
+					simcom_tech_prefix,
+					simcom_tech_cb, cbd, NULL) == 0)
+			nd->tech = -1;
+		break;
 	}
 
 	if (g_at_chat_send(nd->chat, "AT+CREG?", creg_prefix,
@@ -1561,6 +1620,21 @@ static void option_query_tech_cb(gboolean ok, GAtResult *result,
 			tq->status, tq->lac, tq->ci, tech);
 }
 
+static void simcom_query_tech_cb(gboolean ok, GAtResult *result,
+						gpointer user_data)
+{
+	struct tech_query *tq = user_data;
+	int tech;
+
+	if (ok)
+		tech = simcom_parse_tech(result);
+	else
+		tech = -1;
+
+	ofono_netreg_status_notify(tq->netreg,
+			tq->status, tq->lac, tq->ci, tech);
+}
+
 static void creg_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_netreg *netreg = user_data;
@@ -1620,6 +1694,12 @@ static void creg_notify(GAtResult *result, gpointer user_data)
 					gemalto_query_tech_cb, tq, g_free) > 0)
 			return;
 		break;
+	case OFONO_VENDOR_SIMCOM_A76XX:
+		if (g_at_chat_send(nd->chat, "AT+CNSMOD?",
+					simcom_tech_prefix,
+					simcom_query_tech_cb, tq, g_free) > 0)
+			return;
+		break;
 	}
 
 	g_free(tq);
Signature · 1 line
2.50.1
#5 lore raw

PATCH 5/5 Revert "atmodem: let +COPS: report access technology for SIMCom"

In reply to Sean Nyekjaer

This doesn't make sense anymore after "atmodem: report cell technology capability for SIMCom A76XX"

This reverts commit a2adfca2cb0a5b0857ed7843fe66d21fe1fccb86.

---
 drivers/atmodem/network-registration.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/atmodem/network-registration.c +0 -7
index 7f03759b83b3cf8c45cc885a450cdf24ac9aed92..ba5a93bb5dfa48ce591d31b5bac8e3c9dcb1d7f4 100644
@@ -412,13 +412,6 @@ static void cops_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	op.status = 2;
 	op.tech = tech;
 
-	/*
-	 * SIMCom modems shows the current tech via the +COPS
-	 * not like other modems where it's shown via +CREG
-	 */
-	if (nd->vendor == OFONO_VENDOR_SIMCOM_A76XX)
-		nd->tech = tech;
-
 	DBG("cops_cb: %s, %s %s %d", name, nd->mcc, nd->mnc, tech);
 
 	cb(&error, &op, cbd->data);
Signature · 1 line
2.50.1
#6 lore raw
In reply to Sean Nyekjaer
This series was applied to ofono.git (master) by Denis Kenzior <[email protected]>:

Hello:

This series was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:

Quoted 9 lines · On Thu, 21 Aug 2025 13:24:08 +0200 you wrote:

---
Sean Nyekjaer (5):
sim7100: Update to handle broader A76XX modem series
atmodem: add explicit handling for netreg status in creg_notify()
atmodem: also handle EUTRAN networks in creg_notify()
atmodem: report cell technology capability for SIMCom A76XX Revert "atmodem: let +COPS: report access technology for SIMCom"

[...]

Here is the summary with links:
- [1/5] sim7100: Update to handle broader A76XX modem series

    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=d81d5ff236c2
  - [2/5] atmodem: add explicit handling for netreg status in creg_notify()
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=5172cc6b39c5
  - [3/5] atmodem: also handle EUTRAN networks in creg_notify()
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=0075ab3f8832
  - [4/5] atmodem: report cell technology capability for SIMCom A76XX
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=f32a8ea3b4bf
  - [5/5] Revert "atmodem: let +COPS: report access technology for SIMCom"
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=526e9a9465d8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html