Skip to contentSkip to conversation

support Telit LE910 V2 modem

PATCH Applied Piotr Haber 2 participants 7 messages Jan 27, 2017 – Jan 28, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

cover support Telit LE910 V2 modem

Introduce CDC-NCM driver for Telit modems.
Handle initialization of LE910V2 via udev.
Add model/variant recognition and setup.

Piotr Haber (3):
telitmodem: support for CDC-NCM network adapter
udevng: setup of Telit LE910V2
xe910: support for Telit LE910V2 modem

 Makefile.am                           |   3 +-
 drivers/telitmodem/gprs-context-ncm.c | 485 ++++++++++++++++++++++++++++++++++
 drivers/telitmodem/telitmodem.c       |   2 +
 drivers/telitmodem/telitmodem.h       |   2 +
 plugins/udevng.c                      |  14 +-
 plugins/xe910.c                       |  16 +-
 6 files changed, 516 insertions(+), 6 deletions(-)
 create mode 100644 drivers/telitmodem/gprs-context-ncm.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 telitmodem: support for CDC-NCM network adapter

Network Control Model is a new Communication Device Class protocol for exchanging Ethernet frames over USB. NCM is intended to be used with high-speed network attachments such as HSDPA and LTE data services.

---
 Makefile.am                           |   3 +-
 drivers/telitmodem/gprs-context-ncm.c | 485 ++++++++++++++++++++++++++++++++++
 drivers/telitmodem/telitmodem.c       |   2 +
 drivers/telitmodem/telitmodem.h       |   2 +
 4 files changed, 491 insertions(+), 1 deletion(-)
 create mode 100644 drivers/telitmodem/gprs-context-ncm.c
Makefile.am +2 -1
index 6d134739..560fc1cb 100644
@@ -321,7 +321,8 @@ builtin_modules += telitmodem
 builtin_sources += drivers/atmodem/atutil.h \
 			drivers/telitmodem/telitmodem.h \
 			drivers/telitmodem/telitmodem.c \
-			drivers/telitmodem/location-reporting.c
+			drivers/telitmodem/location-reporting.c \
+			drivers/telitmodem/gprs-context-ncm.c
 
 builtin_modules += hsomodem
 builtin_sources += drivers/atmodem/atutil.h \
drivers/telitmodem/gprs-context-ncm.c new file +485 -0

485 lines not on this page · raw message

drivers/telitmodem/telitmodem.c +2 -0
index ecb84efb..4aa2c444 100644
@@ -35,6 +35,7 @@
 static int telitmodem_init(void)
 {
 	telit_location_reporting_init();
+	telitncm_gprs_context_init();
 
 	return 0;
 }
@@ -42,6 +43,7 @@ static int telitmodem_init(void)
 static void telitmodem_exit(void)
 {
 	telit_location_reporting_exit();
+	telitncm_gprs_context_exit();
 }
 
 OFONO_PLUGIN_DEFINE(telitmodem, "Telit modem driver", VERSION,
drivers/telitmodem/telitmodem.h +2 -0
index 2db41787..8a14595a 100644
@@ -23,3 +23,5 @@
 
 extern void telit_location_reporting_init();
 extern void telit_location_reporting_exit();
+extern void telitncm_gprs_context_init();
+extern void telitncm_gprs_context_exit();
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH 1/3] telitmodem: support for CDC-NCM network adapter

Hi Piotr,

Quoted 4 lines · Piotr Haber

Network Control Model is a new Communication Device Class protocol for exchanging Ethernet frames over USB. NCM is intended to be used with high-speed network attachments such as HSDPA and LTE data services.

Quoted 8 lines
---
 Makefile.am                           |   3 +-
 drivers/telitmodem/gprs-context-ncm.c | 485 ++++++++++++++++++++++++++++++++++
 drivers/telitmodem/telitmodem.c       |   2 +
 drivers/telitmodem/telitmodem.h       |   2 +
 4 files changed, 491 insertions(+), 1 deletion(-)
 create mode 100644 drivers/telitmodem/gprs-context-ncm.c

I went ahead and applied this patch with a couple of small modifications:

<snip>

drivers/telitmodem/gprs-context-ncm.c line 174

Quoted 4 lines
drivers/telitmodem/gprs-context-ncm.c new file +4 -0
+		if ((unsigned int) cid == gcd->active_context) {
+			found = TRUE;
+
+			if (gcd->address && strcmp(gcd->address, "") != 0) {

gcd->address is always true, so this if condition was simplified to simply:
if (strcmp(gcd->address, "") != 0)

drivers/telitmodem/gprs-context-ncm.c line 178

Quoted 4 lines
drivers/telitmodem/gprs-context-ncm.c new file +4 -0
+				strncpy(gcd->netmask,
+					&ip_mask[strlen(gcd->address)+1],
+					sizeof(gcd->netmask));
+			}

I also took out the curly brackets since they are not needed.

drivers/telitmodem/gprs-context-ncm.c line 337

Quoted 3 lines
drivers/telitmodem/gprs-context-ncm.c new file +3 -0
+
+	g_at_chat_send(gcd->chat, "AT+CGATT=0", none_prefix, NULL, NULL, NULL);
+

I took this out. There's no way that gprs context driver should be detaching. Why is this needed anyway?

Regards,
-Denis

#3 lore raw

PATCH 2/3 udevng: setup of Telit LE910V2

In reply to Piotr Haber

Setup LE910V2 in default USB composition (1bc7:0036) with 6 CDC-ACM serial ports and 1 CDC-NCM network adapter.

---
 plugins/udevng.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
plugins/udevng.c +11 -3
index 2f1da62b..098e0651 100644
@@ -656,7 +656,7 @@ static gboolean setup_telit(struct modem_info *modem)
 
 static gboolean setup_xe910(struct modem_info *modem)
 {
-	const char *mdm = NULL, *aux = NULL, *gps = NULL;
+	const char *mdm = NULL, *aux = NULL, *gps = NULL, *net = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
@@ -674,18 +674,24 @@ static gboolean setup_xe910(struct modem_info *modem)
 				aux = info->devnode;
 			else if (g_strcmp0(info->number, "0a") == 0)
 				gps = info->devnode;
+		} else if (info->sysattr && (g_str_has_suffix(info->sysattr,
+						"CDC NCM") == TRUE)) {
+			net = info->devnode;
 		}
 	}
 
 	if (aux == NULL || mdm == NULL)
 		return FALSE;
 
-	DBG("modem=%s aux=%s gps=%s", mdm, aux, gps);
+	DBG("modem=%s aux=%s gps=%s net=%s", mdm, aux, gps, net);
 
 	ofono_modem_set_string(modem->modem, "Modem", mdm);
 	ofono_modem_set_string(modem->modem, "Aux", aux);
 	ofono_modem_set_string(modem->modem, "GPS", gps);
 
+	if (net != NULL)
+		ofono_modem_set_string(modem->modem, "NetworkInterface", net);
+
 	return TRUE;
 }
 
@@ -976,7 +982,7 @@ static struct {
 	{ "novatel",	setup_novatel	},
 	{ "nokia",	setup_nokia	},
 	{ "telit",	setup_telit	},
-	{ "xe910",	setup_xe910	},
+	{ "xe910",	setup_xe910,	"device/interface"	},
 	{ "simcom",	setup_simcom	},
 	{ "zte",	setup_zte	},
 	{ "icera",	setup_icera	},
@@ -1226,6 +1232,8 @@ static struct {
 	{ "gemalto",	"option",	"1e2d",	"0053"	},
 	{ "gemalto",	"cdc_wdm",	"1e2d",	"0053"	},
 	{ "gemalto",	"qmi_wwan",	"1e2d",	"0053"	},
+	{ "xe910",	"cdc_ncm",	"1bc7", "0036"	},
+	{ "xe910",	"cdc_acm",	"1bc7", "0036"	},
 	{ }
 };
 
Signature · 1 line
2.11.0
#4 lore raw

Re: [PATCH 2/3] udevng: setup of Telit LE910V2

Hi Piotr,

Quoted 6 lines · Piotr Haber

Setup LE910V2 in default USB composition (1bc7:0036) with 6 CDC-ACM serial ports and 1 CDC-NCM network adapter.

---
 plugins/udevng.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Applied, thanks.

Regards,
-Denis

#5 lore raw

PATCH 3/3 xe910: support for Telit LE910V2 modem

In reply to Piotr Haber

LE910V2 is next generation Telit LTE modem.
It supports 3GPP Rel. 9 LTE Cat. 4 over multiple bands.

---
 plugins/xe910.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
plugins/xe910.c +14 -2
index 170a6b08..bf40a3de 100644
@@ -64,7 +64,8 @@ static const char *qss_prefix[] = { "#QSS:", NULL };
 
 enum modem_model {
 	HE910 = 1,
-	UE910
+	UE910,
+	LE910
 };
 
 static struct {
@@ -84,6 +85,7 @@ static struct {
 	{ UE910,	NULL,	FALSE,	FALSE },
 	{ UE910,	"EUR",	TRUE,	FALSE },
 	{ UE910,	"NAR",	TRUE,	FALSE },
+	{ LE910,	NULL,	FALSE,	FALSE },
 	{ }
 };
 
@@ -297,6 +299,8 @@ static gboolean find_model_variant(struct ofono_modem *modem,
 		data->model = HE910;
 	else if (g_str_equal(model, "UE910"))
 		data->model = UE910;
+	else if (g_str_equal(model, "LE910"))
+		data->model = LE910;
 	else
 		return FALSE;
 
@@ -385,6 +389,8 @@ static int xe910_enable(struct ofono_modem *modem)
 	 */
 	g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
 				NULL, NULL, NULL);
+	g_at_chat_send(data->modem, "ATE0", none_prefix,
+				NULL, NULL, NULL);
 
 
 	/* Get modem model and variant */
@@ -472,7 +478,13 @@ static void xe910_post_online(struct ofono_modem *modem)
 
 	gprs = ofono_gprs_create(modem, OFONO_VENDOR_TELIT, "atmodem",
 					data->chat);
-	gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
+
+	if (data->model == LE910)
+		gc = ofono_gprs_context_create(modem, OFONO_VENDOR_TELIT,
+						"telitncmmodem", data->modem);
+	else
+		gc = ofono_gprs_context_create(modem, 0, "atmodem",
+						data->modem);
 
 	if (gprs && gc)
 		ofono_gprs_add_context(gprs, gc);
Signature · 1 line
2.11.0
#6 lore raw

Re: [PATCH 3/3] xe910: support for Telit LE910V2 modem

Hi Piotr,

Quoted 6 lines · Piotr Haber

LE910V2 is next generation Telit LTE modem.
It supports 3GPP Rel. 9 LTE Cat. 4 over multiple bands.

---
 plugins/xe910.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Applied, thanks.

Regards,
-Denis