summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2010-10-04 15:11:05 +0200
committerAki Niemi <aki.niemi@nokia.com>2010-10-07 15:30:04 +0300
commitf0ba01543a95bee0c5a3a5fe0eca8ffbaa49d9a6 (patch)
tree6099c1af10988fc2eb725cc124b2f44dce75a4d7 /plugins
parentf8f93c34a8a81798bb0b1bf015f5704d1950d5fd (diff)
downloadofono-f0ba01543a95bee0c5a3a5fe0eca8ffbaa49d9a6.tar.gz
udev: refactor add_isi
Gather OFONO_ISI_ADDRESS from same udev device node as OFONO_DRIVER.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/udev.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/plugins/udev.c b/plugins/udev.c
index 7f6201a2..737a6370 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -423,19 +423,29 @@ static void add_nokia(struct ofono_modem *modem,
static void add_isi(struct ofono_modem *modem,
struct udev_device *udev_device)
{
- const char *ifname, *addr;
+ const char *ifname, *type, *addr;
DBG("modem %p", modem);
- ifname = udev_device_get_sysname(udev_device);
- ofono_modem_set_string(modem, "Interface", ifname);
-
- DBG("interface %s", ifname);
+ if (ofono_modem_get_string(modem, "Interface"))
+ return;
addr = get_property(udev_device, "OFONO_ISI_ADDRESS");
if (addr != NULL)
ofono_modem_set_integer(modem, "Address", atoi(addr));
+ if (g_strcmp0(udev_device_get_subsystem(udev_device), "net") != 0)
+ return;
+
+ type = udev_device_get_sysattr_value(udev_device, "type");
+ if (g_strcmp0(type, "820") != 0)
+ return;
+
+ ifname = udev_device_get_sysname(udev_device);
+ ofono_modem_set_string(modem, "Interface", ifname);
+
+ DBG("interface %s", ifname);
+
ofono_modem_register(modem);
}