From: Marcel Holtmann Date: Mon, 14 Sep 2009 01:33:01 +0000 (-0700) Subject: Fix issue with udev versus /dev/rfkill event processing X-Git-Tag: 2.0_alpha~3247 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6be5aba7521e5380c9d83e448eaae1d277b1f7c1;p=framework%2Fconnectivity%2Fconnman.git Fix issue with udev versus /dev/rfkill event processing --- diff --git a/src/connman.h b/src/connman.h index ff4e286..5eee390 100644 --- a/src/connman.h +++ b/src/connman.h @@ -237,6 +237,7 @@ void __connman_udev_cleanup(void); char *__connman_udev_get_devtype(const char *ifname); char *__connman_udev_get_mbm_devnode(const char *ifname); void __connman_udev_rfkill(const char *sysname, connman_bool_t blocked); +void __connman_udev_enable_rfkill_processing(void); #include diff --git a/src/element.c b/src/element.c index 9a4ba2d..e967491 100644 --- a/src/element.c +++ b/src/element.c @@ -1595,7 +1595,9 @@ void __connman_element_start(void) __connman_connection_init(); __connman_ipv4_init(); - __connman_rfkill_init(); + + if (__connman_rfkill_init() < 0) + __connman_udev_enable_rfkill_processing(); } void __connman_element_stop(void) @@ -1603,6 +1605,7 @@ void __connman_element_stop(void) DBG(""); __connman_rfkill_cleanup(); + __connman_ipv4_cleanup(); __connman_connection_cleanup(); } diff --git a/src/udev.c b/src/udev.c index f65f1f5..f4b9255 100644 --- a/src/udev.c +++ b/src/udev.c @@ -50,6 +50,8 @@ static int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) } #endif +static gboolean rfkill_processing = FALSE; + static GSList *device_list = NULL; static struct connman_device *find_device(int index) @@ -195,6 +197,9 @@ static void change_rfkill_device(struct udev_device *device) 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); @@ -379,6 +384,13 @@ 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; + + enumerate_devices(udev_ctx); +} + char *__connman_udev_get_devtype(const char *ifname) { struct udev_device *device;