from oeqa.oetest import oeRuntimeTest

class CommBluetoothTest(oeRuntimeTest):
    log = ""
    def target_collect_info(self, cmd):
        (status, output) = self.target.run(cmd)
        self.log = self.log + "\n\n[Debug] Command output --- %s: \n" % cmd
        self.log = self.log + output

    '''Bluetooth device check'''
    def test_comm_btcheck(self):
        '''check bluetooth device'''
        # un-block software rfkill lock
        self.target.run('rfkill unblock all')
        # Collect system information as log
        self.target_collect_info("ifconfig")
        self.target_collect_info("hciconfig")
        self.target_collect_info("lsmod")
        # Detect BT device status
        (status, output) = self.target.run('hciconfig hci0')
        self.assertEqual(status, 0, msg="Error messages: %s" % self.log)

from oeqa.oetest import oeRuntimeTest

class CommBluetoothTest(oeRuntimeTest):
    log = ""
    def target_collect_info(self, cmd):
        (status, output) = self.target.run(cmd)
        self.log = self.log + "\n\n[Debug] Command output --- %s: \n" % cmd
        self.log = self.log + output

    '''Bluetooth device check'''
    def test_comm_btcheck(self):
        '''check bluetooth device'''
        # un-block software rfkill lock
        self.target.run('rfkill unblock all')
        # This is special for edison platform
        self.target.run('connmanctl enable bluetooth')
        # Collect system information as log
        self.target_collect_info("ifconfig")
        self.target_collect_info("hciconfig")
        self.target_collect_info("lsmod")
        # Detect BT device status
        (status, output) = self.target.run('hciconfig hci0')
        self.assertEqual(status, 0, msg="Error messages: %s" % self.log)

Add workaround for edison platform. See IOTOS-1000, it needs 'connmanctl enable bluetooth' before rfkill. Then, the hciconfig could show hci0 device.
Add workaround for edison platform.
See IOTOS-1000, it needs 'connmanctl enable bluetooth' before rfkill.
Then, the hciconfig could show hci0 device.

Signed-off-by: Zhang Jingke <0979c04a6d09a3b3c8dd699e3664fb112fdd2a5b@intel.com>
