From bf2082ded0ec063428357355c4938a0712628848 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 6 Jul 2010 12:47:36 -0300 Subject: [PATCH] Remove the udev based RFKILL switch processing --- src/connman.h | 1 - src/element.c | 3 +-- src/udev-compat.c | 4 ---- src/udev.c | 70 ------------------------------------------------------- 4 files changed, 1 insertion(+), 77 deletions(-) diff --git a/src/connman.h b/src/connman.h index 19ced9d..2359620 100644 --- a/src/connman.h +++ b/src/connman.h @@ -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 diff --git a/src/element.c b/src/element.c index 13aede8..27d078f 100644 --- a/src/element.c +++ b/src/element.c @@ -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) diff --git a/src/udev-compat.c b/src/udev-compat.c index 5daf482..78b0233 100644 --- a/src/udev-compat.c +++ b/src/udev-compat.c @@ -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; diff --git a/src/udev.c b/src/udev.c index 79df87c..70c760d 100644 --- a/src/udev.c +++ b/src/udev.c @@ -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); -- 2.7.4