bluetooth: Check if Powered property is set in Init

This change checks the bluetooth adapter Powered property and fails the Init
function if the check fails. This will force a reboot of the Raspberry and
help reset the bluetooth adapter.

TEST=Tested by forceing init to return False

Change-Id: Ice44263b979a600524cd33d0bde9fc88b7329ead
Reviewed-by: Daniel Winkler <>
Reviewed-by: Shyh-In Hwang <>
Commit-Queue: Shijin Abraham <>
Tested-by: Shijin Abraham <>
diff --git a/chameleond/utils/ b/chameleond/utils/
index 72bfe3b..2266279 100644
--- a/chameleond/utils/
+++ b/chameleond/utils/
@@ -509,6 +509,9 @@
     """Ensures our chip is in the correct state for the tests to be run"""
     # Make sure device is powered up and discoverable
+    if not self._get_hci_prop('org.bluez.Adapter1', 'Powered'):
+'Init: Adapter not powered')
+        return False
     self._set_hci_prop('org.bluez.Adapter1', 'Discoverable', dbus.Boolean(1))
     # Set class based on device we're emulating