Fix WiMAX device detection handling
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 22 Jul 2009 16:08:47 +0000 (18:08 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 22 Jul 2009 16:08:47 +0000 (18:08 +0200)
src/inet.c
src/udev-compat.c
src/udev.c

index 69c01ec..3fc162c 100644 (file)
@@ -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)
index 4230984..270d3ca 100644 (file)
@@ -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;
index 760760b..dc084c1 100644 (file)
@@ -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("");