Remove the udev based RFKILL switch processing
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 6 Jul 2010 15:47:36 +0000 (12:47 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 6 Jul 2010 15:47:36 +0000 (12:47 -0300)
src/connman.h
src/element.c
src/udev-compat.c
src/udev.c

index 19ced9d..2359620 100644 (file)
@@ -279,7 +279,6 @@ void __connman_udev_start(void);
 void __connman_udev_cleanup(void);
 char *__connman_udev_get_devtype(const char *ifname);
 void __connman_udev_rfkill(const char *sysname, connman_bool_t blocked);
-void __connman_udev_enable_rfkill_processing(void);
 connman_bool_t __connman_udev_get_blocked(int phyindex);
 
 #include <connman/device.h>
index 13aede8..27d078f 100644 (file)
@@ -1350,8 +1350,7 @@ void __connman_element_start(void)
        __connman_ipv4_init();
        __connman_dhcp_init();
 
-       if (__connman_rfkill_init() < 0)
-               __connman_udev_enable_rfkill_processing();
+       __connman_rfkill_init();
 }
 
 void __connman_element_stop(void)
index 5daf482..78b0233 100644 (file)
@@ -106,10 +106,6 @@ static struct connman_rtnl detect_rtnl = {
        .dellink        = detect_dellink,
 };
 
-void __connman_udev_enable_rfkill_processing(void)
-{
-}
-
 char *__connman_udev_get_devtype(const char *ifname)
 {
        return NULL;
index 79df87c..70c760d 100644 (file)
@@ -33,8 +33,6 @@
 
 #include "connman.h"
 
-static gboolean rfkill_processing = FALSE;
-
 static GSList *device_list = NULL;
 
 static struct connman_device *find_device(int index)
@@ -246,55 +244,6 @@ static void phyindex_rfkill(int phyindex, connman_bool_t blocked)
        }
 }
 
-static void change_rfkill_device(struct udev_device *device)
-{
-       struct udev_device *parent;
-       struct udev_list_entry *entry;
-       connman_bool_t blocked;
-       const char *value, *type = NULL;
-       int state = -1;
-
-       if (rfkill_processing == FALSE)
-               return;
-
-       entry = udev_device_get_properties_list_entry(device);
-       while (entry) {
-               const char *name = udev_list_entry_get_name(entry);
-
-               if (g_str_has_prefix(name, "RFKILL_STATE") == TRUE) {
-                       value = udev_list_entry_get_value(entry);
-                       if (value != NULL)
-                               state = atoi(value);
-               } else if (g_str_has_prefix(name, "RFKILL_TYPE") == TRUE)
-                       type = udev_list_entry_get_value(entry);
-
-               entry = udev_list_entry_get_next(entry);
-       }
-
-       if (type == NULL || state < 0)
-               return;
-
-       if (g_str_equal(type, "wlan") == FALSE)
-               return;
-
-       parent = udev_device_get_parent(device);
-       if (parent == NULL)
-               return;
-
-       value = udev_device_get_sysattr_value(parent, "index");
-       if (value == NULL)
-               return;
-
-       blocked = (state != 1) ? TRUE : FALSE;
-
-       phyindex_rfkill(atoi(value), blocked);
-}
-
-static void add_rfkill_device(struct udev_device *device)
-{
-       change_rfkill_device(device);
-}
-
 static void print_properties(struct udev_device *device, const char *prefix)
 {
        struct udev_list_entry *entry;
@@ -369,7 +318,6 @@ static void enumerate_devices(struct udev *context)
                return;
 
        udev_enumerate_add_match_subsystem(enumerate, "net");
-       udev_enumerate_add_match_subsystem(enumerate, "rfkill");
 
        udev_enumerate_scan_devices(enumerate);
 
@@ -388,8 +336,6 @@ static void enumerate_devices(struct udev *context)
 
                        if (g_strcmp0(subsystem, "net") == 0)
                                add_net_device(device);
-                       else if (g_strcmp0(subsystem, "rfkill") == 0)
-                               add_rfkill_device(device);
 
                        udev_device_unref(device);
                }
@@ -424,14 +370,9 @@ static gboolean udev_event(GIOChannel *channel,
        if (g_str_equal(action, "add") == TRUE) {
                if (g_str_equal(subsystem, "net") == TRUE)
                        add_net_device(device);
-               else if (g_str_equal(subsystem, "rfkill") == TRUE)
-                       add_rfkill_device(device);
        } else if (g_str_equal(action, "remove") == TRUE) {
                if (g_str_equal(subsystem, "net") == TRUE)
                        remove_net_device(device);
-       } else if (g_str_equal(action, "change") == TRUE) {
-               if (g_str_equal(subsystem, "rfkill") == TRUE)
-                       change_rfkill_device(device);
        }
 
 done:
@@ -444,15 +385,6 @@ static struct udev *udev_ctx;
 static struct udev_monitor *udev_mon;
 static guint udev_watch = 0;
 
-void __connman_udev_enable_rfkill_processing(void)
-{
-       rfkill_processing = TRUE;
-
-       connman_warn("Enabling udev based RFKILL processing");
-
-       enumerate_devices(udev_ctx);
-}
-
 char *__connman_udev_get_devtype(const char *ifname)
 {
        struct udev_device *device;
@@ -514,8 +446,6 @@ int __connman_udev_init(void)
 
        udev_monitor_filter_add_match_subsystem_devtype(udev_mon,
                                                        "net", NULL);
-       udev_monitor_filter_add_match_subsystem_devtype(udev_mon,
-                                                       "rfkill", NULL);
 
        udev_monitor_filter_update(udev_mon);