[PATCH 2/3] ifxmodem: integration of kernel mux (n_gsm)
by Lucas, GuillaumeX
From: Guillaume Lucas <guillaumex.lucas(a)intel.com>
---
drivers/ifxmodem/gprs-context.c | 95 +++++++++++++++++++++++++++++++++++++--
1 files changed, 91 insertions(+), 4 deletions(-)
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 2c68b44..0d133f9 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -29,6 +29,11 @@
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <arpa/inet.h>
+#include <linux/if_ether.h>
+#include <linux/gsmmux.h>
#include <glib.h>
@@ -63,6 +68,7 @@ struct gprs_context_data {
char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
GAtRawIP *rawip;
+ gboolean use_ofono_mux;
enum state state;
char address[32];
char dns1[32];
@@ -79,7 +85,46 @@ static void rawip_debug(const char *str, void *data)
ofono_info("%s: %s", (const char *) data, str);
}
-static const char *setup_rawip(struct ofono_gprs_context *gc)
+static const char *setup_rawip_kmux(struct ofono_gprs_context *gc)
+{
+ struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ struct gsm_netconfig netconfig;
+ int fd;
+ int n;
+ char *interface = NULL;
+ char ifname[IFNAMSIZ];
+
+ memset(&netconfig, 0, sizeof(struct gsm_netconfig));
+ gcd->rawip = NULL;
+
+ fd = g_io_channel_unix_get_fd(g_at_chat_get_channel(gcd->chat));
+
+ g_at_chat_suspend(gcd->chat);
+
+ netconfig.adaption = 3;
+ netconfig.protocol = htons(ETH_P_IP);
+
+ n = ioctl(fd, GSMIOC_ENABLE_NET, &netconfig);
+ if (n < 0) {
+ ofono_error("Cannot enable network on the mux: %d", n);
+ return NULL;
+ }
+
+ ofono_info("Net index: %d", n);
+
+ interface = if_indextoname(n, ifname);
+ if (interface == NULL) {
+ ofono_error("Interface index %d error %d error msg %s", n,
+ errno, strerror(errno));
+ return NULL;
+ }
+
+ ofono_info("Interface name: %s", interface);
+
+ return interface;
+}
+
+static const char *setup_rawip_internal(struct ofono_gprs_context *gc)
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
GAtIO *io;
@@ -153,7 +198,14 @@ static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
dns[1] = gcd->dns2;
dns[2] = 0;
- interface = setup_rawip(gc);
+ if (gcd->use_ofono_mux == FALSE) {
+ ofono_info("Calling setup_rawip_kmux()");
+ interface = setup_rawip_kmux(gc);
+ } else {
+ ofono_info("Calling setup_rawip_internal()");
+ interface = setup_rawip_internal(gc);
+ }
+
if (interface == NULL)
interface = "invalid";
@@ -352,7 +404,9 @@ static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
DBG("ok %d", ok);
- g_at_rawip_unref(gcd->rawip);
+ if (gcd->rawip)
+ g_at_rawip_unref(gcd->rawip);
+
gcd->rawip = NULL;
gcd->active_context = 0;
@@ -370,6 +424,8 @@ static void ifx_gprs_deactivate_primary(struct ofono_gprs_context *gc,
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
GAtChat *chat = g_at_chat_get_slave(gcd->chat);
char buf[64];
+ int fd;
+ int n;
DBG("cid %u", cid);
@@ -377,7 +433,14 @@ static void ifx_gprs_deactivate_primary(struct ofono_gprs_context *gc,
gcd->down_cb = cb;
gcd->cb_data = data;
- g_at_rawip_shutdown(gcd->rawip);
+ if (gcd->rawip)
+ g_at_rawip_shutdown(gcd->rawip);
+
+ fd = g_io_channel_unix_get_fd(g_at_chat_get_channel(gcd->chat));
+
+ n = ioctl(fd, GSMIOC_DISABLE_NET, NULL);
+ if (n < 0)
+ ofono_error("Cannot disable network on the mux: %d", n);
sprintf(buf, "AT+CGACT=0,%u", gcd->active_context);
if (g_at_chat_send(chat, buf, none_prefix,
@@ -394,6 +457,8 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
const char *event;
int cid;
GAtResultIter iter;
+ int fd;
+ int n;
g_at_result_iter_init(&iter, result);
@@ -424,6 +489,14 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
gcd->rawip = NULL;
}
+ if (gcd->use_ofono_mux == FALSE) {
+ fd = g_io_channel_unix_get_fd(g_at_chat_get_channel(gcd->chat));
+
+ n = ioctl(fd, GSMIOC_DISABLE_NET, NULL);
+ if (n < 0)
+ ofono_error("Cannot disable network on the mux: %d", n);
+ }
+
ofono_gprs_context_deactivated(gc, gcd->active_context);
gcd->active_context = 0;
@@ -436,7 +509,9 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
unsigned int vendor, void *data)
{
GAtChat *chat = data;
+ const char *ldisc;
struct gprs_context_data *gcd;
+ struct ofono_modem *modem;
struct stat st;
DBG("");
@@ -455,6 +530,18 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
gcd->chat = g_at_chat_clone(chat);
+ modem = ofono_gprs_context_get_modem(gc);
+ ldisc = ofono_modem_get_string(modem, "LineDiscipline");
+
+ ofono_info("Got LineDiscipline variable from udev: %s", ldisc);
+ if (ldisc != NULL) {
+ ofono_info("setting up to use kernel mux for data");
+ gcd->use_ofono_mux = FALSE;
+ } else {
+ ofono_info("setting up to use user space mux for data");
+ gcd->use_ofono_mux = TRUE;
+ }
+
ofono_gprs_context_set_data(gc, gcd);
chat = g_at_chat_get_slave(gcd->chat);
--
1.6.3.3
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH 0/3] integration of kernel mux (n_gsm) and its line discipline
by Lucas, GuillaumeX
Hi,
Following set of patch adds support of the kernel mux (n_gsm) for the ifx modem.
They were tested with the latest version of the kernel mux who is currently under submission.
Following tests were performed (and pass):
- PDP context activation/deactivation back-to-back (x15)
- Enable/disable modem back-to-back (x10)
- PDP context activation with wrong APN
- Lost of network connection during PDP context activation
- Lost of network connection with a PDP context activated
Regards,
Guillaume
---
plugins/ifx.c | 83 ++++++++++++++++++++++++++++++++++++++++++++------------
drivers/ifxmodem/gprs-context.c | 95 +++++++++++++++++++++++++++++++++++++--
2 files changed, 169 insertions(+), 23 deletions(-)
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
Ofono for DUN connectivity
by Vijay Chavan (RBEI/ECV1)
Hello All,
I am new to Ofono, wanted to know if there is any client project using ofono service.
Which can be used as reference for making my own Application using ofono servies.
I am interested in gettting DUN internet connectivity via a mobile phone using ofono.
I found http://lists.ofono.org/pipermail/ofono/2010-April/002012.html thread with prototype implementation of DUN modem plugin with Ofono.
Is this a complete implementation for DUN modem or any other way of implementing DUN client in Meego??
Thanks in advance...
Regards,
Vijay
11 years, 3 months
[PATCH] test/test-message-waiting: Add a new test file to validate org.ofono.MessageWaiting
by Bertrand Aygon
---
test/test-message-waiting | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
create mode 100755 test/test-message-waiting
diff --git a/test/test-message-waiting b/test/test-message-waiting
new file mode 100755
index 0000000..79fe810
--- /dev/null
+++ b/test/test-message-waiting
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+import gobject
+import sys
+import dbus
+import dbus.mainloop.glib
+
+def mw_property_changed(name, value):
+ if name == 'VoicemailMessageCount':
+ print "MessageWaiting property: '%s' changed to '%d'" % (name, value)
+ else:
+ print "MessageWaiting property: '%s' changed to '%s'" % (name, value)
+
+if __name__ == "__main__":
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+
+ modems = manager.GetModems()
+
+ mw = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
+ 'org.ofono.MessageWaiting')
+
+ mw.connect_to_signal("PropertyChanged", mw_property_changed)
+
+ properties = mw.GetProperties()
+
+ print "Voicemail waiting: %s" % (properties['VoicemailWaiting'])
+ print "Voicemail message count: %d" % (properties['VoicemailMessageCount'])
+ print "Voicemail mailbox number: %s" % (properties['VoicemailMailboxNumber'])
+
+ mainloop = gobject.MainLoop()
+ mainloop.run()
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH] test/test-modem: display more properties (Name, Online, Lockdown...)
by Bertrand Aygon
---
test/test-modem | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/test/test-modem b/test/test-modem
index 5859ae3..c1eeedf 100755
--- a/test/test-modem
+++ b/test/test-modem
@@ -24,6 +24,9 @@ if __name__ == "__main__":
properties = modem.GetProperties()
+ if properties.has_key('Name'):
+ print "Name: %s" % (properties['Name'])
+
if properties.has_key('Manufacturer'):
print "Manufacturer: %s" % (properties['Manufacturer'])
@@ -36,5 +39,27 @@ if __name__ == "__main__":
if properties.has_key('Serial'):
print "Serial: %s" % (properties['Serial'])
+ if properties.has_key('Powered'):
+ print "Powered: %s" % (properties['Powered'])
+
+ if properties.has_key('Online'):
+ print "Online: %s" % (properties['Online'])
+
+ if properties.has_key('Lockdown'):
+ print "Lockdown: %s" % (properties['Lockdown'])
+
+ if properties.has_key('Emergency'):
+ print "Emergency: %s" % (properties['Emergency'])
+
+ if properties.has_key('Features'):
+ print "Features:"
+ for feature in properties["Features"]:
+ print " [ %s ]" % (feature)
+
+ if properties.has_key('Interfaces'):
+ print "Interfaces:"
+ for interface in properties["Interfaces"]:
+ print " [ %s ]" % (interface)
+
mainloop = gobject.MainLoop()
mainloop.run()
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH] Doc: typo
by Bertrand Aygon
---
doc/radio-settings-api.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/radio-settings-api.txt b/doc/radio-settings-api.txt
index 06c35a9..9f9256f 100644
--- a/doc/radio-settings-api.txt
+++ b/doc/radio-settings-api.txt
@@ -49,7 +49,7 @@ Properties string TechnologyPreference [readwrite]
Frequency band in which the modem is allowed to
operate when using "gsm" mode. Setting this property
- has an imediate effect on modem only if
+ has an immediate effect on modem only if
TechnologyPreference is set to "gsm" or "any".
Otherwise the value is kept and applied whenever modem
uses this mode.
@@ -69,7 +69,7 @@ Properties string TechnologyPreference [readwrite]
Frequency band in which the modem is allowed to
operate when using "umts" mode. Setting this property
- has an imediate effect on modem only if
+ has an immediate effect on modem only if
TechnologyPreference is set to "umts" or "any".
Otherwise the value is kept and applied whenever modem
uses this mode.
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH] Doc: typo
by Bertrand Aygon
---
doc/radio-settings-api.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/doc/radio-settings-api.txt b/doc/radio-settings-api.txt
index d2dd319..06c35a9 100644
--- a/doc/radio-settings-api.txt
+++ b/doc/radio-settings-api.txt
@@ -43,7 +43,7 @@ Properties string TechnologyPreference [readwrite]
availability.
"gsm" Only GSM used for radio access.
"umts" Only UMTS used for radio access.
- "lte" Only LTE used for radio acccess.
+ "lte" Only LTE used for radio access.
string GsmBand [readwrite, optional]
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH] Fix usage of test/test-call-settings: add missing properties
by Bertrand Aygon
---
test/test-call-settings | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/test-call-settings b/test/test-call-settings
index 187b405..97cec86 100755
--- a/test/test-call-settings
+++ b/test/test-call-settings
@@ -15,7 +15,10 @@ def property_changed(name, value):
if __name__ == "__main__":
if len(sys.argv) < 3:
print "Usage: %s [modem] <property> <newvalue>" % (sys.argv[0])
- print "Properties can be: VoiceCallWaiting, HideCallerId"
+ print "Properties can be: VoiceCallWaiting,"
+ print " ConnectedLineRestriction, CallingLineRestriction,"
+ print " CallingLinePresentation, CalledLinePresentation,"
+ print " ConnectedLinePresentation, HideCallerId"
sys.exit(1)
canexit = False
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH] Add the possibility to specify the modem in test/test-call-settings
by Bertrand Aygon
---
test/test-call-settings | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/test/test-call-settings b/test/test-call-settings
index f31fd1a..187b405 100755
--- a/test/test-call-settings
+++ b/test/test-call-settings
@@ -14,15 +14,12 @@ def property_changed(name, value):
if __name__ == "__main__":
if len(sys.argv) < 3:
- print "Usage: %s <property> <newvalue>" % (sys.argv[0])
+ print "Usage: %s [modem] <property> <newvalue>" % (sys.argv[0])
print "Properties can be: VoiceCallWaiting, HideCallerId"
sys.exit(1)
canexit = False
- property = sys.argv[1]
- newvalue = sys.argv[2]
-
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
@@ -31,8 +28,18 @@ if __name__ == "__main__":
'org.ofono.Manager')
modems = manager.GetModems()
-
- cs = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
+ modem = modems[0][0]
+
+ if (len(sys.argv) == 4):
+ modem = sys.argv[1]
+ property = sys.argv[2]
+ newvalue = sys.argv[3]
+ else:
+ property = sys.argv[1]
+ newvalue = sys.argv[2]
+ print "Using modem %s" % modem
+
+ cs = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.CallSettings')
cs.connect_to_signal("PropertyChanged", property_changed)
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH] Allow test/test-call-settings to exit if new value is equal to actual value
by Bertrand Aygon
---
test/test-call-settings | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/test/test-call-settings b/test/test-call-settings
index f49ad0b..f31fd1a 100755
--- a/test/test-call-settings
+++ b/test/test-call-settings
@@ -62,6 +62,10 @@ if __name__ == "__main__":
print "Setting successful"
+ if (properties[property] == newvalue):
+ print "Setting was already set to this value"
+ sys.exit(1);
+
canexit = True
mainloop = gobject.MainLoop()
--
1.7.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months