xmm7modem: data channel setup for xmm7modem
PATCH 1/1 xmm7modem: data channel setup for xmm7modem
Added the implementation required to setup data channel in ifxmodem gprs-context driver for xmm7modem vendor
--- drivers/ifxmodem/gprs-context.c | 51 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-)
drivers/ifxmodem/gprs-context.c +47 -4
@@ -260,6 +260,36 @@ error:failed_setup (gc,NULL , TRUE); } +static void cgdata_cb (gboolean ok,GAtResult *result,gpointer user_data) +{ +struct ofono_gprs_context *gc = user_data; +struct gprs_context_data *gcd =ofono_gprs_context_get_data (gc); + +DBG ("ok %d" , ok); + +if (!ok) { +ofono_error ("Failed to establish session" ); +failed_setup (gc, result, TRUE); +return ; + } + +CALLBACK_WITH_SUCCESS (gcd->cb, gcd->cb_data); +} + +static void get_datapath (struct ofono_modem *modem,const char *interface, +char * datapath) +{ +if (!datapath) +return ; + +if (!strcmp (interface,ofono_modem_get_string (modem,"NetworkInterface" ))) +sprintf (datapath,"%s0" ,ofono_modem_get_string (modem,"DataPath" )); +else if (!strcmp (interface,ofono_modem_get_string (modem,"NetworkInterface2" ))) +sprintf (datapath,"%s1" ,ofono_modem_get_string (modem,"DataPath" )); +else if (!strcmp (interface,ofono_modem_get_string (modem,"NetworkInterface3" ))) +sprintf (datapath,"%s2" ,ofono_modem_get_string (modem,"DataPath" )); +} +static void cgcontrdp_cb (gboolean ok,GAtResult *result,gpointer user_data) {struct ofono_gprs_context *gc = user_data;
@@ -269,8 +299,11 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)const char *laddrnetmask =NULL ;const char *gw =NULL ; -const char *interface;const char *dns[3 ]; +const char *ctrlpath; +char datapath[50 ]; +char buf[100 ]; +const char *interface;DBG ("ok %d" , ok);
@@ -327,9 +360,10 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)DBG ("DNS2: %s\n" , gcd->dns2);DBG ("Gateway: %s\n" , gcd->gateway); - interface =ofono_modem_get_string (modem,"NetworkInterface" ); + ctrlpath =ofono_modem_get_string (modem,"CtrlPath" ); + interface =ofono_gprs_context_get_interface (gc); +get_datapath (modem, interface, datapath); -ofono_gprs_context_set_interface (gc, interface);ofono_gprs_context_set_ipv4_address (gc, gcd->address, TRUE);if (gcd->netmask[0 ])
@@ -340,7 +374,16 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)ofono_gprs_context_set_ipv4_dns_servers (gc, dns); -CALLBACK_WITH_SUCCESS (gcd->cb, gcd->cb_data); +sprintf (buf,"AT+XDATACHANNEL=1,1,\"%s\",\"%s\",2,%u" , ctrlpath, + datapath, 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); + +if (g_at_chat_send (gcd->chat, buf, none_prefix, cgdata_cb, + gc,NULL ) >0 ) +return ; + +CALLBACK_WITH_FAILURE (gcd->cb, gcd->cb_data); }static void ifx_read_settings (struct ofono_gprs_context *gc)
Signature · 1 line
1.9.1
Hi Antara,
Quoted 6 lines · Antara Borwankar
Added the implementation required to setup data channel in ifxmodem gprs-context driver for xmm7modem vendor
--- drivers/ifxmodem/gprs-context.c | 51 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-)
Yes, this approach was much simpler and more understandable than what I came up with. So applied, thanks!
I did push a follow-up commit that refactored things slightly, mostly to address style issues. Please review and make sure I didn't screw anything up.
Regards,
-Denis