Skip to contentSkip to conversation

plugin: add plugin for Linktop/Teracom LW273 data card

PATCH New Amit Mendapara 1 participant 1 message Feb 4, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 plugin: add plugin for Linktop/Teracom LW273 data card

---
 Makefile.am         |    3 +
 plugins/linktop.c   |  357 +++++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/ofono.rules |    3 +
 plugins/udev.c      |   32 +++++
 4 files changed, 395 insertions(+), 0 deletions(-)
 create mode 100644 plugins/linktop.c
Makefile.am +3 -0
index 758fb10..2fb8962 100644
@@ -314,6 +314,9 @@ builtin_sources += plugins/nokia.c
 builtin_modules += nokiacdma
 builtin_sources += plugins/nokiacdma.c
 
+builtin_modules += linktop
+builtin_sources += plugins/linktop.c
+
 if BLUETOOTH
 builtin_modules += bluetooth
 builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
plugins/linktop.c new file +357 -0

357 lines not on this page · raw message

plugins/ofono.rules +3 -0
index 111f071..c7a77fe 100644
@@ -451,4 +451,7 @@ ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0623", ENV{OFONO_DRIVER}="nokia"
 ATTRS{idVendor}=="0421", ATTRS{idProduct}=="023e", ENV{OFONO_DRIVER}="nokiacdma"
 ATTRS{idVendor}=="0421", ATTRS{idProduct}=="00b6", ENV{OFONO_DRIVER}="nokiacdma"
 
++# Teracom (Linktop/273) 3G Data Card
++ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", ENV{OFONO_DRIVER}="linktop"
+
 LABEL="ofono_end"
plugins/udev.c +32 -0
index ce1efe6..84478d7 100644
@@ -552,6 +552,36 @@ static void add_nokiacdma(struct ofono_modem *modem,
 	ofono_modem_register(modem);
 }
 
+static void add_linktop(struct ofono_modem *modem,
+					struct udev_device *udev_device)
+{
+	const char *devnode, *intfnum;
+	struct udev_device *parent;
+	int registered;
+
+	DBG("modem %p", modem);
+
+	registered = ofono_modem_get_integer(modem, "Registered");
+	if (registered != 0)
+		return;
+
+	parent = udev_device_get_parent(udev_device);
+	intfnum = udev_device_get_sysattr_value(parent, "bInterfaceNumber");
+
+	DBG("intfnum %s", intfnum);
+
+	if (g_strcmp0(intfnum, "01") == 0) {
+		devnode = udev_device_get_devnode(udev_device);
+		ofono_modem_set_string(modem, "Modem", devnode);
+	} else if (g_strcmp0(intfnum, "03") == 0) {
+		devnode = udev_device_get_devnode(udev_device);
+		ofono_modem_set_string(modem, "Control", devnode);
+
+		ofono_modem_set_integer(modem, "Registered", 1);
+		ofono_modem_register(modem);
+	}
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
 	struct ofono_modem *modem;
@@ -646,6 +676,8 @@ done:
 		add_tc65(modem, udev_device);
 	else if (g_strcmp0(driver, "nokiacdma") == 0)
 		add_nokiacdma(modem, udev_device);
+        else if (g_strcmp0(driver, "linktop") == 0)
+		add_linktop(modem, udev_device);
 }
 
 static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data)
Signature · 1 line
1.7.1