summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-07-22 18:08:47 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-07-22 18:08:47 +0200
commite9ff0aabfaacfa0ef5b3ed65c9023a29d9b12001 (patch)
tree6703e5ba5a867a041b40a051fee5bc7ca2bd03ff
parentf2955f4fe56c5411e62350599739fd3dd805b1b3 (diff)
downloadconnman-e9ff0aabfaacfa0ef5b3ed65c9023a29d9b12001.tar.gz
connman-e9ff0aabfaacfa0ef5b3ed65c9023a29d9b12001.tar.bz2
connman-e9ff0aabfaacfa0ef5b3ed65c9023a29d9b12001.zip
Fix WiMAX device detection handling
-rw-r--r--src/inet.c4
-rw-r--r--src/udev-compat.c20
-rw-r--r--src/udev.c30
3 files changed, 47 insertions, 7 deletions
diff --git a/src/inet.c b/src/inet.c
index 69c01ec9..3fc162c6 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -336,9 +336,9 @@ enum connman_device_type __connman_inet_get_device_type(int index)
else if (g_str_has_prefix(devname, "bnep") == TRUE)
devtype = CONNMAN_DEVICE_TYPE_UNKNOWN;
else if (g_str_has_prefix(devname, "wmx") == TRUE)
- devtype = CONNMAN_DEVICE_TYPE_UNKNOWN;
+ devtype = CONNMAN_DEVICE_TYPE_WIMAX;
else if (stat(wimax_path, &st) == 0 && (st.st_mode & S_IFDIR))
- devtype = CONNMAN_DEVICE_TYPE_UNKNOWN;
+ devtype = CONNMAN_DEVICE_TYPE_WIMAX;
else if (stat(bridge_path, &st) == 0 && (st.st_mode & S_IFDIR))
devtype = CONNMAN_DEVICE_TYPE_UNKNOWN;
else if (ioctl(sk, SIOCGIWNAME, &iwr) == 0)
diff --git a/src/udev-compat.c b/src/udev-compat.c
index 42309847..270d3ca7 100644
--- a/src/udev-compat.c
+++ b/src/udev-compat.c
@@ -47,9 +47,29 @@ static void detect_newlink(unsigned short type, int index,
unsigned flags, unsigned change)
{
struct connman_device *device;
+ enum connman_device_type devtype;
DBG("type %d index %d", type, index);
+ devtype = __connman_inet_get_device_type(index);
+
+ switch (devtype) {
+ case CONNMAN_DEVICE_TYPE_UNKNOWN:
+ case CONNMAN_DEVICE_TYPE_VENDOR:
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ case CONNMAN_DEVICE_TYPE_BLUETOOTH:
+ case CONNMAN_DEVICE_TYPE_GPS:
+ case CONNMAN_DEVICE_TYPE_NOZOMI:
+ case CONNMAN_DEVICE_TYPE_HUAWEI:
+ case CONNMAN_DEVICE_TYPE_NOVATEL:
+ return;
+ case CONNMAN_DEVICE_TYPE_ETHERNET:
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ case CONNMAN_DEVICE_TYPE_MBM:
+ case CONNMAN_DEVICE_TYPE_HSO:
+ break;
+ }
+
device = find_device(index);
if (device != NULL)
return;
diff --git a/src/udev.c b/src/udev.c
index 760760bf..dc084c16 100644
--- a/src/udev.c
+++ b/src/udev.c
@@ -73,15 +73,16 @@ static struct connman_device *find_device(int index)
static void add_device(struct udev_device *udev_device)
{
- struct connman_device *device;
struct udev_list_entry *entry;
- const char *type;
+ struct connman_device *device;
+ enum connman_device_type devtype;
+ const char *systype;
int index = -1;
DBG("");
- type = udev_device_get_sysattr_value(udev_device, "type");
- if (type == NULL || atoi(type) != 1)
+ systype = udev_device_get_sysattr_value(udev_device, "type");
+ if (systype == NULL || atoi(systype) != 1)
return;
entry = udev_device_get_properties_list_entry(udev_device);
@@ -100,6 +101,25 @@ static void add_device(struct udev_device *udev_device)
if (index < 0)
return;
+ devtype = __connman_inet_get_device_type(index);
+
+ switch (devtype) {
+ case CONNMAN_DEVICE_TYPE_UNKNOWN:
+ case CONNMAN_DEVICE_TYPE_VENDOR:
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ case CONNMAN_DEVICE_TYPE_BLUETOOTH:
+ case CONNMAN_DEVICE_TYPE_GPS:
+ case CONNMAN_DEVICE_TYPE_NOZOMI:
+ case CONNMAN_DEVICE_TYPE_HUAWEI:
+ case CONNMAN_DEVICE_TYPE_NOVATEL:
+ return;
+ case CONNMAN_DEVICE_TYPE_ETHERNET:
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ case CONNMAN_DEVICE_TYPE_MBM:
+ case CONNMAN_DEVICE_TYPE_HSO:
+ break;
+ }
+
device = find_device(index);
if (device != NULL)
return;
@@ -118,8 +138,8 @@ static void add_device(struct udev_device *udev_device)
static void remove_device(struct udev_device *udev_device)
{
- struct connman_device *device;
struct udev_list_entry *entry;
+ struct connman_device *device;
int index = -1;
DBG("");