OSDN Git Service

test: Fix getting devices in health test scripts
authorSzymon Janc <szymon.janc@tieto.com>
Thu, 3 Jul 2014 14:32:55 +0000 (16:32 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 3 Jul 2014 14:51:14 +0000 (17:51 +0300)
test/test-health
test/test-health-sink

index 343f29c..24afa79 100755 (executable)
@@ -170,7 +170,17 @@ while select == None:
 
 adapter = dbus.Interface(bus.get_object(BUS_NAME, select), ADAPTER_INTERFACE)
 
-devices = adapter.GetProperties()["Devices"]
+devices = []
+for path, interfaces in objects.iteritems():
+       if "org.bluez.Device1" not in interfaces:
+               continue
+       properties = interfaces["org.bluez.Device1"]
+       if properties["Adapter"] != select:
+               continue;
+
+       if HEALTH_DEVICE_INTERFACE not in interfaces:
+               continue
+       devices.append(path)
 
 if len(devices) == 0:
        print("No devices available")
index 52be535..2343a23 100755 (executable)
@@ -61,7 +61,17 @@ while select == None:
 adapter =  dbus.Interface(bus.get_object(BUS_NAME, select),
                                                ADAPTER_INTERFACE)
 
-devices = adapter.GetProperties()["Devices"]
+devices = []
+for path, interfaces in objects.iteritems():
+       if "org.bluez.Device1" not in interfaces:
+               continue
+       properties = interfaces["org.bluez.Device1"]
+       if properties["Adapter"] != select:
+               continue;
+
+       if HEALTH_DEVICE_INTERFACE not in interfaces:
+               continue
+       devices.append(path)
 
 if len(devices) == 0:
        print("No devices available")