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.

BUG=b:163058754
TEST=Tested by forceing init to return False

Change-Id: Ice44263b979a600524cd33d0bde9fc88b7329ead
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/chameleon/+/2786441
Reviewed-by: Daniel Winkler <danielwinkler@google.com>
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
Commit-Queue: Shijin Abraham <shijinabraham@google.com>
Tested-by: Shijin Abraham <shijinabraham@google.com>
diff --git a/chameleond/utils/bluetooth_raspi.py b/chameleond/utils/bluetooth_raspi.py
index 72bfe3b..2266279 100644
--- a/chameleond/utils/bluetooth_raspi.py
+++ b/chameleond/utils/bluetooth_raspi.py
@@ -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'):
+        logging.info('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