Skip to contentSkip to conversation

xmm7modem: Change in xmm7mode plugin for multiple PDP

PATCH In review Antara Borwankar 2 participants 2 messages Feb 12, 2019 – Feb 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 xmm7modem: Change in xmm7mode plugin for multiple PDP

Made changes in xmm7modem plugin to allow mutiple PDP context activation and to assign correct network interface to the activated PDP context.

---
 plugins/udevng.c  | 15 ++++++++++++++-
 plugins/xmm7xxx.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
plugins/udevng.c +14 -1
index ff6e1fc..ce8cdee 100644
@@ -1179,7 +1179,7 @@ static gboolean setup_gemalto(struct modem_info* modem)
 
 static gboolean setup_xmm7xxx(struct modem_info *modem)
 {
-	const char *mdm = NULL, *net = NULL;
+	const char *mdm = NULL, *net = NULL, *net2 = NULL, *net3 = NULL;
 	GSList *list;
 
 	DBG("%s %s\n", __DATE__, __TIME__);
@@ -1200,6 +1200,10 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
 			} else if (g_strcmp0(info->subsystem, "net") == 0) {
 				if (g_strcmp0(info->number, "06") == 0)
 					net = info->devnode;
+				if (g_strcmp0(info->number, "08") == 0)
+					net2 = info->devnode;
+				if (g_strcmp0(info->number, "0a") == 0)
+					net3 = info->devnode;
 			}
 		} else {
 			if (g_strcmp0(info->subsystem, "tty") == 0) {
@@ -1220,6 +1224,15 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
 	ofono_modem_set_string(modem->modem, "Modem", mdm);
 	ofono_modem_set_string(modem->modem, "NetworkInterface", net);
 
+	if (net2)
+		ofono_modem_set_string(modem->modem, "NetworkInterface2", net2);
+
+	if (net3)
+		ofono_modem_set_string(modem->modem, "NetworkInterface3", net3);
+
+	ofono_modem_set_string(modem->modem, "CtrlPath", "/USBCDC/0");
+	ofono_modem_set_string(modem->modem, "DataPath", "/USBHS/NCM/");
+
 	return TRUE;
 }
 
plugins/xmm7xxx.c +28 -0
index 237c62c..4c02d54 100644
@@ -1269,6 +1269,7 @@ static void xmm7xxx_post_online(struct ofono_modem *modem)
 	struct xmm7xxx_data *data = ofono_modem_get_data(modem);
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
+	const char *interface = NULL;
 
 	DBG("%p", modem);
 
@@ -1282,6 +1283,33 @@ static void xmm7xxx_post_online(struct ofono_modem *modem)
 	if (gprs && gc)
 		ofono_gprs_add_context(gprs, gc);
 
+	interface = ofono_modem_get_string(modem, "NetworkInterface");
+	ofono_gprs_context_set_interface(gc, interface);
+
+	interface = ofono_modem_get_string(modem, "NetworkInterface2");
+
+	if (interface) {
+		gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM, "ifxmodem",
+					data->chat);
+
+		if (gprs && gc)
+			ofono_gprs_add_context(gprs, gc);
+
+		ofono_gprs_context_set_interface(gc, interface);
+	}
+
+	interface = ofono_modem_get_string(modem, "NetworkInterface3");
+
+	if (interface) {
+		gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM, "ifxmodem",
+					data->chat);
+
+		if (gprs && gc)
+			ofono_gprs_add_context(gprs, gc);
+
+		ofono_gprs_context_set_interface(gc, interface);
+	}
+
 	ofono_ims_create(modem, "xmm7modem", data->chat);
 	ofono_netmon_create(modem, 0, "xmm7modem", data->chat);
 }
Signature · 1 line
1.9.1
#1 lore raw

Hi Antara,

Quoted 8 lines · Antara Borwankar

Made changes in xmm7modem plugin to allow mutiple PDP context activation and to assign correct network interface to the activated PDP context.

---
  plugins/udevng.c  | 15 ++++++++++++++-
  plugins/xmm7xxx.c | 28 ++++++++++++++++++++++++++++
  2 files changed, 42 insertions(+), 1 deletion(-)

I split this patch up into two commits, and applied. I did tweak a few things, see below:

Quoted 41 lines
plugins/udevng.c +14 -1
index ff6e1fc..ce8cdee 100644
@@ -1179,7 +1179,7 @@ static gboolean setup_gemalto(struct modem_info* modem)
 
  static gboolean setup_xmm7xxx(struct modem_info *modem)
  {
-	const char *mdm = NULL, *net = NULL;
+	const char *mdm = NULL, *net = NULL, *net2 = NULL, *net3 = NULL;
  	GSList *list;
 
  	DBG("%s %s\n", __DATE__, __TIME__);
@@ -1200,6 +1200,10 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
  			} else if (g_strcmp0(info->subsystem, "net") == 0) {
  				if (g_strcmp0(info->number, "06") == 0)
  					net = info->devnode;
+				if (g_strcmp0(info->number, "08") == 0)
+					net2 = info->devnode;
+				if (g_strcmp0(info->number, "0a") == 0)
+					net3 = info->devnode;
  			}
  		} else {
  			if (g_strcmp0(info->subsystem, "tty") == 0) {
@@ -1220,6 +1224,15 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
  	ofono_modem_set_string(modem->modem, "Modem", mdm);
  	ofono_modem_set_string(modem->modem, "NetworkInterface", net);
 
+	if (net2)
+		ofono_modem_set_string(modem->modem, "NetworkInterface2", net2);
+
+	if (net3)
+		ofono_modem_set_string(modem->modem, "NetworkInterface3", net3);
+
+	ofono_modem_set_string(modem->modem, "CtrlPath", "/USBCDC/0");
+	ofono_modem_set_string(modem->modem, "DataPath", "/USBHS/NCM/");
+
  	return TRUE;
  }
 

plugins/udevng.c static void xmm7xxx_post_online(struct ofono_modem *modem) · line 1287

Quoted 5 lines
plugins/udevng.c +2 -0
@@ -1282,6 +1283,33 @@ static void xmm7xxx_post_online(struct ofono_modem *modem)
  	if (gprs && gc)
  		ofono_gprs_add_context(gprs, gc);
 
+	interface = ofono_modem_get_string(modem, "NetworkInterface");
+	ofono_gprs_context_set_interface(gc, interface);

Since ofono_gprs_context_set_interface doesn't perform NULL check on gc, I put this and other instances behind the if (gprs && gc) statement

Regards,
-Denis