[PATCH 7/9] Adds an HDP record browser

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

 



This script 'scans' known devices and interprets every HDP record
that it can find. The output is the raw dictionary format which
hdp_record module understands/delivers upon parsing.
---
 test/hdp/hdp_record_scan.py |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100755 test/hdp/hdp_record_scan.py

diff --git a/test/hdp/hdp_record_scan.py b/test/hdp/hdp_record_scan.py
new file mode 100755
index 0000000..d8a6a2c
--- /dev/null
+++ b/test/hdp/hdp_record_scan.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+import hdp_record
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+						"org.bluez.Manager")
+
+adapter_list = manager.ListAdapters()
+
+for i in adapter_list:
+	adapter = dbus.Interface(bus.get_object("org.bluez", i),
+							"org.bluez.Adapter")
+	properties  = adapter.GetProperties()
+	try:
+		device_list = properties["Devices"]
+	except:
+		device_list = []
+
+	for n in device_list:
+		device = dbus.Interface(bus.get_object("org.bluez", n),
+							"org.bluez.Device")
+		p = device.GetProperties()
+		print "Discovering device", p['Address'], p['Name']
+		try:
+			services = device.DiscoverServices("")
+		except:
+			services = {}
+
+		for handle in services.keys():
+			hdp = hdp_record.parse_xml(services[handle])
+			if hdp:
+				print "Handle %08x:" % handle
+				print hdp_record.parse_xml(services[handle])
-- 
1.7.0.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