Below is patch for:
http://bugs.meego.com/show_bug.cgi?id=10330
When the WiFi driver is removed, __connman_technology_remove_rfkill is invoked.
This will decrement the technology->blocked. technology->blocked which is zero,
now becomes -1.
Now when WiFi driver is added back, connman_device is created and
__connman_device_enable is called. __connman_device_enable returns with ENOLINK
since device->blocked is TRUE. device->blocked is set in connman_device_create
based on value returned by __connman_technology_get_blocked. But since
technology->blocked is -1 __connman_device_enable does not invoke wifi_enable.
And hence the bug.
In __connman_technology_remove_rfkill decrementing technology->blocked only if
it is > 0 will fix the issue. The patch also makes similar check in
__connman_technology_update_rfkill
Patch
---
src/technology.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/technology.c b/src/technology.c
index b315e95..1fece04 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -675,7 +675,8 @@ int __connman_technology_update_rfkill(unsigned int index,
technology->state = CONNMAN_TECHNOLOGY_STATE_BLOCKED;
state_changed(technology);
} else {
- if (g_atomic_int_dec_and_test(&technology->blocked) == FALSE)
+ if (g_atomic_int_get(&technology->blocked) == 0 ||
+ g_atomic_int_dec_and_test(&technology->blocked)
== FALSE)
return 0;
technology_blocked(technology, blocked);
@@ -700,7 +701,8 @@ int __connman_technology_remove_rfkill(unsigned int index)
g_hash_table_remove(rfkill_table, &index);
- if (g_atomic_int_dec_and_test(&technology->blocked) == TRUE) {
+ if (g_atomic_int_get(&technology->blocked) &&
+ g_atomic_int_dec_and_test(&technology->blocked) ==
TRUE) {
technology_blocked(technology, FALSE);
technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE;
state_changed(technology);
--
1.7.2.2
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman