($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: MaxLyubimov <m.lyubimov@aqsi.ru>
To: ofono@lists.linux.dev
Cc: MaxLyubimov <m.lyubimov@aqsi.ru>
Subject: [PATCH 02/18] drivers: adding support for the SIMCom A7605E-H
Date: Tue, 17 Oct 2023 12:33:26 +0500	[thread overview]
Message-ID: <20231017073342.673160-2-m.lyubimov@aqsi.ru> (raw)
In-Reply-To: <20231017073342.673160-1-m.lyubimov@aqsi.ru>

The features of the SIMCom A7605E-H modem are taken into account in the atmodem driver
---
 drivers/atmodem/gprs.c | 60 +++++++++++++++++++++++++++++++++++++++++-
 drivers/atmodem/sim.c  |  7 ++---
 2 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 8c352ba6..a52bf2f1 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -41,6 +41,8 @@
 #include "gatchat.h"
 #include "gatresult.h"
 
+#include "atmodem.h"
+#include "common.h"
 #include "vendor.h"
 
 #define MAX_CONTEXTS 255
@@ -544,6 +546,54 @@ static void telit_mode_notify(GAtResult *result, gpointer user_data)
 	ofono_gprs_bearer_notify(gprs, bearer);
 }
 
+static void simcom_mode_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	GAtResultIter iter;
+	gint stat, bearer;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+CNSMOD:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter,&stat))
+		return;
+
+	switch (stat) {
+	case 0:
+		bearer = PACKET_BEARER_NONE;
+		break;
+	case 1:
+	case 2:
+		bearer = PACKET_BEARER_GPRS;
+		break;
+	case 3:
+		bearer = PACKET_BEARER_EGPRS;
+		break;
+	case 4:
+		bearer = PACKET_BEARER_UMTS;
+		break;
+	case 5:
+		bearer = PACKET_BEARER_HSDPA;
+		break;
+	case 6:
+		bearer = PACKET_BEARER_HSUPA;
+		break;
+	case 7:
+		bearer = PACKET_BEARER_HSUPA_HSDPA;
+		break;
+	case 8:
+		bearer = PACKET_BEARER_EPS;
+		break;
+	default:
+		bearer = PACKET_BEARER_NONE;
+		break;
+	}
+
+	ofono_gprs_bearer_notify(gprs, bearer);
+}
+
 static void ublox_ureg_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_gprs *gprs = user_data;
@@ -626,6 +676,12 @@ 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_SIMCOM:
+		g_at_chat_register(gd->chat, "+CNSMOD:", simcom_mode_notify,
+						FALSE, gprs, NULL);
+		g_at_chat_send(gd->chat, "AT+CNSMOD=1", none_prefix,
+						NULL, NULL, NULL);
+		break;
 	case OFONO_VENDOR_QUECTEL_EC2X:
 	case OFONO_VENDOR_QUECTEL_SERIAL:
 		break;
@@ -749,7 +805,9 @@ retry:
 		goto error;
 
 	g_at_chat_send(gd->chat, cmd, none_prefix, NULL, NULL, NULL);
-	g_at_chat_send(gd->chat, "AT+CGAUTO=0", none_prefix, NULL, NULL, NULL);
+	if (gd->vendor != OFONO_VENDOR_SIMCOM) {
+		g_at_chat_send(gd->chat, "AT+CGAUTO=0", none_prefix, NULL, NULL, NULL);
+	}
 
 	switch (gd->vendor) {
 	case OFONO_VENDOR_MBM:
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 3cb8c7bd..8849a129 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -1642,9 +1642,10 @@ static void at_discover_apps(struct ofono_sim *sim,
 	struct sim_data *sd = ofono_sim_get_data(sim);
 	struct cb_data *cbd;
 
-	/* QUECTEL EC2X reboots when executing the AT+CUAD command with SIM cards
-	of some operators */
-	if (sd->vendor == OFONO_VENDOR_QUECTEL_EC2X)
+	/* QUECTEL EC2X and SIMCom A7605E-H reboots when executing the AT+CUAD
+	command with SIM cards of some operators */
+	if (sd->vendor == OFONO_VENDOR_QUECTEL_EC2X
+			|| sd->vendor == OFONO_VENDOR_SIMCOM)
 		goto error;
 
 	cbd = cb_data_new(cb, data);
-- 
2.25.1


  reply	other threads:[~2023-10-17  7:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17  7:33 [PATCH 01/18] Skipping AT+CUAD sending for QUECTEL_EC2X vendor MaxLyubimov
2023-10-17  7:33 ` MaxLyubimov [this message]
2023-10-17  7:33 ` [PATCH 03/18] plugins: adding support for the SIMCom A7605E-H MaxLyubimov
2023-10-17  7:33 ` [PATCH 04/18] build: " MaxLyubimov
2023-10-17  7:33 ` [PATCH 05/18] drivers: simcom: Add radio settings MaxLyubimov
2023-10-17  7:33 ` [PATCH 06/18] build: Add simcom radio settings rules MaxLyubimov
2023-10-17  7:33 ` [PATCH 07/18] plugins: simcom: Add radio settings MaxLyubimov
2023-10-17  7:33 ` [PATCH 08/18] drivers: quectel: " MaxLyubimov
2023-10-17  7:33 ` [PATCH 09/18] build: Add quectel radio settings rules MaxLyubimov
2023-10-17  7:33 ` [PATCH 10/18] plugins: quectel: Add radio settings MaxLyubimov
2023-10-17  7:33 ` [PATCH 11/18] drivers: gemalto: Add models list MaxLyubimov
2023-10-17  7:33 ` [PATCH 12/18] plugins: gemalto: Include " MaxLyubimov
2023-10-17  7:33 ` [PATCH 13/18] plugins: udevng: Add support gemalto EHS5-E MaxLyubimov
2023-10-17  7:33 ` [PATCH 14/18] gemalto: radio-settings: Add support EHS5-E MaxLyubimov
2023-10-17  7:33 ` [PATCH 15/18] Fix PPP LCP Configure-Reject MaxLyubimov
2023-10-17  7:33 ` [PATCH 16/18] atmodem: added context deactivation event handling MaxLyubimov
2023-10-17  7:33 ` [PATCH 17/18] gatchat: added command completion by timeout MaxLyubimov
2023-10-17  7:33 ` [PATCH 18/18] ppp: message tracing MaxLyubimov
2023-10-17  9:37   ` Любимов Максим
2023-10-17 10:56   ` Lyubimov Maxim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231017073342.673160-2-m.lyubimov@aqsi.ru \
    --to=m.lyubimov@aqsi.ru \
    --cc=ofono@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).