* [PATCH 01/10] sim7100: simplify serial device opening
@ 2024-04-30 11:52 Martin Hundebøll
2024-04-30 11:52 ` [PATCH 02/10] sim7100: wait for modem to start while enabling Martin Hundebøll
` (9 more replies)
0 siblings, 10 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
Replace the g_at_{tty,syntax,chat} dance with a single call to
g_at_util_open_device().
---
plugins/sim7100.c | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index c461cc32..4a1ac782 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -57,6 +57,7 @@
#include <ofono/gprs-context.h>
#include <drivers/atmodem/vendor.h>
+#include <drivers/atmodem/atutil.h>
struct sim7100_data {
GAtChat *at;
@@ -67,7 +68,7 @@ static void sim7100_debug(const char *str, void *user_data)
{
const char *prefix = user_data;
- ofono_info("%s%s", prefix, str);
+ ofono_info("%s: %s", prefix, str);
}
/* Detect hardware, and initialize if found */
@@ -115,36 +116,14 @@ static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data)
ofono_modem_set_powered(modem, TRUE);
}
-static int open_device(struct ofono_modem *modem, const char *devkey,
- GAtChat **chatp)
+static int open_device(struct ofono_modem *modem, char *devkey, GAtChat **chat)
{
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
- const char *device;
-
DBG("devkey=%s", devkey);
- device = ofono_modem_get_string(modem, devkey);
- if (device == NULL)
- return -EINVAL;
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
+ *chat = at_util_open_device(modem, devkey, sim7100_debug, devkey, NULL);
+ if (*chat == NULL)
return -EIO;
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return -EIO;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, sim7100_debug, "");
-
- *chatp = chat;
return 0;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/10] sim7100: wait for modem to start while enabling
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 03/10] sim7100: query device model during enable Martin Hundebøll
` (8 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
The sim7100_enable() returns 0 just after queuing the AT+CFUN=1 command,
which ofono core interprets as the modem being powered up and in pre-sim
state. In fact, the pre-sim state isn't reached until the modem returns
OK, which is caught in cfun_set_on_cb() in sim7100.c.
Delay the transition from off to pre-sim until the respone is received
by return EINPROGRESS instead, and let the (existing)
ofono_modem_set_powered() call signal pre-sim to ofono core.
---
plugins/sim7100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 4a1ac782..b5e65891 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -149,7 +149,7 @@ static int sim7100_enable(struct ofono_modem *modem)
g_at_chat_send(data->at, "AT+CFUN=1", NULL, cfun_set_on_cb,
modem, NULL);
- return 0;
+ return -EINPROGRESS;
}
static void cfun_set_off_cb(gboolean ok, GAtResult *result, gpointer user_data)
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/10] sim7100: query device model during enable
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
2024-04-30 11:52 ` [PATCH 02/10] sim7100: wait for modem to start while enabling Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-05-02 14:04 ` Denis Kenzior
2024-04-30 11:52 ` [PATCH 04/10] sim7100: implement set_online() Martin Hundebøll
` (7 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
Adding support for more simcom modems in the sim7100 driver requires
certain variants handlings based on the present modem model.
Default to an "unknown" variant to keep the existing behaviour, and
introduce the A76XX model to use when later adding support for the A7672
vartiant.
---
plugins/sim7100.c | 43 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index b5e65891..1c80f4ba 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -59,9 +59,15 @@
#include <drivers/atmodem/vendor.h>
#include <drivers/atmodem/atutil.h>
+enum sim7x00_model {
+ SIMCOM_UNKNOWN = 0,
+ SIMCOM_A76XX,
+};
+
struct sim7100_data {
GAtChat *at;
GAtChat *ppp;
+ enum sim7x00_model model;
};
static void sim7100_debug(const char *str, void *user_data)
@@ -116,6 +122,38 @@ static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data)
ofono_modem_set_powered(modem, TRUE);
}
+static void cgmm_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct sim7100_data *data = ofono_modem_get_data(modem);
+ GAtResultIter iter;
+ const char *model;
+
+ if (!ok) {
+ ofono_error("%s: failed to query model", ofono_modem_get_path(modem));
+ ofono_modem_set_powered(modem, FALSE);
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ while (g_at_result_iter_next(&iter, NULL)) {
+ if (!g_at_result_iter_next_unquoted_string(&iter, &model))
+ continue;
+
+ DBG("modem model: %s", model);
+
+ if (g_str_has_prefix(model, "A7672"))
+ data->model = SIMCOM_A76XX;
+
+ break;
+ }
+
+ /* power up modem */
+ g_at_chat_send(data->at, "AT+CFUN=1", NULL, cfun_set_on_cb, modem,
+ NULL);
+}
+
static int open_device(struct ofono_modem *modem, char *devkey, GAtChat **chat)
{
DBG("devkey=%s", devkey);
@@ -145,9 +183,8 @@ static int sim7100_enable(struct ofono_modem *modem)
/* ensure modem is in a known state; verbose on, echo/quiet off */
g_at_chat_send(data->at, "ATE0Q0V1", NULL, NULL, NULL, NULL);
- /* power up modem */
- g_at_chat_send(data->at, "AT+CFUN=1", NULL, cfun_set_on_cb,
- modem, NULL);
+ /* query modem model string */
+ g_at_chat_send(data->at, "AT+CGMM", NULL, cgmm_cb, modem, NULL);
return -EINPROGRESS;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/10] sim7100: implement set_online()
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
2024-04-30 11:52 ` [PATCH 02/10] sim7100: wait for modem to start while enabling Martin Hundebøll
2024-04-30 11:52 ` [PATCH 03/10] sim7100: query device model during enable Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 05/10] sim7100: fix going offline for A76XX modems Martin Hundebøll
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
Enter pre-sim state using AT+CFUN=4, and move the AT+CFUN=1 call into
the added set_online() callback. The modem (at least the A7672E variant)
generously issues unsolicited events between the CFUN command and the OK
response, so match on the +CFUN: prefix only in set_online().
---
plugins/sim7100.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 1c80f4ba..f4979ffe 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -59,6 +59,8 @@
#include <drivers/atmodem/vendor.h>
#include <drivers/atmodem/atutil.h>
+static const char *cfun_prefix[] = { "+CFUN:", NULL };
+
enum sim7x00_model {
SIMCOM_UNKNOWN = 0,
SIMCOM_A76XX,
@@ -150,7 +152,7 @@ static void cgmm_cb(gboolean ok, GAtResult *result, gpointer user_data)
}
/* power up modem */
- g_at_chat_send(data->at, "AT+CFUN=1", NULL, cfun_set_on_cb, modem,
+ g_at_chat_send(data->at, "AT+CFUN=4", NULL, cfun_set_on_cb, modem,
NULL);
}
@@ -265,11 +267,42 @@ static void sim7100_post_sim(struct ofono_modem *modem)
ofono_message_waiting_register(mw);
}
+static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_modem_online_cb_t cb = cbd->cb;
+ struct ofono_error error;
+
+ DBG("ok: %i", ok);
+
+ decode_at_error(&error, g_at_result_final_response(result));
+ cb(&error, cbd->data);
+}
+
+static void sim7100_set_online(struct ofono_modem *modem, ofono_bool_t online,
+ ofono_modem_online_cb_t cb, void *user_data)
+{
+ struct sim7100_data *data = ofono_modem_get_data(modem);
+ struct cb_data *cbd = cb_data_new(cb, user_data);
+ char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+
+ DBG("%s", online ? "online" : "offline");
+
+ if (g_at_chat_send(data->at, command, cfun_prefix, set_online_cb, cbd,
+ g_free) > 0)
+ return;
+
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+
+ g_free(cbd);
+}
+
static struct ofono_modem_driver sim7100_driver = {
.probe = sim7100_probe,
.remove = sim7100_remove,
.enable = sim7100_enable,
.disable = sim7100_disable,
+ .set_online = sim7100_set_online,
.pre_sim = sim7100_pre_sim,
.post_sim = sim7100_post_sim,
};
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/10] sim7100: fix going offline for A76XX modems
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (2 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 04/10] sim7100: implement set_online() Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 06/10] atmodem: introduce SIMCom A76XX vendor quirks Martin Hundebøll
` (5 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
When tearing down the PPP context, the SIMCom A7672 modem issues a NO
CARRIER event on the control channel, which is detected as an error when
processing the AT+CFUN=4 respones.
Make the set_online(false) call succed by ignoring the NO CARRIER event.
---
plugins/sim7100.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index f4979ffe..2e9d0eb3 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -151,6 +151,16 @@ static void cgmm_cb(gboolean ok, GAtResult *result, gpointer user_data)
break;
}
+ switch (data->model) {
+ case SIMCOM_A76XX:
+ /* ignore NO CARRIER on the AT channel when disconnecting PPP */
+ g_at_chat_blacklist_terminator(data->at,
+ G_AT_CHAT_TERMINATOR_NO_CARRIER);
+ break;
+ default:
+ break;
+ }
+
/* power up modem */
g_at_chat_send(data->at, "AT+CFUN=4", NULL, cfun_set_on_cb, modem,
NULL);
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/10] atmodem: introduce SIMCom A76XX vendor quirks
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (3 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 05/10] sim7100: fix going offline for A76XX modems Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms Martin Hundebøll
` (4 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
As a preparation for adding support for the SIMCom A7672 modem, certain
quirks are needed in the atmodem driver. The OFONO_VENDOR_SIMCOM enum is
already shared by the existing sim7100 and sim900 drivers, so a new
"sub-vendor" enum is needed.
The new sub-vendor enum allows adding A7672 support to the sim7100
driver without changing behavior for other devices already supported.
A few of the existing simcom vendor quirks are replaced by the new
sub-vendor enum instead of making them apply to both. These places were
introduced in commit c3da88e1
("drivers: adding support for the SIMCom A7605E-H"), which should apply
to the A7672E modem too.
---
drivers/atmodem/gprs.c | 4 ++--
drivers/atmodem/network-registration.c | 1 +
drivers/atmodem/sim.c | 4 +++-
drivers/atmodem/sms.c | 1 +
drivers/atmodem/vendor.h | 1 +
5 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index e0441545..8ff9d796 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -675,7 +675,7 @@ 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:
+ case OFONO_VENDOR_SIMCOM_A76XX:
g_at_chat_register(gd->chat, "+CNSMOD:", simcom_mode_notify,
FALSE, gprs, NULL);
g_at_chat_send(gd->chat, "AT+CNSMOD=1", none_prefix,
@@ -805,7 +805,7 @@ retry:
g_at_chat_send(gd->chat, cmd, none_prefix, NULL, NULL, NULL);
- if (gd->vendor != OFONO_VENDOR_SIMCOM)
+ if (gd->vendor != OFONO_VENDOR_SIMCOM_A76XX)
g_at_chat_send(gd->chat, "AT+CGAUTO=0", none_prefix,
NULL, NULL, NULL);
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 2697d3c5..3ceca12d 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -1936,6 +1936,7 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
switch (nd->vendor) {
case OFONO_VENDOR_SIMCOM:
+ case OFONO_VENDOR_SIMCOM_A76XX:
/* Register for CSQ changes */
g_at_chat_send(nd->chat, "AT+AUTOCSQ=1,1", none_prefix,
NULL, NULL, NULL);
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index d75a09c2..6fe5efce 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -1199,6 +1199,7 @@ static void at_pin_retries_query(struct ofono_sim *sim,
return;
break;
case OFONO_VENDOR_SIMCOM:
+ case OFONO_VENDOR_SIMCOM_A76XX:
if (g_at_chat_send(sd->chat, "AT+SPIC", simcom_spic_prefix,
simcom_spic_cb, cbd, g_free) > 0)
return;
@@ -1355,6 +1356,7 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
case OFONO_VENDOR_ALCATEL:
case OFONO_VENDOR_HUAWEI:
case OFONO_VENDOR_SIMCOM:
+ case OFONO_VENDOR_SIMCOM_A76XX:
case OFONO_VENDOR_SIERRA:
/*
* On ZTE modems, after pin is entered, SIM state is checked
@@ -1647,7 +1649,7 @@ static void at_discover_apps(struct ofono_sim *sim,
* command with SIM cards of some operators
*/
if (sd->vendor == OFONO_VENDOR_QUECTEL_EC2X
- || sd->vendor == OFONO_VENDOR_SIMCOM)
+ || sd->vendor == OFONO_VENDOR_SIMCOM_A76XX)
goto error;
cbd = cb_data_new(cb, data);
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index c69fe947..be0c7ada 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -846,6 +846,7 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
case OFONO_VENDOR_HUAWEI:
case OFONO_VENDOR_ZTE:
case OFONO_VENDOR_SIMCOM:
+ case OFONO_VENDOR_SIMCOM_A76XX:
case OFONO_VENDOR_QUECTEL:
case OFONO_VENDOR_QUECTEL_EC2X:
case OFONO_VENDOR_DROID:
diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h
index 82284e44..90446943 100644
--- a/drivers/atmodem/vendor.h
+++ b/drivers/atmodem/vendor.h
@@ -41,6 +41,7 @@ enum ofono_vendor {
OFONO_VENDOR_SAMSUNG,
OFONO_VENDOR_SIMCOM,
OFONO_VENDOR_SIMCOM_SIM900,
+ OFONO_VENDOR_SIMCOM_A76XX,
OFONO_VENDOR_ICERA,
OFONO_VENDOR_WAVECOM_Q2XXX,
OFONO_VENDOR_ALCATEL,
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (4 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 06/10] atmodem: introduce SIMCom A76XX vendor quirks Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem Martin Hundebøll
` (3 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
Use the recently added detection of modem model to apply the even more
recently added SIMCom sub-vendor id when creating atoms.
The "old" SIMCom vendor id is shared between the sim7100 and sim900
drivers, and so changing the 0 vendor id's for the existing
ofono_*_create() calls might have unexpected side-effects. Avoid such
changes by calling the needed ofono_*_create() functions separately for
each model instead.
---
plugins/sim7100.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 2e9d0eb3..192559d6 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -241,8 +241,19 @@ static void sim7100_pre_sim(struct ofono_modem *modem)
DBG("");
ofono_devinfo_create(modem, 0, "atmodem", data->at);
- sim = ofono_sim_create(modem, 0, "atmodem", data->at);
- ofono_voicecall_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->at);
+
+ switch (data->model) {
+ case SIMCOM_A76XX:
+ sim = ofono_sim_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+ "atmodem", data->at);
+ ofono_voicecall_create(modem, 0, "atmodem", data->at);
+ break;
+ default:
+ sim = ofono_sim_create(modem, 0, "atmodem", data->at);
+ ofono_voicecall_create(modem, OFONO_VENDOR_SIMCOM,
+ "atmodem", data->at);
+ break;
+ }
if (sim)
ofono_sim_inserted_notify(sim, TRUE);
@@ -260,13 +271,27 @@ static void sim7100_post_sim(struct ofono_modem *modem)
ofono_ussd_create(modem, 0, "atmodem", data->at);
ofono_call_forwarding_create(modem, 0, "atmodem", data->at);
ofono_call_settings_create(modem, 0, "atmodem", data->at);
- ofono_netreg_create(modem, 0, "atmodem", data->at);
ofono_call_meter_create(modem, 0, "atmodem", data->at);
ofono_call_barring_create(modem, 0, "atmodem", data->at);
- ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->at);
ofono_phonebook_create(modem, 0, "atmodem", data->at);
- gprs = ofono_gprs_create(modem, 0, "atmodem", data->at);
+ switch (data->model) {
+ case SIMCOM_A76XX:
+ ofono_netreg_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+ "atmodem", data->at);
+ ofono_sms_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+ "atmodem", data->at);
+ gprs = ofono_gprs_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+ "atmodem", data->at);
+ break;
+ default:
+ ofono_netreg_create(modem, 0, "atmodem", data->at);
+ ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
+ data->at);
+ gprs = ofono_gprs_create(modem, 0, "atmodem", data->at);
+ break;
+ }
+
gc = ofono_gprs_context_create(modem, 0, "atmodem", data->ppp);
if (gprs && gc)
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (5 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-05-22 7:48 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 09/10] Makefile: enable build of simcommodem radiosettings Martin Hundebøll
` (2 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
Register the 1e0e:9011 usb id as a specialization of the sim7100 driver.
Use a new setup() function to handle the different order (and amount) of
USB endpoint numbers without introducing too much complexity to the
existing setup() function.
---
plugins/udevng.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/plugins/udevng.c b/plugins/udevng.c
index b9d115f1..4267c892 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1630,6 +1630,57 @@ static gboolean setup_sim7x00(struct modem_info *modem)
return TRUE;
}
+static gboolean setup_sim76xx(struct modem_info *modem)
+{
+ const char *diag = NULL;
+ const char *mdm = NULL;
+ const char *ppp = NULL;
+ const char *gps = NULL;
+ GSList *list;
+
+ DBG("%s", modem->syspath);
+
+ for (list = modem->devices; list; list = list->next) {
+ const struct device_info *info = list->data;
+ const char *subsystem;
+
+ subsystem = udev_device_get_subsystem(info->udev_device);
+ if (!g_str_equal(subsystem, "tty"))
+ continue;
+
+ DBG("%s %s %s", info->devnode, info->interface, info->number);
+
+ /*
+ * SIM76xx USB numbering:
+ * 0: RNDIS (ep_87)
+ * 1: RNDIS (ep_0c and ep_83)
+ * 2: QCDM/DIAG (ttyUSB0)
+ * 3: NMEA (ttyUSB3)
+ * 4: AT (ttyUSB1)
+ * 5: AT/PPP (ttyUSB2)
+ */
+ if (g_str_equal(info->number, "02"))
+ diag = info->devnode;
+ else if (g_str_equal(info->number, "03"))
+ gps = info->devnode;
+ else if (g_str_equal(info->number, "04"))
+ mdm = info->devnode;
+ else if (g_str_equal(info->number, "05"))
+ ppp = info->devnode;
+ }
+
+ if (mdm == NULL)
+ return FALSE;
+
+ DBG("at=%s ppp=%s gps=%s diag=%s", mdm, ppp, gps, diag);
+
+ ofono_modem_set_driver(modem->modem, "sim7100");
+ ofono_modem_set_string(modem->modem, "AT", mdm);
+ ofono_modem_set_string(modem->modem, "PPP", ppp);
+
+ return TRUE;
+}
+
static struct {
const char *name;
gboolean (*setup)(struct modem_info *modem);
@@ -1650,6 +1701,7 @@ static struct {
{ "telitqmi", setup_telitqmi },
{ "simcom", setup_simcom },
{ "sim7x00", setup_sim7x00 },
+ { "sim76xx", setup_sim76xx },
{ "zte", setup_zte },
{ "icera", setup_icera },
{ "samsung", setup_samsung },
@@ -2033,6 +2085,7 @@ static struct {
{ "simcom", "option", "05c6", "9000" },
{ "sim7x00", "option", "1e0e", "9001" },
{ "sim7x00", "qmi_wwan", "1e0e", "9001" },
+ { "sim76xx", "option", "1e0e", "9011" },
{ "telit", "usbserial", "1bc7" },
{ "telit", "option", "1bc7" },
{ "telit", "cdc_acm", "1bc7", "0021" },
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/10] Makefile: enable build of simcommodem radiosettings
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (6 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 10/10] sim7100: create radio-settings atom for A76XX modems Martin Hundebøll
2024-05-02 14:00 ` [PATCH 01/10] sim7100: simplify serial device opening patchwork-bot+ofono
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
This change was missing from commit c3da88e1
("drivers: adding support for the SIMCom A7605E-H"). Add it now to allow
radio-settings support for SIMCom A76XX modems.
---
Makefile.am | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index 36319d98..44fb7b1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -532,6 +532,9 @@ builtin_sources += drivers/atmodem/atutil.h \
builtin_sources += drivers/atmodem/atutil.h \
drivers/quectelmodem/radio-settings.c
+builtin_sources += drivers/atmodem/atutil.h \
+ drivers/simcommodem/radio-settings.c
+
if PHONESIM
builtin_modules += phonesim
builtin_sources += plugins/phonesim.c
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/10] sim7100: create radio-settings atom for A76XX modems
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (7 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 09/10] Makefile: enable build of simcommodem radiosettings Martin Hundebøll
@ 2024-04-30 11:52 ` Martin Hundebøll
2024-05-02 14:00 ` [PATCH 01/10] sim7100: simplify serial device opening patchwork-bot+ofono
9 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-04-30 11:52 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll, MaxLyubimov
---
plugins/sim7100.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 192559d6..90f97742 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -49,6 +49,7 @@
#include <ofono/message-waiting.h>
#include <ofono/netreg.h>
#include <ofono/phonebook.h>
+#include <ofono/radio-settings.h>
#include <ofono/sim.h>
#include <ofono/sms.h>
#include <ofono/ussd.h>
@@ -281,6 +282,7 @@ static void sim7100_post_sim(struct ofono_modem *modem)
"atmodem", data->at);
ofono_sms_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
"atmodem", data->at);
+ ofono_radio_settings_create(modem, 0, "simcommodem", data->at);
gprs = ofono_gprs_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
"atmodem", data->at);
break;
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 01/10] sim7100: simplify serial device opening
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
` (8 preceding siblings ...)
2024-04-30 11:52 ` [PATCH 10/10] sim7100: create radio-settings atom for A76XX modems Martin Hundebøll
@ 2024-05-02 14:00 ` patchwork-bot+ofono
9 siblings, 0 replies; 14+ messages in thread
From: patchwork-bot+ofono @ 2024-05-02 14:00 UTC (permalink / raw)
To: =?utf-8?q?Martin_Hundeb=C3=B8ll_=3Cmartin=40geanix=2Ecom=3E?=
Cc: ofono, m.lyubimov
Hello:
This series was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:
On Tue, 30 Apr 2024 13:52:24 +0200 you wrote:
> Replace the g_at_{tty,syntax,chat} dance with a single call to
> g_at_util_open_device().
> ---
> plugins/sim7100.c | 31 +++++--------------------------
> 1 file changed, 5 insertions(+), 26 deletions(-)
Here is the summary with links:
- [01/10] sim7100: simplify serial device opening
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4e161031a92b
- [02/10] sim7100: wait for modem to start while enabling
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4b98bea96881
- [03/10] sim7100: query device model during enable
(no matching commit)
- [04/10] sim7100: implement set_online()
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=960aefa86ca1
- [05/10] sim7100: fix going offline for A76XX modems
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=cbafc2eaf6de
- [06/10] atmodem: introduce SIMCom A76XX vendor quirks
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=4ef41eecf675
- [07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=734689fde230
- [08/10] udevng: register support for SIMCom A76XX USB serial modem
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=9631b1208561
- [09/10] Makefile: enable build of simcommodem radiosettings
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=1957fab23f4b
- [10/10] sim7100: create radio-settings atom for A76XX modems
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=2f94a6c1dc42
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 03/10] sim7100: query device model during enable
2024-04-30 11:52 ` [PATCH 03/10] sim7100: query device model during enable Martin Hundebøll
@ 2024-05-02 14:04 ` Denis Kenzior
0 siblings, 0 replies; 14+ messages in thread
From: Denis Kenzior @ 2024-05-02 14:04 UTC (permalink / raw)
To: Martin Hundebøll, ofono; +Cc: MaxLyubimov
Hi Martin,
On 4/30/24 6:52 AM, Martin Hundebøll wrote:
> Adding support for more simcom modems in the sim7100 driver requires
> certain variants handlings based on the present modem model.
>
> Default to an "unknown" variant to keep the existing behaviour, and
> introduce the A76XX model to use when later adding support for the A7672
> vartiant.
> ---
> plugins/sim7100.c | 43 ++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 40 insertions(+), 3 deletions(-)
>
Nice series! Thanks you. This patch was applied as well:
> +
> + if (!ok) {
> + ofono_error("%s: failed to query model", ofono_modem_get_path(modem));
I amended here to avoid > 80 char line.
> + ofono_modem_set_powered(modem, FALSE);
> + return;
> + }
Regards,
-Denis
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem
2024-04-30 11:52 ` [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem Martin Hundebøll
@ 2024-05-22 7:48 ` Martin Hundebøll
2024-05-23 13:26 ` Martin Hundebøll
0 siblings, 1 reply; 14+ messages in thread
From: Martin Hundebøll @ 2024-05-22 7:48 UTC (permalink / raw)
To: ofono; +Cc: Denis Kenzior
Hi,
On Tue, 2024-04-30 at 13:52 +0200, Martin Hundebøll wrote:
> Register the 1e0e:9011 usb id as a specialization of the sim7100
> driver.
I'm seeking advice on an issue that I experience with this SIMCom
A7672E modem: Not closing the PPP session when powering down the modem
breaks a following attempt to go online.
When setting Powered to false on dbus, any active PPP session is
destroyed without terminating it. The modem then keeps the session
alive for 15 seconds, even after sending AT+CFUN=0 and AT+CFUN=1.
The active session on the modem somehow interferes powering up the
modem again, and activating the gprs context.
The issue can be worked around by setting Online to false before
setting Powered to false.
I've been in contact with SIMCom, and while they understand the issue,
they more or less tell me to just close the PPP session before sending
AT+CFUN=0 :( I'm still trying to make them fix the issue properly, but
I don't hold my breath...
Is there a way to make ofono send a proper PPP terminate request to the
modem when powering down?
// Martin
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem
2024-05-22 7:48 ` Martin Hundebøll
@ 2024-05-23 13:26 ` Martin Hundebøll
0 siblings, 0 replies; 14+ messages in thread
From: Martin Hundebøll @ 2024-05-23 13:26 UTC (permalink / raw)
To: ofono; +Cc: Denis Kenzior
On Wed, 2024-05-22 at 09:48 +0200, Martin Hundebøll wrote:
> Hi,
>
> On Tue, 2024-04-30 at 13:52 +0200, Martin Hundebøll wrote:
> > Register the 1e0e:9011 usb id as a specialization of the sim7100
> > driver.
>
> I'm seeking advice on an issue that I experience with this SIMCom
> A7672E modem: Not closing the PPP session when powering down the
> modem
> breaks a following attempt to go online.
>
> When setting Powered to false on dbus, any active PPP session is
> destroyed without terminating it. The modem then keeps the session
> alive for 15 seconds, even after sending AT+CFUN=0 and AT+CFUN=1.
>
> The active session on the modem somehow interferes powering up the
> modem again, and activating the gprs context.
>
> The issue can be worked around by setting Online to false before
> setting Powered to false.
>
> I've been in contact with SIMCom, and while they understand the
> issue,
> they more or less tell me to just close the PPP session before
> sending
> AT+CFUN=0 :( I'm still trying to make them fix the issue properly,
> but
> I don't hold my breath...
>
> Is there a way to make ofono send a proper PPP terminate request to
> the
> modem when powering down?
SIMCom has agreed to add a vendor AT command that enables reset of
modem PPP state upon either AT+CFUN=0 or a subsequent AT+CFUN=1.
I'll create a patch once I get my hands on the updated firmware.
// Martin
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-05-23 13:26 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30 11:52 [PATCH 01/10] sim7100: simplify serial device opening Martin Hundebøll
2024-04-30 11:52 ` [PATCH 02/10] sim7100: wait for modem to start while enabling Martin Hundebøll
2024-04-30 11:52 ` [PATCH 03/10] sim7100: query device model during enable Martin Hundebøll
2024-05-02 14:04 ` Denis Kenzior
2024-04-30 11:52 ` [PATCH 04/10] sim7100: implement set_online() Martin Hundebøll
2024-04-30 11:52 ` [PATCH 05/10] sim7100: fix going offline for A76XX modems Martin Hundebøll
2024-04-30 11:52 ` [PATCH 06/10] atmodem: introduce SIMCom A76XX vendor quirks Martin Hundebøll
2024-04-30 11:52 ` [PATCH 07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms Martin Hundebøll
2024-04-30 11:52 ` [PATCH 08/10] udevng: register support for SIMCom A76XX USB serial modem Martin Hundebøll
2024-05-22 7:48 ` Martin Hundebøll
2024-05-23 13:26 ` Martin Hundebøll
2024-04-30 11:52 ` [PATCH 09/10] Makefile: enable build of simcommodem radiosettings Martin Hundebøll
2024-04-30 11:52 ` [PATCH 10/10] sim7100: create radio-settings atom for A76XX modems Martin Hundebøll
2024-05-02 14:00 ` [PATCH 01/10] sim7100: simplify serial device opening patchwork-bot+ofono
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox