summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-09-18 22:08:41 +0900
committerMarcel Holtmann <marcel@holtmann.org>2010-09-18 22:08:41 +0900
commit3443a7a177fbaca24c84658968aff0a55db8a51d (patch)
tree25dbb53359752bc116c2a7fc0faab220c011a4a0
parent315cfd4217b390de5cc7fdaafe531c06ac27e671 (diff)
downloadofono-3443a7a177fbaca24c84658968aff0a55db8a51d.tar.bz2
udev: Add support for IFX device detection
The IFX device detection is pretty static, but instead of using a static configuration file it is important to know when the device node is actually present. For this udev is perfect. Adding a simple udev rule is all that it takes: KERNEL=="ttyIFX[0-9]*", ENV{OFONO_DRIVER}="ifx" With this rule for every TTY with the kernel name like ttyIFX0, a new modem will be added and the IFX modem plugin driver requested for it.
-rw-r--r--plugins/udev.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/udev.c b/plugins/udev.c
index 38a63127..51366a69 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -210,6 +210,19 @@ static void add_hso(struct ofono_modem *modem,
}
}
+static void add_ifx(struct ofono_modem *modem,
+ struct udev_device *udev_device)
+{
+ const char *devnode;
+
+ DBG("modem %p", modem);
+
+ devnode = udev_device_get_devnode(udev_device);
+ ofono_modem_set_string(modem, "Device", devnode);
+
+ ofono_modem_register(modem);
+}
+
static void add_zte(struct ofono_modem *modem,
struct udev_device *udev_device)
{
@@ -399,6 +412,23 @@ static void add_modem(struct udev_device *udev_device)
struct udev_device *parent;
const char *devpath, *curpath, *driver;
+ driver = get_driver(udev_device);
+ if (driver != NULL) {
+ devpath = udev_device_get_devpath(udev_device);
+ if (devpath == NULL)
+ return;
+
+ modem = ofono_modem_create(NULL, driver);
+ if (modem == NULL)
+ return;
+
+ ofono_modem_set_string(modem, "Path", devpath);
+
+ modem_list = g_slist_prepend(modem_list, modem);
+
+ goto done;
+ }
+
parent = udev_device_get_parent(udev_device);
if (parent == NULL)
return;
@@ -433,6 +463,7 @@ static void add_modem(struct udev_device *udev_device)
modem_list = g_slist_prepend(modem_list, modem);
}
+done:
curpath = udev_device_get_devpath(udev_device);
if (curpath == NULL)
return;
@@ -445,6 +476,8 @@ static void add_modem(struct udev_device *udev_device)
add_mbm(modem, udev_device);
else if (g_strcmp0(driver, "hso") == 0)
add_hso(modem, udev_device);
+ else if (g_strcmp0(driver, "ifx") == 0)
+ add_ifx(modem, udev_device);
else if (g_strcmp0(driver, "zte") == 0)
add_zte(modem, udev_device);
else if (g_strcmp0(driver, "huawei") == 0)