[PATCH BlueZ 1/2] test: Fix opp-client not printing progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This avoid KeyError expection and fixes print usage.
---
 test/opp-client | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/test/opp-client b/test/opp-client
index 3078d49..878c263 100755
--- a/test/opp-client
+++ b/test/opp-client
@@ -49,23 +49,25 @@ class OppClient:
 			print("Transfer created: %s" % path)
 
 	def error(self, err):
-		print err
+		print(err)
 		mainloop.quit()
 
 	def properties_changed(self, interface, properties, invalidated, path):
 		if path != self.transfer_path:
 			return
 
-		if properties['Status'] == 'complete' or \
-				properties['Status'] == 'error':
+		if "Status" in properties and \
+				(properties["Status"] == "complete" or \
+				properties["Status"] == "error"):
 			if self.verbose:
-				print("Transfer %s" % properties['Status'])
+				print("Transfer %s" % properties["Status"])
 			mainloop.quit()
 			return
 
-		if properties["Transferred"] == None:
+		if "Transferred" not in properties:
 			return
 
+		value = properties["Transferred"]
 		speed = (value - self.transferred) / 1000
 		print("Transfer progress %d/%d at %d kBps" % (value,
 							self.transfer_size,
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux