From: DengYingAn <[email protected]>

It fails to enable technologies if devices are rfkilled on netbook with the way 
to remove pci-e wifi device when rfkill key pressed. The device is indeed 
removed. The patch sync the power state between supplicant and connman driver 
layer, and prevent the attempt power off operation to an plugged-out device.
---
 include/device.h     |    2 ++
 plugins/supplicant.c |    2 ++
 src/device.c         |   10 ++++++++++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/device.h b/include/device.h
index b4bb297..4bd774f 100644
--- a/include/device.h
+++ b/include/device.h
@@ -75,6 +75,8 @@ void connman_device_set_mode(struct connman_device *device,
                                        enum connman_device_mode mode);
 enum connman_device_mode connman_device_get_mode(struct connman_device 
*device);
 
+void connman_sync_power_status_in_callback (struct connman_device *device);
+
 int connman_device_set_powered(struct connman_device *device,
                                                connman_bool_t powered);
 int connman_device_set_scanning(struct connman_device *device,
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index f17edc5..e77a6a5 100644
--- a/plugins/supplicant.c
+++ b/plugins/supplicant.c
@@ -790,6 +790,8 @@ static void remove_interface_reply(DBusPendingCall *call, 
void *user_data)
 
        reply = dbus_pending_call_steal_reply(call);
 
+       connman_sync_power_status_in_callback(task->device);
+
        connman_device_set_powered(task->device, FALSE);
 
        connman_device_unref(task->device);
diff --git a/src/device.c b/src/device.c
index 4ea24d1..a15b19f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -990,6 +990,16 @@ enum connman_device_mode connman_device_get_mode(struct 
connman_device *device)
 }
 
 /**
+ * sync the power status in callback function
+ */
+void connman_sync_power_status_in_callback (struct connman_device *device)
+{
+        if (device->driver == NULL) {
+                device->powered = FALSE;
+        }
+}
+
+/**
  * connman_device_set_powered:
  * @device: device structure
  * @powered: powered state
-- 
1.7.2.2

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to