Skip to contentSkip to conversation

xmm7modem: chnage to assign datapath for activated PDP context

PATCH In review Antara Borwankar 2 participants 2 messages Jan 31, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 xmm7modem: chnage to assign datapath for activated PDP context

Changed the handling of CGCONTRDP AT command reply in ifxmodem modem driver for XMM7MODEM vendor for assigning network interface to context settings and routing data over the selected path.

---
 drivers/ifxmodem/gprs-context.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/ifxmodem/gprs-context.c +14 -1
index 7f3628b..6cadb47 100644
@@ -271,6 +271,9 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	const char *gw = NULL;
 	const char *interface;
 	const char *dns[3];
+	const char *ctrlpath;
+	const char *datapath;
+	char buf[64];
 
 	DBG("ok %d", ok);
 
@@ -328,8 +331,9 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	DBG("Gateway: %s\n", gcd->gateway);
 
 	interface = ofono_modem_get_string(modem, "NetworkInterface");
+	ctrlpath = ofono_modem_get_string(modem, "CtrlPath");
+	datapath = ofono_modem_get_string(modem, "DataPath");
 
-	ofono_gprs_context_set_interface(gc, interface);
 	ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
 
 	if (gcd->netmask[0])
@@ -340,6 +344,15 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
 
 	ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
 
+	sprintf(buf, "AT+XDATACHANNEL=1,1,\"%s\",\"%s%u\",2,%u", ctrlpath,
+				datapath, gcd->active_context, gcd->active_context);
+	g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+	sprintf(buf, "AT+CGDATA=\"M-RAW_IP\",%u", gcd->active_context);
+	g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+
+	sprintf(buf, "%s\b%u", interface, gcd->active_context);
+	ofono_gprs_context_set_interface(gc, buf);
+
 	CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
 }
 
Signature · 1 line
1.9.1
#1 lore raw

Hi Antara,

Quoted 33 lines · Antara Borwankar

Changed the handling of CGCONTRDP AT command reply in ifxmodem modem driver for XMM7MODEM vendor for assigning network interface to context settings and routing data over the selected path.

---
  drivers/ifxmodem/gprs-context.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
drivers/ifxmodem/gprs-context.c +5 -1
index 7f3628b..6cadb47 100644
@@ -271,6 +271,9 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
  	const char *gw = NULL;
  	const char *interface;
  	const char *dns[3];
+	const char *ctrlpath;
+	const char *datapath;
+	char buf[64];
 
  	DBG("ok %d", ok);
 
@@ -328,8 +331,9 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
  	DBG("Gateway: %s\n", gcd->gateway);
 
  	interface = ofono_modem_get_string(modem, "NetworkInterface");
+	ctrlpath = ofono_modem_get_string(modem, "CtrlPath");
+	datapath = ofono_modem_get_string(modem, "DataPath");
 
-	ofono_gprs_context_set_interface(gc, interface);
  	ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
 
  	if (gcd->netmask[0])

drivers/ifxmodem/gprs-context.c static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data) · line 353

Quoted 10 lines
drivers/ifxmodem/gprs-context.c +7 -0
@@ -340,6 +344,15 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
 
  	ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
 
+	sprintf(buf, "AT+XDATACHANNEL=1,1,\"%s\",\"%s%u\",2,%u", ctrlpath,
+				datapath, gcd->active_context, gcd->active_context);
+	g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+	sprintf(buf, "AT+CGDATA=\"M-RAW_IP\",%u", gcd->active_context);
+	g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+
+	sprintf(buf, "%s\b%u", interface, gcd->active_context);

I'd have to look up the standard, but isn't using backspace like this is a bit dangerous. E.g. won't the results possibly vary depending on the terminal set?

If there are multiple interfaces, why aren't they detected by udevng? I think you need to provide a more detailed explanation of what is actually happening here...

drivers/ifxmodem/gprs-context.c static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data) · line 358

Quoted 2 lines
drivers/ifxmodem/gprs-context.c +1 -0
+	ofono_gprs_context_set_interface(gc, buf);
 

Regards,
-Denis