meta-digi/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.72/0004-port-test-discovery-to...

68 lines
2.1 KiB
Diff

From: Arturo Buzarra <arturo.buzarra@digi.com>
Date: Mon, 21 Jan 2019 12:15:06 +0100
Subject: [PATCH] port test-discovery to python3
Upstream-Status: Inappropriate [digi specific]
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
---
test/test-discovery | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/test/test-discovery b/test/test-discovery
index 54fc51403a8a..9aeace414ada 100755
--- a/test/test-discovery
+++ b/test/test-discovery
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1-or-later
from __future__ import absolute_import, print_function, unicode_literals
@@ -21,7 +21,7 @@ def print_compact(address, properties):
for key, value in properties.items():
if type(value) is dbus.String:
- value = unicode(value).encode('ascii', 'replace')
+ value = str(value)
if (key == "Name"):
name = value
elif (key == "Address"):
@@ -42,7 +42,7 @@ def print_normal(address, properties):
for key in properties.keys():
value = properties[key]
if type(value) is dbus.String:
- value = unicode(value).encode('ascii', 'replace')
+ value = str(value)
if (key == "Class"):
print(" %s = 0x%06x" % (key, value))
else:
@@ -62,6 +62,8 @@ def skip_dev(old_dev, new_dev):
return False
def interfaces_added(path, interfaces):
+ if "org.bluez.Device1" not in interfaces.keys():
+ return
properties = interfaces["org.bluez.Device1"]
if not properties:
return
@@ -71,7 +73,7 @@ def interfaces_added(path, interfaces):
if compact and skip_dev(dev, properties):
return
- devices[path] = dict(devices[path].items() + properties.items())
+ devices[path] = dict(list(devices[path].items()) + list(properties.items()))
else:
devices[path] = properties
@@ -94,7 +96,7 @@ def properties_changed(interface, changed, invalidated, path):
if compact and skip_dev(dev, changed):
return
- devices[path] = dict(devices[path].items() + changed.items())
+ devices[path] = dict(list(devices[path].items()) + list(changed.items()))
else:
devices[path] = changed