Open Source Telephony
 help / color / mirror / Atom feed
From: Piotr Haber <gluedig@gmail.com>
To: ofono@ofono.org
Subject: [PATCH] support Telit LE910 modem
Date: Thu, 16 Mar 2017 10:32:04 +0100	[thread overview]
Message-ID: <20170316093204.25275-2-gluedig@gmail.com> (raw)
In-Reply-To: <20170316093204.25275-1-gluedig@gmail.com>

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

---
 drivers/qmimodem/devinfo.c |  2 +-
 plugins/gobi.c             | 26 ++++++++++++++------------
 plugins/udevng.c           | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 13 deletions(-)

diff --git a/drivers/qmimodem/devinfo.c b/drivers/qmimodem/devinfo.c
index 34aec94a..9f0f1259 100644
--- a/drivers/qmimodem/devinfo.c
+++ b/drivers/qmimodem/devinfo.c
@@ -125,7 +125,7 @@ static void get_ids_cb(struct qmi_result *result, void *user_data)
 	}
 
 	str = qmi_result_get_string(result, QMI_DMS_RESULT_ESN);
-	if (!str) {
+	if (!str || strcmp(str, "0") == 0) {
 		str = qmi_result_get_string(result, QMI_DMS_RESULT_IMEI);
 		if (!str) {
 			CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 6a789411..dc53f92a 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -167,22 +167,24 @@ static void get_oper_mode_cb(struct qmi_result *result, void *user_data)
 	}
 
 	data->oper_mode = mode;
-
 	switch (data->oper_mode) {
 	case QMI_DMS_OPER_MODE_ONLINE:
-		param = qmi_param_new_uint8(QMI_DMS_PARAM_OPER_MODE,
-					QMI_DMS_OPER_MODE_PERSIST_LOW_POWER);
-		if (!param) {
+		if (ofono_modem_get_boolean(modem, "AlwaysOnline") != TRUE) {
+			DBG("set QMI_DMS_OPER_MODE_PERSIST_LOW_POWER");
+			param = qmi_param_new_uint8(QMI_DMS_PARAM_OPER_MODE,
+						    QMI_DMS_OPER_MODE_PERSIST_LOW_POWER);
+			if (!param) {
+				shutdown_device(modem);
+				return;
+			}
+
+			if (qmi_service_send(data->dms, QMI_DMS_SET_OPER_MODE, param,
+					     power_reset_cb, modem, NULL) > 0)
+				return;
+
 			shutdown_device(modem);
-			return;
+			break;
 		}
-
-		if (qmi_service_send(data->dms, QMI_DMS_SET_OPER_MODE, param,
-					power_reset_cb, modem, NULL) > 0)
-			return;
-
-		shutdown_device(modem);
-		break;
 	default:
 		ofono_modem_set_powered(modem, TRUE);
 		break;
diff --git a/plugins/udevng.c b/plugins/udevng.c
index 2279bbe9..b3c4bc74 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -218,6 +218,51 @@ static gboolean setup_gobi(struct modem_info *modem)
 	return TRUE;
 }
 
+static gboolean setup_le910(struct modem_info *modem)
+{
+	const char *qmi = NULL, *mdm = NULL, *net = NULL, *aux = NULL;
+	GSList *list;
+
+	DBG("%p %s", modem, modem->syspath);
+
+	for (list = modem->devices; list; list = list->next) {
+		struct device_info *info = list->data;
+
+		DBG("%s %s %s %s %s", info->devnode, info->interface,
+				    info->number, info->label, info->subsystem);
+
+		if (g_strcmp0(info->interface, "255/255/255") == 0) {
+			if (g_strcmp0(info->number, "02") == 0) {
+			    if (g_strcmp0(info->subsystem, "net") == 0)
+				net = info->devnode;
+			    else if (g_strcmp0(info->subsystem, "usbmisc") == 0)
+				qmi = info->devnode;
+			}
+		} else if (g_strcmp0(info->interface, "255/0/0") == 0) {
+			if (g_strcmp0(info->number, "04") == 0)
+				mdm = info->devnode;
+			else if (g_strcmp0(info->number, "05") == 0)
+				aux = info->devnode;
+		}
+	}
+
+	if (qmi == NULL || mdm == NULL || net == NULL)
+		return FALSE;
+
+	DBG("qmi=%s net=%s", qmi, net);
+	DBG("mdm=%s aux=%s", mdm, aux);
+
+	ofono_modem_set_string(modem->modem, "Device", qmi);
+	ofono_modem_set_string(modem->modem, "Modem", mdm);
+	ofono_modem_set_string(modem->modem, "NetworkInterface", net);
+	ofono_modem_set_string(modem->modem, "Aux", aux);
+	ofono_modem_set_boolean(modem->modem, "ForceSimLegacy", TRUE);
+	ofono_modem_set_boolean(modem->modem, "AlwaysOnline", TRUE);
+	ofono_modem_set_driver(modem->modem, "gobi");
+
+	return TRUE;
+}
+
 static gboolean setup_sierra(struct modem_info *modem)
 {
 	const char *mdm = NULL, *app = NULL, *net = NULL, *diag = NULL, *qmi = NULL;
@@ -942,6 +987,7 @@ static struct {
 	{ "mbm",	setup_mbm,	"device/interface"	},
 	{ "hso",	setup_hso,	"hsotype"		},
 	{ "gobi",	setup_gobi	},
+	{ "le910",	setup_le910	},
 	{ "sierra",	setup_sierra	},
 	{ "option",	setup_option	},
 	{ "huawei",	setup_huawei	},
-- 
2.11.0


  reply	other threads:[~2017-03-16  9:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 18:35 Telit LE910V1 - LTE only modem Lukasz Nowak
2017-03-16  9:32 ` Piotr Haber
2017-03-16  9:32   ` Piotr Haber [this message]
2017-03-16 12:57   ` Lukasz Nowak
2017-03-20 13:19   ` Lukasz Nowak
2017-03-20 13:32     ` gluedig
2017-03-20 14:39     ` Denis Kenzior
2017-03-20 16:46       ` Lukasz Nowak
2017-03-20 23:39         ` Denis Kenzior
2017-03-21 17:50           ` Lukasz Nowak
2017-03-21 18:57             ` Denis Kenzior
2017-03-22 18:23               ` Lukasz Nowak

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=20170316093204.25275-2-gluedig@gmail.com \
    --to=gluedig@gmail.com \
    --cc=ofono@ofono.org \
    /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