DA: Reduce debug log
[platform/upstream/connman.git] / src / detect.c
old mode 100644 (file)
new mode 100755 (executable)
index 17e6959..7f20870
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2013  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -47,15 +47,38 @@ 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_rtnl_get_device_type(index);
+
+       switch (devtype) {
+       case CONNMAN_DEVICE_TYPE_UNKNOWN:
+       case CONNMAN_DEVICE_TYPE_VENDOR:
+       case CONNMAN_DEVICE_TYPE_BLUETOOTH:
+       case CONNMAN_DEVICE_TYPE_CELLULAR:
+       case CONNMAN_DEVICE_TYPE_GPS:
+               return;
+       case CONNMAN_DEVICE_TYPE_ETHERNET:
+       case CONNMAN_DEVICE_TYPE_WIFI:
+       case CONNMAN_DEVICE_TYPE_GADGET:
+               break;
+       }
+
        device = find_device(index);
-       if (device != NULL)
+#if defined TIZEN_EXT
+       if (device) {
+               connman_inet_update_device_ident(device);
+               return;
+       }
+#else
+       if (device)
                return;
+#endif
 
-       device = connman_inet_create_device(index);
-       if (device == NULL)
+       device = connman_device_create_from_index(index);
+       if (!device)
                return;
 
        if (connman_device_register(device) < 0) {
@@ -63,7 +86,7 @@ static void detect_newlink(unsigned short type, int index,
                return;
        }
 
-       device_list = g_slist_append(device_list, device);
+       device_list = g_slist_prepend(device_list, device);
 }
 
 static void detect_dellink(unsigned short type, int index,
@@ -74,7 +97,7 @@ static void detect_dellink(unsigned short type, int index,
        DBG("type %d index %d", type, index);
 
        device = find_device(index);
-       if (device == NULL)
+       if (!device)
                return;
 
        device_list = g_slist_remove(device_list, device);
@@ -92,21 +115,17 @@ static struct connman_rtnl detect_rtnl = {
 
 int __connman_detect_init(void)
 {
-       int err;
-
-       err = connman_rtnl_register(&detect_rtnl);
-       if (err < 0)
-               return err;
+       DBG("");
 
-       connman_rtnl_send_getlink();
-
-       return 0;
+       return connman_rtnl_register(&detect_rtnl);
 }
 
 void __connman_detect_cleanup(void)
 {
        GSList *list;
 
+       DBG("");
+
        connman_rtnl_unregister(&detect_rtnl);
 
        for (list = device_list; list; list = list->next) {