Merge lp:~vorlon/ubuntu/quantal/bluez/python3 into lp:ubuntu/quantal/bluez

Proposed by Steve Langasek on 2012-04-27
Status: Merged
Merged at revision: 97
Proposed branch: lp:~vorlon/ubuntu/quantal/bluez/python3
Merge into: lp:ubuntu/quantal/bluez
Diff against target: 4398 lines (+3391/-153)
52 files modified
.pc/applied-patches (+1/-0)
.pc/python3.patch/test/list-devices (+93/-0)
.pc/python3.patch/test/monitor-bluetooth (+56/-0)
.pc/python3.patch/test/simple-agent (+130/-0)
.pc/python3.patch/test/simple-endpoint (+126/-0)
.pc/python3.patch/test/simple-service (+127/-0)
.pc/python3.patch/test/test-adapter (+137/-0)
.pc/python3.patch/test/test-attrib (+108/-0)
.pc/python3.patch/test/test-audio (+45/-0)
.pc/python3.patch/test/test-device (+207/-0)
.pc/python3.patch/test/test-discovery (+57/-0)
.pc/python3.patch/test/test-health (+217/-0)
.pc/python3.patch/test/test-health-sink (+83/-0)
.pc/python3.patch/test/test-input (+45/-0)
.pc/python3.patch/test/test-manager (+38/-0)
.pc/python3.patch/test/test-network (+57/-0)
.pc/python3.patch/test/test-oob (+80/-0)
.pc/python3.patch/test/test-proximity (+66/-0)
.pc/python3.patch/test/test-sap-server (+138/-0)
.pc/python3.patch/test/test-serial (+56/-0)
.pc/python3.patch/test/test-serial-proxy (+64/-0)
.pc/python3.patch/test/test-service (+47/-0)
.pc/python3.patch/test/test-telephony (+176/-0)
.pc/python3.patch/test/test-thermometer (+88/-0)
debian/changelog (+6/-0)
debian/control (+3/-2)
debian/patches/python3.patch (+984/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-0)
test/list-devices (+1/-1)
test/monitor-bluetooth (+1/-1)
test/simple-agent (+16/-15)
test/simple-endpoint (+1/-1)
test/simple-service (+4/-4)
test/test-adapter (+26/-26)
test/test-attrib (+1/-1)
test/test-audio (+4/-4)
test/test-device (+39/-39)
test/test-discovery (+6/-6)
test/test-health (+1/-1)
test/test-health-sink (+1/-1)
test/test-input (+4/-4)
test/test-manager (+6/-6)
test/test-network (+5/-5)
test/test-oob (+1/-1)
test/test-proximity (+1/-1)
test/test-sap-server (+1/-1)
test/test-serial (+5/-5)
test/test-serial-proxy (+1/-1)
test/test-service (+7/-7)
test/test-telephony (+19/-19)
test/test-thermometer (+1/-1)
To merge this branch: bzr merge lp:~vorlon/ubuntu/quantal/bluez/python3
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre 2012-04-27 Approve on 2012-04-27
Barry Warsaw 2012-04-27 Pending
Review via email: mp+103795@code.launchpad.net

Description of the Change

Let's get the python3 started!

To post a comment you must log in.
Mathieu Trudel-Lapierre (cyphermox) wrote :

Why do you need my review for this? ;)

Sure, looks good to me. I also see no reason not to update these scripts to python3 now, and I'll take care of the bluez merge to 4.99 soon.

review: Approve
Barry Warsaw (barry) wrote :
Download full text (3.5 KiB)

On Apr 27, 2012, at 03:39 AM, Steve Langasek wrote:

>Steve Langasek has proposed merging lp:~vorlon/ubuntu/quantal/bluez/python3 into lp:ubuntu/bluez.
>
>Requested reviews:
> Mathieu Trudel-Lapierre (mathieu-tl)
> Barry Warsaw (barry)
>
>For more details, see:
>https://code.launchpad.net/~vorlon/ubuntu/quantal/bluez/python3/+merge/103795
>
>Let's get the python3 started!

Reviewing quilt patches hurts my brain, but let's see if I got it right. I'll
cut out the parts that look fine.

+Index: trunk/test/simple-agent
+===================================================================
+--- trunk.orig/test/simple-agent
++++ trunk/test/simple-agent
+@@ -1,6 +1,6 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+
+-import gobject
++from gi.repository import GObject
+
+ import sys
+ import dbus
+@@ -20,14 +20,14 @@
+ @dbus.service.method("org.bluez.Agent",
+ in_signature="", out_signature="")
+ def Release(self):
+- print "Release"
++ print("Release")
+ if self.exit_on_release:
+ mainloop.quit()
+
+ @dbus.service.method("org.bluez.Agent",
+ in_signature="os", out_signature="")
+ def Authorize(self, device, uuid):
+- print "Authorize (%s, %s)" % (device, uuid)
++ print("Authorize (%s, %s)" % (device, uuid))
+ authorize = raw_input("Authorize connection (yes/no): ")

s/raw_input/input/

Python 3 has no raw_input(). Search the patch for other instances of
raw_input().

+Index: trunk/test/test-adapter
+===================================================================
+--- trunk.orig/test/test-adapter
++++ trunk/test/test-adapter
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+
+ import sys
+ import dbus
+@@ -26,28 +26,28 @@
+ "org.bluez.Adapter")
+
+ if (len(args) < 1):

Note that the outer parentheses are unnecessary and actually rather
un-Pythonic. Conditionals in Python don't need them. (Yep, I know that
Steve's patch doesn't touch this; I've seen this as a general coding style in
bluez, and it bugs me too much not to comment ;).

+Index: trunk/test/test-service
+===================================================================
+--- trunk.orig/test/test-service
++++ trunk/test/test-service
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+
+ import sys
+ import dbus
+@@ -26,22 +26,22 @@
+ "org.bluez.Service")
+
+ if (len(args) < 1):
+- print "Usage: %s <command>" % (sys.argv[0])
+- print ""
+- print " addrecord <file>"
++ print("Usage: %s <command>" % (sys.argv[0]))
++ print("")
++ print(" addrecord <file>")
+ sys.exit(1)
+
+ if (args[0] == "addrecord"):
+ if (len(args) < 2):
+- print "Need file parameter"
++ print("Need file parameter")
+ else:
+ f = open(args[1])
+ record = f.read()
+ f.close()

You might consider using a with-statement here:

            with open(args[1]) as f:
                record = f.read()

then the f.close() happens automatically, even if you get an exception during
the read.

+@@ -141,36 +141,36 @@
+ if len(args) > 1:
+ test.SignalStrength(args[1])
+ else:
+- print "Need signal strength parameter"
++ print("Need signal strength parameter")
+ sys.exit(0)
+
+ if args[0] == "battery":
+ if len(args) > 1:
+ test.BatteryLevel(args[1]...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2012-03-21 15:27:57 +0000
3+++ .pc/applied-patches 2012-04-27 03:38:31 +0000
4@@ -7,3 +7,4 @@
5 enable_audio_profiles.patch
6 10-unregister_interface_on_exit.patch
7 11-explicitly_close.patch
8+python3.patch
9
10=== added directory '.pc/python3.patch'
11=== added directory '.pc/python3.patch/test'
12=== added file '.pc/python3.patch/test/list-devices'
13--- .pc/python3.patch/test/list-devices 1970-01-01 00:00:00 +0000
14+++ .pc/python3.patch/test/list-devices 2012-04-27 03:38:31 +0000
15@@ -0,0 +1,93 @@
16+#!/usr/bin/python
17+
18+import dbus
19+
20+bus = dbus.SystemBus()
21+
22+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
23+ "org.bluez.Manager")
24+
25+def extract_objects(object_list):
26+ list = ""
27+ for object in object_list:
28+ val = str(object)
29+ list = list + val[val.rfind("/") + 1:] + " "
30+ return list
31+
32+def extract_uuids(uuid_list):
33+ list = ""
34+ for uuid in uuid_list:
35+ if (uuid.endswith("-0000-1000-8000-00805f9b34fb")):
36+ if (uuid.startswith("0000")):
37+ val = "0x" + uuid[4:8]
38+ else:
39+ val = "0x" + uuid[0:8]
40+ else:
41+ val = str(uuid)
42+ list = list + val + " "
43+ return list
44+
45+adapter_list = manager.ListAdapters()
46+
47+for i in adapter_list:
48+ adapter = dbus.Interface(bus.get_object("org.bluez", i),
49+ "org.bluez.Adapter")
50+ print "[ " + i + " ]"
51+
52+ properties = adapter.GetProperties()
53+ for key in properties.keys():
54+ value = properties[key]
55+ if (key == "Devices"):
56+ list = extract_objects(value)
57+ print " %s = %s" % (key, list)
58+ elif (key == "UUIDs"):
59+ list = extract_uuids(value)
60+ print " %s = %s" % (key, list)
61+ else:
62+ print " %s = %s" % (key, value)
63+
64+ try:
65+ device_list = properties["Devices"]
66+ except:
67+ device_list = []
68+
69+ for n in device_list:
70+ device = dbus.Interface(bus.get_object("org.bluez", n),
71+ "org.bluez.Device")
72+ print " [ " + n + " ]"
73+
74+ properties = device.GetProperties()
75+ for key in properties.keys():
76+ value = properties[key]
77+ if (key == "Nodes"):
78+ list = extract_objects(value)
79+ print " %s = %s" % (key, list)
80+ elif (key == "UUIDs"):
81+ list = extract_uuids(value)
82+ print " %s = %s" % (key, list)
83+ elif (key == "Class"):
84+ print " %s = 0x%06x" % (key, value)
85+ elif (key == "Vendor"):
86+ print " %s = 0x%04x" % (key, value)
87+ elif (key == "Product"):
88+ print " %s = 0x%04x" % (key, value)
89+ elif (key == "Version"):
90+ print " %s = 0x%04x" % (key, value)
91+ else:
92+ print " %s = %s" % (key, value)
93+
94+ try:
95+ node_list = properties["Nodes"]
96+ except:
97+ node_list = []
98+
99+ for x in node_list:
100+ node = dbus.Interface(bus.get_object("org.bluez", x),
101+ "org.bluez.Node")
102+ print " [ " + x + " ]"
103+
104+ properties = node.GetProperties()
105+ for key in properties.keys():
106+ print " %s = %s" % (key, properties[key])
107+
108+ print
109
110=== added file '.pc/python3.patch/test/monitor-bluetooth'
111--- .pc/python3.patch/test/monitor-bluetooth 1970-01-01 00:00:00 +0000
112+++ .pc/python3.patch/test/monitor-bluetooth 2012-04-27 03:38:31 +0000
113@@ -0,0 +1,56 @@
114+#!/usr/bin/python
115+
116+import gobject
117+
118+import dbus
119+import dbus.mainloop.glib
120+
121+def property_changed(name, value, path, interface):
122+ iface = interface[interface.rfind(".") + 1:]
123+ val = str(value)
124+ print "{%s.PropertyChanged} [%s] %s = %s" % (iface, path, name, val)
125+
126+def object_signal(value, path, interface, member):
127+ iface = interface[interface.rfind(".") + 1:]
128+ val = str(value)
129+ print "{%s.%s} [%s] Path = %s" % (iface, member, path, val)
130+
131+if __name__ == '__main__':
132+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
133+
134+ bus = dbus.SystemBus()
135+
136+ bus.add_signal_receiver(property_changed, bus_name="org.bluez",
137+ signal_name = "PropertyChanged",
138+ path_keyword="path",
139+ interface_keyword="interface")
140+
141+ bus.add_signal_receiver(object_signal, bus_name="org.bluez",
142+ signal_name = "AdapterAdded",
143+ path_keyword="path",
144+ member_keyword="member",
145+ interface_keyword="interface")
146+ bus.add_signal_receiver(object_signal, bus_name="org.bluez",
147+ signal_name = "AdapterRemoved",
148+ path_keyword="path",
149+ member_keyword="member",
150+ interface_keyword="interface")
151+ bus.add_signal_receiver(object_signal, bus_name="org.bluez",
152+ signal_name = "DefaultAdapterChanged",
153+ path_keyword="path",
154+ member_keyword="member",
155+ interface_keyword="interface")
156+
157+ bus.add_signal_receiver(object_signal, bus_name="org.bluez",
158+ signal_name = "DeviceCreated",
159+ path_keyword="path",
160+ member_keyword="member",
161+ interface_keyword="interface")
162+ bus.add_signal_receiver(object_signal, bus_name="org.bluez",
163+ signal_name = "DeviceRemoved",
164+ path_keyword="path",
165+ member_keyword="member",
166+ interface_keyword="interface")
167+
168+ mainloop = gobject.MainLoop()
169+ mainloop.run()
170
171=== added file '.pc/python3.patch/test/simple-agent'
172--- .pc/python3.patch/test/simple-agent 1970-01-01 00:00:00 +0000
173+++ .pc/python3.patch/test/simple-agent 2012-04-27 03:38:31 +0000
174@@ -0,0 +1,130 @@
175+#!/usr/bin/python
176+
177+import gobject
178+
179+import sys
180+import dbus
181+import dbus.service
182+import dbus.mainloop.glib
183+from optparse import OptionParser
184+
185+class Rejected(dbus.DBusException):
186+ _dbus_error_name = "org.bluez.Error.Rejected"
187+
188+class Agent(dbus.service.Object):
189+ exit_on_release = True
190+
191+ def set_exit_on_release(self, exit_on_release):
192+ self.exit_on_release = exit_on_release
193+
194+ @dbus.service.method("org.bluez.Agent",
195+ in_signature="", out_signature="")
196+ def Release(self):
197+ print "Release"
198+ if self.exit_on_release:
199+ mainloop.quit()
200+
201+ @dbus.service.method("org.bluez.Agent",
202+ in_signature="os", out_signature="")
203+ def Authorize(self, device, uuid):
204+ print "Authorize (%s, %s)" % (device, uuid)
205+ authorize = raw_input("Authorize connection (yes/no): ")
206+ if (authorize == "yes"):
207+ return
208+ raise Rejected("Connection rejected by user")
209+
210+ @dbus.service.method("org.bluez.Agent",
211+ in_signature="o", out_signature="s")
212+ def RequestPinCode(self, device):
213+ print "RequestPinCode (%s)" % (device)
214+ return raw_input("Enter PIN Code: ")
215+
216+ @dbus.service.method("org.bluez.Agent",
217+ in_signature="o", out_signature="u")
218+ def RequestPasskey(self, device):
219+ print "RequestPasskey (%s)" % (device)
220+ passkey = raw_input("Enter passkey: ")
221+ return dbus.UInt32(passkey)
222+
223+ @dbus.service.method("org.bluez.Agent",
224+ in_signature="ou", out_signature="")
225+ def DisplayPasskey(self, device, passkey):
226+ print "DisplayPasskey (%s, %d)" % (device, passkey)
227+
228+ @dbus.service.method("org.bluez.Agent",
229+ in_signature="ou", out_signature="")
230+ def RequestConfirmation(self, device, passkey):
231+ print "RequestConfirmation (%s, %d)" % (device, passkey)
232+ confirm = raw_input("Confirm passkey (yes/no): ")
233+ if (confirm == "yes"):
234+ return
235+ raise Rejected("Passkey doesn't match")
236+
237+ @dbus.service.method("org.bluez.Agent",
238+ in_signature="s", out_signature="")
239+ def ConfirmModeChange(self, mode):
240+ print "ConfirmModeChange (%s)" % (mode)
241+ authorize = raw_input("Authorize mode change (yes/no): ")
242+ if (authorize == "yes"):
243+ return
244+ raise Rejected("Mode change by user")
245+
246+ @dbus.service.method("org.bluez.Agent",
247+ in_signature="", out_signature="")
248+ def Cancel(self):
249+ print "Cancel"
250+
251+def create_device_reply(device):
252+ print "New device (%s)" % (device)
253+ mainloop.quit()
254+
255+def create_device_error(error):
256+ print "Creating device failed: %s" % (error)
257+ mainloop.quit()
258+
259+if __name__ == '__main__':
260+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
261+
262+ bus = dbus.SystemBus()
263+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
264+ "org.bluez.Manager")
265+
266+ capability = "DisplayYesNo"
267+
268+ parser = OptionParser()
269+ parser.add_option("-c", "--capability", action="store",
270+ type="string", dest="capability")
271+ (options, args) = parser.parse_args()
272+ if options.capability:
273+ capability = options.capability
274+
275+ if len(args) > 0:
276+ path = manager.FindAdapter(args[0])
277+ else:
278+ path = manager.DefaultAdapter()
279+
280+ adapter = dbus.Interface(bus.get_object("org.bluez", path),
281+ "org.bluez.Adapter")
282+
283+ path = "/test/agent"
284+ agent = Agent(bus, path)
285+
286+ mainloop = gobject.MainLoop()
287+
288+ if len(args) > 1:
289+ if len(args) > 2:
290+ device = adapter.FindDevice(args[1])
291+ adapter.RemoveDevice(device)
292+
293+ agent.set_exit_on_release(False)
294+ adapter.CreatePairedDevice(args[1], path, capability,
295+ reply_handler=create_device_reply,
296+ error_handler=create_device_error)
297+ else:
298+ adapter.RegisterAgent(path, capability)
299+ print "Agent registered"
300+
301+ mainloop.run()
302+
303+ #adapter.UnregisterAgent(path)
304+ #print "Agent unregistered"
305
306=== added file '.pc/python3.patch/test/simple-endpoint'
307--- .pc/python3.patch/test/simple-endpoint 1970-01-01 00:00:00 +0000
308+++ .pc/python3.patch/test/simple-endpoint 2012-04-27 03:38:31 +0000
309@@ -0,0 +1,126 @@
310+#!/usr/bin/python
311+
312+import sys
313+import dbus
314+import dbus.service
315+import dbus.mainloop.glib
316+import gobject
317+
318+A2DP_SOURCE_UUID = "0000110A-0000-1000-8000-00805F9B34FB"
319+A2DP_SINK_UUID = "0000110B-0000-1000-8000-00805F9B34FB"
320+HFP_AG_UUID = "0000111F-0000-1000-8000-00805F9B34FB"
321+HSP_AG_UUID = "00001112-0000-1000-8000-00805F9B34FB"
322+
323+SBC_CODEC = dbus.Byte(0x00)
324+#Channel Modes: Mono DualChannel Stereo JointStereo
325+#Frequencies: 16Khz 32Khz 44.1Khz 48Khz
326+#Subbands: 4 8
327+#Blocks: 4 8 12 16
328+#Bitpool Range: 2-64
329+SBC_CAPABILITIES = dbus.Array([dbus.Byte(0xff), dbus.Byte(0xff), dbus.Byte(2), dbus.Byte(64)])
330+# JointStereo 44.1Khz Subbands: Blocks: 16 Bitpool Range: 2-32
331+SBC_CONFIGURATION = dbus.Array([dbus.Byte(0x21), dbus.Byte(0x15), dbus.Byte(2), dbus.Byte(32)])
332+
333+MP3_CODEC = dbus.Byte(0x01)
334+#Channel Modes: Mono DualChannel Stereo JointStereo
335+#Frequencies: 32Khz 44.1Khz 48Khz
336+#CRC: YES
337+#Layer: 3
338+#Bit Rate: All except Free format
339+#VBR: Yes
340+#Payload Format: RFC-2250
341+MP3_CAPABILITIES = dbus.Array([dbus.Byte(0x3f), dbus.Byte(0x07), dbus.Byte(0xff), dbus.Byte(0xfe)])
342+# JointStereo 44.1Khz Layer: 3 Bit Rate: VBR Format: RFC-2250
343+MP3_CONFIGURATION = dbus.Array([dbus.Byte(0x21), dbus.Byte(0x02), dbus.Byte(0x00), dbus.Byte(0x80)])
344+
345+PCM_CODEC = dbus.Byte(0x00)
346+PCM_CONFIGURATION = dbus.Array([], signature="ay")
347+
348+class Rejected(dbus.DBusException):
349+ _dbus_error_name = "org.bluez.Error.Rejected"
350+
351+class Endpoint(dbus.service.Object):
352+ exit_on_release = True
353+ configuration = SBC_CONFIGURATION
354+
355+ def set_exit_on_release(self, exit_on_release):
356+ self.exit_on_release = exit_on_release
357+
358+ def default_configuration(self, configuration):
359+ self.configuration = configuration
360+
361+ @dbus.service.method("org.bluez.MediaEndpoint",
362+ in_signature="", out_signature="")
363+ def Release(self):
364+ print "Release"
365+ if self.exit_on_release:
366+ mainloop.quit()
367+
368+ @dbus.service.method("org.bluez.MediaEndpoint",
369+ in_signature="", out_signature="")
370+ def ClearConfiguration(self):
371+ print "ClearConfiguration"
372+
373+ @dbus.service.method("org.bluez.MediaEndpoint",
374+ in_signature="oay", out_signature="")
375+ def SetConfiguration(self, transport, config):
376+ print "SetConfiguration (%s, %s)" % (transport, config)
377+ return
378+
379+ @dbus.service.method("org.bluez.MediaEndpoint",
380+ in_signature="ay", out_signature="ay")
381+ def SelectConfiguration(self, caps):
382+ print "SelectConfiguration (%s)" % (caps)
383+ return self.configuration
384+
385+if __name__ == '__main__':
386+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
387+
388+ bus = dbus.SystemBus()
389+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
390+ "org.bluez.Manager")
391+
392+ if len(sys.argv) > 1:
393+ path = manager.FindAdapter(sys.argv[1])
394+ else:
395+ path = manager.DefaultAdapter()
396+
397+ media = dbus.Interface(bus.get_object("org.bluez", path),
398+ "org.bluez.Media")
399+
400+ path = "/test/endpoint"
401+ endpoint = Endpoint(bus, path)
402+ mainloop = gobject.MainLoop()
403+
404+ properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID,
405+ "Codec" : SBC_CODEC,
406+ "DelayReporting" : True,
407+ "Capabilities" : SBC_CAPABILITIES })
408+
409+ if len(sys.argv) > 2:
410+ if sys.argv[2] == "sbcsink":
411+ properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID,
412+ "Codec" : SBC_CODEC,
413+ "DelayReporting" : True,
414+ "Capabilities" : SBC_CAPABILITIES })
415+ if sys.argv[2] == "mp3source":
416+ properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID,
417+ "Codec" : MP3_CODEC,
418+ "Capabilities" : MP3_CAPABILITIES })
419+ endpoint.default_configuration(MP3_CONFIGURATION)
420+ if sys.argv[2] == "mp3sink":
421+ properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID,
422+ "Codec" : MP3_CODEC,
423+ "Capabilities" : MP3_CAPABILITIES })
424+ endpoint.default_configuration(MP3_CONFIGURATION)
425+ if sys.argv[2] == "hfpag" or sys.argv[2] == "hspag":
426+ properties = dbus.Dictionary({ "UUID" : HFP_AG_UUID,
427+ "Codec" : PCM_CODEC,
428+ "Capabilities" : PCM_CONFIGURATION })
429+ endpoint.default_configuration(dbus.Array([]))
430+
431+ print properties
432+
433+ media.RegisterEndpoint(path, properties)
434+
435+ mainloop.run()
436
437=== added file '.pc/python3.patch/test/simple-service'
438--- .pc/python3.patch/test/simple-service 1970-01-01 00:00:00 +0000
439+++ .pc/python3.patch/test/simple-service 2012-04-27 03:38:31 +0000
440@@ -0,0 +1,127 @@
441+#!/usr/bin/python
442+
443+import sys
444+import time
445+import dbus
446+
447+xml = ' \
448+<?xml version="1.0" encoding="UTF-8" ?> \
449+<record> \
450+ <attribute id="0x0001"> \
451+ <sequence> \
452+ <uuid value="0x1101"/> \
453+ </sequence> \
454+ </attribute> \
455+ \
456+ <attribute id="0x0002"> \
457+ <uint32 value="0"/> \
458+ </attribute> \
459+ \
460+ <attribute id="0x0003"> \
461+ <uuid value="00001101-0000-1000-8000-00805f9b34fb"/> \
462+ </attribute> \
463+ \
464+ <attribute id="0x0004"> \
465+ <sequence> \
466+ <sequence> \
467+ <uuid value="0x0100"/> \
468+ </sequence> \
469+ <sequence> \
470+ <uuid value="0x0003"/> \
471+ <uint8 value="23"/> \
472+ </sequence> \
473+ </sequence> \
474+ </attribute> \
475+ \
476+ <attribute id="0x0005"> \
477+ <sequence> \
478+ <uuid value="0x1002"/> \
479+ </sequence> \
480+ </attribute> \
481+ \
482+ <attribute id="0x0006"> \
483+ <sequence> \
484+ <uint16 value="0x656e"/> \
485+ <uint16 value="0x006a"/> \
486+ <uint16 value="0x0100"/> \
487+ </sequence> \
488+ </attribute> \
489+ \
490+ <attribute id="0x0007"> \
491+ <uint32 value="0"/> \
492+ </attribute> \
493+ \
494+ <attribute id="0x0008"> \
495+ <uint8 value="0xff"/> \
496+ </attribute> \
497+ \
498+ <attribute id="0x0009"> \
499+ <sequence> \
500+ <sequence> \
501+ <uuid value="0x1101"/> \
502+ <uint16 value="0x0100"/> \
503+ </sequence> \
504+ </sequence> \
505+ </attribute> \
506+ \
507+ <attribute id="0x000a"> \
508+ <url value="http://www.bluez.org/"/> \
509+ </attribute> \
510+ \
511+ <attribute id="0x000b"> \
512+ <url value="http://www.bluez.org/"/> \
513+ </attribute> \
514+ \
515+ <attribute id="0x000c"> \
516+ <url value="http://www.bluez.org/"/> \
517+ </attribute> \
518+ \
519+ <attribute id="0x0100"> \
520+ <text value="Serial Port"/> \
521+ </attribute> \
522+ \
523+ <attribute id="0x0101"> \
524+ <text value="Serial Port Service"/> \
525+ </attribute> \
526+ \
527+ <attribute id="0x0102"> \
528+ <text value="BlueZ"/> \
529+ </attribute> \
530+ \
531+ <attribute id="0x0200"> \
532+ <sequence> \
533+ <uint16 value="0x0100"/> \
534+ </sequence> \
535+ </attribute> \
536+ \
537+ <attribute id="0x0201"> \
538+ <uint32 value="0"/> \
539+ </attribute> \
540+</record> \
541+'
542+
543+bus = dbus.SystemBus()
544+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
545+ "org.bluez.Manager")
546+
547+if len(sys.argv) > 1:
548+ path = manager.FindAdapter(sys.argv[1])
549+else:
550+ path = manager.DefaultAdapter()
551+
552+service = dbus.Interface(bus.get_object("org.bluez", path),
553+ "org.bluez.Service")
554+
555+handle = service.AddRecord(xml)
556+
557+print "Service record with handle 0x%04x added" % (handle)
558+
559+print "Press CTRL-C to remove service record"
560+
561+try:
562+ time.sleep(1000)
563+ print "Terminating session"
564+except:
565+ pass
566+
567+service.RemoveRecord(dbus.UInt32(handle))
568
569=== added file '.pc/python3.patch/test/test-adapter'
570--- .pc/python3.patch/test/test-adapter 1970-01-01 00:00:00 +0000
571+++ .pc/python3.patch/test/test-adapter 2012-04-27 03:38:31 +0000
572@@ -0,0 +1,137 @@
573+#!/usr/bin/python
574+
575+import sys
576+import dbus
577+import time
578+from optparse import OptionParser, make_option
579+
580+bus = dbus.SystemBus()
581+
582+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
583+
584+option_list = [
585+ make_option("-i", "--device", action="store",
586+ type="string", dest="dev_id"),
587+ ]
588+parser = OptionParser(option_list=option_list)
589+
590+(options, args) = parser.parse_args()
591+
592+if options.dev_id:
593+ adapter_path = manager.FindAdapter(options.dev_id)
594+else:
595+ adapter_path = manager.DefaultAdapter()
596+
597+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
598+ "org.bluez.Adapter")
599+
600+if (len(args) < 1):
601+ print "Usage: %s <command>" % (sys.argv[0])
602+ print ""
603+ print " address"
604+ print " list"
605+ print " name [name]"
606+ print " powered [on/off]"
607+ print " pairable [on/off]"
608+ print " pairabletimeout [timeout]"
609+ print " discoverable [on/off]"
610+ print " discoverabletimeout [timeout]"
611+ print " discovering"
612+ sys.exit(1)
613+
614+if (args[0] == "address"):
615+ properties = adapter.GetProperties()
616+ print properties["Address"]
617+ sys.exit(0)
618+
619+if (args[0] == "name"):
620+ if (len(args) < 2):
621+ properties = adapter.GetProperties()
622+ print properties["Name"]
623+ else:
624+ adapter.SetProperty("Name", args[1])
625+ sys.exit(0)
626+
627+if (args[0] == "list"):
628+ if (len(args) < 2):
629+ properties = manager.GetProperties()
630+ for adapter_path in properties["Adapters"]:
631+ adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
632+ "org.bluez.Adapter")
633+ prop = adapter.GetProperties()
634+ print " [ %s ]" % (adapter_path)
635+ for (key, value) in prop.iteritems():
636+ if (key == "Class"):
637+ print " %s = 0x%06x" % (key, value)
638+ else:
639+ print " %s = %s" % (key, value)
640+ print
641+ sys.exit(0)
642+
643+if (args[0] == "powered"):
644+ if (len(args) < 2):
645+ properties = adapter.GetProperties()
646+ print properties["Powered"]
647+ else:
648+ if (args[1] == "on"):
649+ value = dbus.Boolean(1)
650+ elif (args[1] == "off"):
651+ value = dbus.Boolean(0)
652+ else:
653+ value = dbus.Boolean(args[1])
654+ adapter.SetProperty("Powered", value)
655+ sys.exit(0)
656+
657+if (args[0] == "pairable"):
658+ if (len(args) < 2):
659+ properties = adapter.GetProperties()
660+ print properties["Pairable"]
661+ else:
662+ if (args[1] == "on"):
663+ value = dbus.Boolean(1)
664+ elif (args[1] == "off"):
665+ value = dbus.Boolean(0)
666+ else:
667+ value = dbus.Boolean(args[1])
668+ adapter.SetProperty("Pairable", value)
669+ sys.exit(0)
670+
671+if (args[0] == "pairabletimeout"):
672+ if (len(args) < 2):
673+ properties = adapter.GetProperties()
674+ print properties["PairableTimeout"]
675+ else:
676+ timeout = dbus.UInt32(args[1])
677+ adapter.SetProperty("PairableTimeout", timeout)
678+ sys.exit(0)
679+
680+if (args[0] == "discoverable"):
681+ if (len(args) < 2):
682+ properties = adapter.GetProperties()
683+ print properties["Discoverable"]
684+ else:
685+ if (args[1] == "on"):
686+ value = dbus.Boolean(1)
687+ elif (args[1] == "off"):
688+ value = dbus.Boolean(0)
689+ else:
690+ value = dbus.Boolean(args[1])
691+ adapter.SetProperty("Discoverable", value)
692+ sys.exit(0)
693+
694+if (args[0] == "discoverabletimeout"):
695+ if (len(args) < 2):
696+ properties = adapter.GetProperties()
697+ print properties["DiscoverableTimeout"]
698+ else:
699+ timeout = dbus.UInt32(args[1])
700+ adapter.SetProperty("DiscoverableTimeout", timeout)
701+ sys.exit(0)
702+
703+if (args[0] == "discovering"):
704+ properties = adapter.GetProperties()
705+ print properties["Discovering"]
706+ sys.exit(0)
707+
708+print "Unknown command"
709+sys.exit(1)
710
711=== added file '.pc/python3.patch/test/test-attrib'
712--- .pc/python3.patch/test/test-attrib 1970-01-01 00:00:00 +0000
713+++ .pc/python3.patch/test/test-attrib 2012-04-27 03:38:31 +0000
714@@ -0,0 +1,108 @@
715+#!/usr/bin/python
716+# Script for testing the Attribute D-Bus API
717+
718+import sys
719+from optparse import OptionParser, OptionValueError
720+from binascii import hexlify, unhexlify
721+
722+import gobject
723+
724+import sys
725+import dbus
726+import dbus.mainloop.glib
727+from optparse import OptionParser, make_option
728+
729+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
730+bus = dbus.SystemBus()
731+mainloop = gobject.MainLoop()
732+
733+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
734+
735+option_list = [
736+ make_option("-i", "--device", action="store",
737+ type="string", dest="dev_id"),
738+ ]
739+parser = OptionParser(option_list=option_list)
740+
741+(options, args) = parser.parse_args()
742+
743+if options.dev_id:
744+ adapter_path = manager.FindAdapter(options.dev_id)
745+else:
746+ adapter_path = manager.DefaultAdapter()
747+
748+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
749+ "org.bluez.Adapter")
750+
751+if (len(args) < 1):
752+ print "Usage: %s <command>" % (sys.argv[0])
753+ print ""
754+ print " list"
755+ print " services <address>"
756+ print " discover <service path>"
757+ print " chars <service path>"
758+ sys.exit(1)
759+
760+if (args[0] == "list"):
761+ for path in adapter.ListDevices():
762+ device = dbus.Interface(bus.get_object("org.bluez", path),
763+ "org.bluez.Device")
764+ devprop = device.GetProperties()
765+ print "[ %s ]" % devprop["Address"]
766+ for path in devprop["Services"]:
767+
768+ service = dbus.Interface(bus.get_object("org.bluez", path),
769+ "org.bluez.Characteristic")
770+ srvprop = service.GetProperties()
771+ print " * %s" % (path)
772+ print " UUID: %s" % srvprop["UUID"]
773+ print " Chars: ",
774+ for char in srvprop["Characteristics"]:
775+ print "%s " % char,
776+ print
777+ print
778+ print
779+ sys.exit(0)
780+
781+if (args[0] == "services"):
782+ if (len(args) < 2):
783+ print "Need address parameter"
784+ else:
785+ path = adapter.FindDevice(args[1])
786+ device = dbus.Interface(bus.get_object("org.bluez", path),
787+ "org.bluez.Device")
788+ properties = device.GetProperties()
789+ for path in properties["Services"]:
790+ print path
791+ sys.exit(0)
792+
793+if (args[0] == "discover"):
794+ if (len(args) < 2):
795+ print "Need service path parameter"
796+ else:
797+ service = dbus.Interface(bus.get_object("org.bluez", args[1]),
798+ "org.bluez.Characteristic")
799+ for path in service.DiscoverCharacteristics():
800+ print path
801+ sys.exit(0)
802+
803+if (args[0] == "chars"):
804+ if (len(args) < 2):
805+ print "Need service path parameter"
806+ else:
807+ service = dbus.Interface(bus.get_object("org.bluez", args[1]),
808+ "org.bluez.Characteristic")
809+ srvprop = service.GetProperties()
810+ for path in srvprop["Characteristics"]:
811+ print "[ %s ]" % (path)
812+ char = dbus.Interface(bus.get_object("org.bluez", path),
813+ "org.bluez.Characteristic")
814+ charprop = char.GetProperties()
815+ print " Name: %s" % charprop["Name"]
816+ print " UUID: %s" % charprop["UUID"]
817+ print
818+ print
819+ sys.exit(0)
820+
821+print "Unknown command"
822+sys.exit(1)
823
824=== added file '.pc/python3.patch/test/test-audio'
825--- .pc/python3.patch/test/test-audio 1970-01-01 00:00:00 +0000
826+++ .pc/python3.patch/test/test-audio 2012-04-27 03:38:31 +0000
827@@ -0,0 +1,45 @@
828+#!/usr/bin/python
829+
830+import sys
831+import dbus
832+from optparse import OptionParser, make_option
833+
834+bus = dbus.SystemBus()
835+
836+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
837+
838+option_list = [
839+ make_option("-i", "--device", action="store",
840+ type="string", dest="dev_id"),
841+ ]
842+parser = OptionParser(option_list=option_list)
843+
844+(options, args) = parser.parse_args()
845+
846+if options.dev_id:
847+ adapter_path = manager.FindAdapter(options.dev_id)
848+else:
849+ adapter_path = manager.DefaultAdapter()
850+
851+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
852+ "org.bluez.Adapter")
853+
854+if len(args) < 2:
855+ print """Usage: %s <command>
856+
857+ connect <bdaddr>
858+ disconnect <bdaddr>
859+ """ % sys.argv[0]
860+ sys.exit(1)
861+
862+device = adapter.FindDevice(args[1])
863+audio = dbus.Interface(bus.get_object("org.bluez", device),
864+ "org.bluez.Audio")
865+
866+if args[0] == "connect":
867+ audio.Connect()
868+elif args[0] == "disconnect":
869+ audio.Disconnect()
870+else:
871+ print "Unknown command"
872+ sys.exit(1)
873
874=== added file '.pc/python3.patch/test/test-device'
875--- .pc/python3.patch/test/test-device 1970-01-01 00:00:00 +0000
876+++ .pc/python3.patch/test/test-device 2012-04-27 03:38:31 +0000
877@@ -0,0 +1,207 @@
878+#!/usr/bin/python
879+
880+import gobject
881+
882+import sys
883+import dbus
884+import dbus.mainloop.glib
885+import re
886+from optparse import OptionParser, make_option
887+
888+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
889+bus = dbus.SystemBus()
890+mainloop = gobject.MainLoop()
891+
892+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
893+
894+option_list = [
895+ make_option("-i", "--device", action="store",
896+ type="string", dest="dev_id"),
897+ ]
898+parser = OptionParser(option_list=option_list)
899+
900+(options, args) = parser.parse_args()
901+
902+if options.dev_id:
903+ adapter_path = manager.FindAdapter(options.dev_id)
904+else:
905+ adapter_path = manager.DefaultAdapter()
906+
907+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
908+ "org.bluez.Adapter")
909+
910+if (len(args) < 1):
911+ print "Usage: %s <command>" % (sys.argv[0])
912+ print ""
913+ print " list"
914+ print " services <address>"
915+ print " create <address>"
916+ print " remove <address|path>"
917+ print " disconnect <address>"
918+ print " discover <address> [pattern]"
919+ print " class <address>"
920+ print " name <address>"
921+ print " alias <address> [alias]"
922+ print " trusted <address> [yes/no]"
923+ print " blocked <address> [yes/no]"
924+ sys.exit(1)
925+
926+if (args[0] == "list"):
927+ for path in adapter.ListDevices():
928+ device = dbus.Interface(bus.get_object("org.bluez", path),
929+ "org.bluez.Device")
930+ properties = device.GetProperties()
931+ print "%s %s" % (properties["Address"], properties["Alias"])
932+
933+ sys.exit(0)
934+
935+def create_device_reply(device):
936+ print "New device (%s)" % device
937+ mainloop.quit()
938+ sys.exit(0)
939+
940+def create_device_error(error):
941+ print "Creating device failed: %s" % error
942+ mainloop.quit()
943+ sys.exit(1)
944+
945+if (args[0] == "create"):
946+ if (len(args) < 2):
947+ print "Need address parameter"
948+ else:
949+ adapter.CreateDevice(args[1],
950+ reply_handler=create_device_reply,
951+ error_handler=create_device_error)
952+ mainloop.run()
953+
954+if (args[0] == "remove"):
955+ if (len(args) < 2):
956+ print "Need address or object path parameter"
957+ else:
958+ try:
959+ path = adapter.FindDevice(args[1])
960+ except:
961+ path = args[1]
962+ adapter.RemoveDevice(path)
963+ sys.exit(0)
964+
965+if (args[0] == "disconnect"):
966+ if (len(args) < 2):
967+ print "Need address parameter"
968+ else:
969+ path = adapter.FindDevice(args[1])
970+ device = dbus.Interface(bus.get_object("org.bluez", path),
971+ "org.bluez.Device")
972+ device.Disconnect()
973+ sys.exit(0)
974+
975+if (args[0] == "discover"):
976+ if (len(args) < 2):
977+ print "Need address parameter"
978+ else:
979+ path = adapter.FindDevice(args[1])
980+ device = dbus.Interface(bus.get_object("org.bluez", path),
981+ "org.bluez.Device")
982+ if (len(args) < 3):
983+ pattern = ""
984+ else:
985+ pattern = args[2]
986+ services = device.DiscoverServices(pattern);
987+ for key in services.keys():
988+ p = re.compile(">.*?<")
989+ xml = p.sub("><", services[key].replace("\n", ""))
990+ print "[ 0x%5x ]" % (key)
991+ print xml
992+ print
993+ sys.exit(0)
994+
995+if (args[0] == "class"):
996+ if (len(args) < 2):
997+ print "Need address parameter"
998+ else:
999+ path = adapter.FindDevice(args[1])
1000+ device = dbus.Interface(bus.get_object("org.bluez", path),
1001+ "org.bluez.Device")
1002+ properties = device.GetProperties()
1003+ print "0x%06x" % (properties["Class"])
1004+ sys.exit(0)
1005+
1006+if (args[0] == "name"):
1007+ if (len(args) < 2):
1008+ print "Need address parameter"
1009+ else:
1010+ path = adapter.FindDevice(args[1])
1011+ device = dbus.Interface(bus.get_object("org.bluez", path),
1012+ "org.bluez.Device")
1013+ properties = device.GetProperties()
1014+ print properties["Name"]
1015+ sys.exit(0)
1016+
1017+if (args[0] == "alias"):
1018+ if (len(args) < 2):
1019+ print "Need address parameter"
1020+ else:
1021+ path = adapter.FindDevice(args[1])
1022+ device = dbus.Interface(bus.get_object("org.bluez", path),
1023+ "org.bluez.Device")
1024+ if (len(args) < 3):
1025+ properties = device.GetProperties()
1026+ print properties["Alias"]
1027+ else:
1028+ device.SetProperty("Alias", args[2])
1029+ sys.exit(0)
1030+
1031+if (args[0] == "trusted"):
1032+ if (len(args) < 2):
1033+ print "Need address parameter"
1034+ else:
1035+ path = adapter.FindDevice(args[1])
1036+ device = dbus.Interface(bus.get_object("org.bluez", path),
1037+ "org.bluez.Device")
1038+ if (len(args) < 3):
1039+ properties = device.GetProperties()
1040+ print properties["Trusted"]
1041+ else:
1042+ if (args[2] == "yes"):
1043+ value = dbus.Boolean(1)
1044+ elif (args[2] == "no"):
1045+ value = dbus.Boolean(0)
1046+ else:
1047+ value = dbus.Boolean(args[2])
1048+ device.SetProperty("Trusted", value)
1049+ sys.exit(0)
1050+
1051+if (args[0] == "blocked"):
1052+ if (len(args) < 2):
1053+ print "Need address parameter"
1054+ else:
1055+ path = adapter.FindDevice(args[1])
1056+ device = dbus.Interface(bus.get_object("org.bluez", path),
1057+ "org.bluez.Device")
1058+ if (len(args) < 3):
1059+ properties = device.GetProperties()
1060+ print properties["Blocked"]
1061+ else:
1062+ if (args[2] == "yes"):
1063+ value = dbus.Boolean(1)
1064+ elif (args[2] == "no"):
1065+ value = dbus.Boolean(0)
1066+ else:
1067+ value = dbus.Boolean(args[2])
1068+ device.SetProperty("Blocked", value)
1069+ sys.exit(0)
1070+
1071+if (args[0] == "services"):
1072+ if (len(args) < 2):
1073+ print "Need address parameter"
1074+ else:
1075+ path = adapter.FindDevice(args[1])
1076+ device = dbus.Interface(bus.get_object("org.bluez", path),
1077+ "org.bluez.Device")
1078+ properties = device.GetProperties()
1079+ for path in properties["Services"]:
1080+ print path
1081+ sys.exit(0)
1082+
1083+print "Unknown command"
1084+sys.exit(1)
1085
1086=== added file '.pc/python3.patch/test/test-discovery'
1087--- .pc/python3.patch/test/test-discovery 1970-01-01 00:00:00 +0000
1088+++ .pc/python3.patch/test/test-discovery 2012-04-27 03:38:31 +0000
1089@@ -0,0 +1,57 @@
1090+#!/usr/bin/python
1091+
1092+import gobject
1093+
1094+import dbus
1095+import dbus.mainloop.glib
1096+from optparse import OptionParser, make_option
1097+
1098+def device_found(address, properties):
1099+ print "[ " + address + " ]"
1100+
1101+ for key in properties.keys():
1102+ value = properties[key]
1103+ if (key == "Class"):
1104+ print " %s = 0x%06x" % (key, value)
1105+ else:
1106+ print " %s = %s" % (key, value)
1107+
1108+def property_changed(name, value):
1109+ if (name == "Discovering" and not value):
1110+ mainloop.quit()
1111+
1112+if __name__ == '__main__':
1113+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1114+
1115+ bus = dbus.SystemBus()
1116+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1117+ "org.bluez.Manager")
1118+
1119+ option_list = [
1120+ make_option("-i", "--device", action="store",
1121+ type="string", dest="dev_id"),
1122+ ]
1123+ parser = OptionParser(option_list=option_list)
1124+
1125+ (options, args) = parser.parse_args()
1126+
1127+ if options.dev_id:
1128+ adapter_path = manager.FindAdapter(options.dev_id)
1129+ else:
1130+ adapter_path = manager.DefaultAdapter()
1131+
1132+ adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
1133+ "org.bluez.Adapter")
1134+
1135+ bus.add_signal_receiver(device_found,
1136+ dbus_interface = "org.bluez.Adapter",
1137+ signal_name = "DeviceFound")
1138+
1139+ bus.add_signal_receiver(property_changed,
1140+ dbus_interface = "org.bluez.Adapter",
1141+ signal_name = "PropertyChanged")
1142+
1143+ adapter.StartDiscovery()
1144+
1145+ mainloop = gobject.MainLoop()
1146+ mainloop.run()
1147
1148=== added file '.pc/python3.patch/test/test-health'
1149--- .pc/python3.patch/test/test-health 1970-01-01 00:00:00 +0000
1150+++ .pc/python3.patch/test/test-health 2012-04-27 03:38:31 +0000
1151@@ -0,0 +1,217 @@
1152+#!/usr/bin/python
1153+# -*- coding: utf-8 -*-
1154+
1155+import dbus
1156+import dbus.service
1157+import gobject
1158+from dbus.mainloop.glib import DBusGMainLoop
1159+import sys
1160+
1161+DBusGMainLoop(set_as_default=True)
1162+loop = gobject.MainLoop()
1163+
1164+bus = dbus.SystemBus()
1165+
1166+def sig_received(*args, **kwargs):
1167+ if "member" not in kwargs:
1168+ return
1169+ if "path" not in kwargs:
1170+ return;
1171+ sig_name = kwargs["member"]
1172+ path = kwargs["path"]
1173+ print sig_name
1174+ print path
1175+ if sig_name == "PropertyChanged":
1176+ k, v = args
1177+ print k
1178+ print v
1179+ else:
1180+ ob = args[0]
1181+ print ob
1182+
1183+
1184+def enter_mainloop():
1185+ bus.add_signal_receiver(sig_received, bus_name="org.bluez",
1186+ dbus_interface = "org.bluez.HealthDevice",
1187+ path_keyword="path",
1188+ member_keyword="member",
1189+ interface_keyword="interface")
1190+
1191+ try:
1192+ print "Entering main lopp, push Ctrl+C for finish"
1193+
1194+ mainloop = gobject.MainLoop()
1195+ mainloop.run()
1196+ except KeyboardInterrupt:
1197+ pass
1198+ finally:
1199+ print "Exiting, bye"
1200+
1201+hdp_manager = dbus.Interface(bus.get_object("org.bluez", "/org/bluez"),
1202+ "org.bluez.HealthManager")
1203+
1204+role = None
1205+while role == None:
1206+ print "Select 1. source or 2. sink: ",
1207+ try:
1208+ sel = int(sys.stdin.readline())
1209+ if sel == 1:
1210+ role = "Source"
1211+ elif sel == 2:
1212+ role = "Sink"
1213+ else:
1214+ raise ValueError
1215+ except (TypeError, ValueError):
1216+ print "Wrong selection, try again: ",
1217+ except KeyboardInterrupt:
1218+ sys.exit()
1219+
1220+dtype = None
1221+while dtype == None:
1222+ print "Select a data type: ",
1223+ try:
1224+ sel = int(sys.stdin.readline())
1225+ if (sel < 0) or (sel > 65535):
1226+ raise ValueError
1227+ dtype = sel;
1228+ except (TypeError, ValueError):
1229+ print "Wrong selection, try again: ",
1230+ except KeyboardInterrupt:
1231+ sys.exit()
1232+
1233+pref = None
1234+if role == "Source":
1235+ while pref == None:
1236+ try:
1237+ print "Select a preferred data channel type 1.",
1238+ print "reliable 2. streaming: ",
1239+ sel = int(sys.stdin.readline())
1240+ if sel == 1:
1241+ pref = "Reliable"
1242+ elif sel == 2:
1243+ pref = "Streaming"
1244+ else:
1245+ raise ValueError
1246+
1247+ except (TypeError, ValueError):
1248+ print "Wrong selection, try again"
1249+ except KeyboardInterrupt:
1250+ sys.exit()
1251+
1252+ app_path = hdp_manager.CreateApplication({
1253+ "DataType": dbus.types.UInt16(dtype),
1254+ "Role": role,
1255+ "Description": "Test Source",
1256+ "ChannelType": pref})
1257+else:
1258+ app_path = hdp_manager.CreateApplication({
1259+ "DataType": dbus.types.UInt16(dtype),
1260+ "Description": "Test sink",
1261+ "Role": role})
1262+
1263+print "New application created:", app_path
1264+
1265+con = None
1266+while con == None:
1267+ try:
1268+ print "Connect to a remote device (y/n)? ",
1269+ sel = sys.stdin.readline()
1270+ if sel in ("y\n", "yes\n", "Y\n", "YES\n"):
1271+ con = True
1272+ elif sel in ("n\n", "no\n", "N\n", "NO\n"):
1273+ con = False
1274+ else:
1275+ print "Wrong selection, try again."
1276+ except KeyboardInterrupt:
1277+ sys.exit()
1278+
1279+if not con:
1280+ enter_mainloop()
1281+ sys.exit()
1282+
1283+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1284+ "org.bluez.Manager")
1285+
1286+adapters = manager.ListAdapters()
1287+
1288+i = 1
1289+for ad in adapters:
1290+ print "%d. %s" % (i, ad)
1291+ i = i + 1
1292+
1293+print "Select an adapter: ",
1294+select = None
1295+while select == None:
1296+ try:
1297+ pos = int(sys.stdin.readline()) - 1
1298+ if pos < 0:
1299+ raise TypeError
1300+ select = adapters[pos]
1301+ except (TypeError, IndexError, ValueError):
1302+ print "Wrong selection, try again: ",
1303+ except KeyboardInterrupt:
1304+ sys.exit()
1305+
1306+adapter = dbus.Interface(bus.get_object("org.bluez", select),
1307+ "org.bluez.Adapter")
1308+
1309+devices = adapter.ListDevices()
1310+
1311+if len(devices) == 0:
1312+ print "No devices available"
1313+ sys.exit()
1314+
1315+i = 1
1316+for dev in devices:
1317+ print "%d. %s" % (i, dev)
1318+ i = i + 1
1319+
1320+print "Select a device: ",
1321+select = None
1322+while select == None:
1323+ try:
1324+ pos = int(sys.stdin.readline()) - 1
1325+ if pos < 0:
1326+ raise TypeError
1327+ select = devices[pos]
1328+ except (TypeError, IndexError, ValueError):
1329+ print "Wrong selection, try again: ",
1330+ except KeyboardInterrupt:
1331+ sys.exit()
1332+
1333+device = dbus.Interface(bus.get_object("org.bluez", select),
1334+ "org.bluez.HealthDevice")
1335+
1336+echo = None
1337+while echo == None:
1338+ try:
1339+ print "Perform an echo (y/n)? ",
1340+ sel = sys.stdin.readline()
1341+ if sel in ("y\n", "yes\n", "Y\n", "YES\n"):
1342+ echo = True
1343+ elif sel in ("n\n", "no\n", "N\n", "NO\n"):
1344+ echo = False
1345+ else:
1346+ print "Wrong selection, try again."
1347+ except KeyboardInterrupt:
1348+ sys.exit()
1349+
1350+if echo:
1351+ if device.Echo():
1352+ print "Echo was ok"
1353+ else:
1354+ print "Echo war wrong, exiting"
1355+ sys.exit()
1356+
1357+print "Connecting to device %s" % (select)
1358+
1359+if role == "Source":
1360+ chan = device.CreateChannel(app_path, "Reliable")
1361+else:
1362+ chan = device.CreateChannel(app_path, "Any")
1363+
1364+print chan
1365+
1366+enter_mainloop()
1367+
1368+hdp_manager.DestroyApplication(app_path)
1369
1370=== added file '.pc/python3.patch/test/test-health-sink'
1371--- .pc/python3.patch/test/test-health-sink 1970-01-01 00:00:00 +0000
1372+++ .pc/python3.patch/test/test-health-sink 2012-04-27 03:38:31 +0000
1373@@ -0,0 +1,83 @@
1374+#!/usr/bin/python
1375+# -*- coding: utf-8 -*-
1376+
1377+import dbus
1378+import dbus.service
1379+import gobject
1380+from dbus.mainloop.glib import DBusGMainLoop
1381+import sys
1382+
1383+DBusGMainLoop(set_as_default=True)
1384+loop = gobject.MainLoop()
1385+
1386+bus = dbus.SystemBus()
1387+
1388+hdp_manager = dbus.Interface(bus.get_object("org.bluez", "/org/bluez"),
1389+ "org.bluez.HealthManager")
1390+app_path = hdp_manager.CreateApplication({"DataType": dbus.types.UInt16(4103),
1391+ "Role": "sink"})
1392+
1393+print app_path
1394+
1395+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1396+ "org.bluez.Manager")
1397+
1398+adapters = manager.ListAdapters()
1399+
1400+i = 1
1401+for ad in adapters:
1402+ print "%d. %s" % (i, ad)
1403+ i = i + 1
1404+
1405+print "Select an adapter: ",
1406+select = None
1407+while select == None:
1408+ try:
1409+ pos = int(sys.stdin.readline()) - 1
1410+ if pos < 0:
1411+ raise TypeError
1412+ select = adapters[pos]
1413+ except (TypeError, IndexError, ValueError):
1414+ print "Wrong selection, try again: ",
1415+ except KeyboardInterrupt:
1416+ sys.exit()
1417+
1418+adapter = dbus.Interface(bus.get_object("org.bluez", select),
1419+ "org.bluez.Adapter")
1420+
1421+devices = adapter.ListDevices()
1422+
1423+if len(devices) == 0:
1424+ print "No devices available"
1425+ sys.exit()
1426+
1427+i = 1
1428+for dev in devices:
1429+ print "%d. %s" % (i, dev)
1430+ i = i + 1
1431+
1432+print "Select a device: ",
1433+select = None
1434+while select == None:
1435+ try:
1436+ pos = int(sys.stdin.readline()) - 1
1437+ if pos < 0:
1438+ raise TypeError
1439+ select = devices[pos]
1440+ except (TypeError, IndexError, ValueError):
1441+ print "Wrong selection, try again: ",
1442+ except KeyboardInterrupt:
1443+ sys.exit()
1444+
1445+print "Connecting to %s" % (select)
1446+device = dbus.Interface(bus.get_object("org.bluez", select),
1447+ "org.bluez.HealthDevice")
1448+
1449+chan = device.CreateChannel(app_path, "Any")
1450+
1451+print chan
1452+
1453+print "Push Enter for finishing"
1454+sys.stdin.readline()
1455+
1456+hdp_manager.DestroyApplication(app_path)
1457
1458=== added file '.pc/python3.patch/test/test-input'
1459--- .pc/python3.patch/test/test-input 1970-01-01 00:00:00 +0000
1460+++ .pc/python3.patch/test/test-input 2012-04-27 03:38:31 +0000
1461@@ -0,0 +1,45 @@
1462+#!/usr/bin/python
1463+
1464+import sys
1465+import dbus
1466+from optparse import OptionParser, make_option
1467+
1468+bus = dbus.SystemBus()
1469+
1470+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
1471+
1472+option_list = [
1473+ make_option("-i", "--device", action="store",
1474+ type="string", dest="dev_id"),
1475+ ]
1476+parser = OptionParser(option_list=option_list)
1477+
1478+(options, args) = parser.parse_args()
1479+
1480+if options.dev_id:
1481+ adapter_path = manager.FindAdapter(options.dev_id)
1482+else:
1483+ adapter_path = manager.DefaultAdapter()
1484+
1485+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
1486+ "org.bluez.Adapter")
1487+
1488+if len(args) < 2:
1489+ print """Usage: %s <command>
1490+
1491+ connect <bdaddr>
1492+ disconnect <bdaddr>
1493+ """ % sys.argv[0]
1494+ sys.exit(1)
1495+
1496+device = adapter.FindDevice(args[1])
1497+input = dbus.Interface(bus.get_object("org.bluez", device),
1498+ "org.bluez.Input")
1499+
1500+if args[0] == "connect":
1501+ input.Connect()
1502+elif args[0] == "disconnect":
1503+ input.Disconnect()
1504+else:
1505+ print "Unknown command"
1506+ sys.exit(1)
1507
1508=== added file '.pc/python3.patch/test/test-manager'
1509--- .pc/python3.patch/test/test-manager 1970-01-01 00:00:00 +0000
1510+++ .pc/python3.patch/test/test-manager 2012-04-27 03:38:31 +0000
1511@@ -0,0 +1,38 @@
1512+#!/usr/bin/python
1513+
1514+import gobject
1515+
1516+import dbus
1517+import dbus.mainloop.glib
1518+
1519+def adapter_added(path):
1520+ print "Adapter with path %s added" % (path)
1521+
1522+def adapter_removed(path):
1523+ print "Adapter with path %s removed" % (path)
1524+
1525+def default_changed(path):
1526+ print "Default adapter is now at path %s" % (path)
1527+
1528+if __name__ == "__main__":
1529+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1530+
1531+ bus = dbus.SystemBus()
1532+
1533+ manager = dbus.Interface(bus.get_object('org.bluez', '/'),
1534+ 'org.bluez.Manager')
1535+
1536+ manager.connect_to_signal("AdapterAdded", adapter_added)
1537+
1538+ manager.connect_to_signal("AdapterRemoved", adapter_removed)
1539+
1540+ manager.connect_to_signal("DefaultAdapterChanged", default_changed)
1541+
1542+ try:
1543+ path = manager.DefaultAdapter()
1544+ default_changed(path)
1545+ except:
1546+ pass
1547+
1548+ mainloop = gobject.MainLoop()
1549+ mainloop.run()
1550
1551=== added file '.pc/python3.patch/test/test-network'
1552--- .pc/python3.patch/test/test-network 1970-01-01 00:00:00 +0000
1553+++ .pc/python3.patch/test/test-network 2012-04-27 03:38:31 +0000
1554@@ -0,0 +1,57 @@
1555+#!/usr/bin/python
1556+
1557+import sys
1558+import time
1559+import dbus
1560+from optparse import OptionParser, make_option
1561+
1562+bus = dbus.SystemBus()
1563+
1564+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1565+ "org.bluez.Manager")
1566+
1567+option_list = [
1568+ make_option("-i", "--device", action="store",
1569+ type="string", dest="dev_id"),
1570+ ]
1571+parser = OptionParser(option_list=option_list)
1572+
1573+(options, args) = parser.parse_args()
1574+
1575+if options.dev_id:
1576+ adapter_path = manager.FindAdapter(options.dev_id)
1577+else:
1578+ adapter_path = manager.DefaultAdapter()
1579+
1580+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
1581+ "org.bluez.Adapter")
1582+
1583+if (len(args) < 1):
1584+ print "Usage: %s <address> [service]" % (sys.argv[0])
1585+ sys.exit(1)
1586+
1587+address = args[0]
1588+
1589+if (len(args) < 2):
1590+ service = "panu"
1591+else:
1592+ service = args[1]
1593+
1594+device = adapter.FindDevice(address)
1595+
1596+network = dbus.Interface(bus.get_object("org.bluez", device),
1597+ "org.bluez.Network")
1598+
1599+iface = network.Connect(service)
1600+
1601+print "Connected %s to %s" % (device, address)
1602+
1603+print "Press CTRL-C to disconnect"
1604+
1605+try:
1606+ time.sleep(1000)
1607+ print "Terminating connection"
1608+except:
1609+ pass
1610+
1611+network.Disconnect()
1612
1613=== added file '.pc/python3.patch/test/test-oob'
1614--- .pc/python3.patch/test/test-oob 1970-01-01 00:00:00 +0000
1615+++ .pc/python3.patch/test/test-oob 2012-04-27 03:38:31 +0000
1616@@ -0,0 +1,80 @@
1617+#!/usr/bin/python
1618+
1619+import gobject
1620+
1621+import dbus.mainloop.glib
1622+
1623+def create_device_reply(device):
1624+ print "Pairing succeed!"
1625+ mainloop.quit()
1626+
1627+def create_device_error(error):
1628+ print "Pairing failed."
1629+ mainloop.quit()
1630+
1631+if __name__ == '__main__':
1632+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1633+
1634+ mainloop = gobject.MainLoop()
1635+
1636+ bus = dbus.SystemBus()
1637+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1638+ "org.bluez.Manager")
1639+
1640+ adapter0_path = manager.FindAdapter("hci0")
1641+ adapter1_path = manager.FindAdapter("hci1")
1642+
1643+ adapter0 = dbus.Interface(bus.get_object("org.bluez", adapter0_path),
1644+ "org.bluez.Adapter")
1645+ adapter1 = dbus.Interface(bus.get_object("org.bluez", adapter1_path),
1646+ "org.bluez.Adapter")
1647+
1648+ adapter0_address = adapter0.GetProperties()["Address"]
1649+ adapter1_address = adapter1.GetProperties()["Address"]
1650+ print "Adapters:"
1651+ print " hci0: " + adapter0_address
1652+ print " hci1: " + adapter1_address
1653+ print
1654+
1655+ print "Removing any existing bond..."
1656+
1657+ try:
1658+ device = adapter0.FindDevice(adapter1_address)
1659+ adapter0.RemoveDevice(device)
1660+ except:
1661+ pass
1662+
1663+ try:
1664+ device = adapter1.FindDevice(adapter0_address)
1665+ adapter1.RemoveDevice(device)
1666+ except:
1667+ pass
1668+
1669+ print "Done."
1670+ print
1671+ print "Reading local Out of Band data..."
1672+
1673+ oob_adapter0 = dbus.Interface(bus.get_object("org.bluez",
1674+ adapter0_path), "org.bluez.OutOfBand")
1675+ oob_adapter1 = dbus.Interface(bus.get_object("org.bluez",
1676+ adapter1_path), "org.bluez.OutOfBand")
1677+
1678+ oob0 = oob_adapter0.ReadLocalData()
1679+ oob1 = oob_adapter1.ReadLocalData()
1680+
1681+ print "Done."
1682+ print
1683+ print "Exchanging Out of Band data..."
1684+
1685+ oob_adapter0.AddRemoteData(adapter1_address, oob1[0], oob1[1])
1686+ oob_adapter1.AddRemoteData(adapter0_address, oob0[0], oob0[1])
1687+
1688+ print "Done."
1689+ print
1690+ print "Starting to pair."
1691+ adapter1.CreatePairedDevice(adapter0_address, "/test/agent_oob",
1692+ "DisplayYesNo",
1693+ reply_handler=create_device_reply,
1694+ error_handler=create_device_error)
1695+
1696+ mainloop.run()
1697
1698=== added file '.pc/python3.patch/test/test-proximity'
1699--- .pc/python3.patch/test/test-proximity 1970-01-01 00:00:00 +0000
1700+++ .pc/python3.patch/test/test-proximity 2012-04-27 03:38:31 +0000
1701@@ -0,0 +1,66 @@
1702+#!/usr/bin/python
1703+
1704+'''
1705+Proximity Monitor test script
1706+'''
1707+
1708+import gobject
1709+
1710+import sys
1711+import dbus
1712+import dbus.mainloop.glib
1713+from optparse import OptionParser, make_option
1714+
1715+def property_changed(name, value):
1716+
1717+ print "PropertyChanged('%s', '%s')" % (name, value)
1718+ mainloop.quit()
1719+
1720+if __name__ == "__main__":
1721+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1722+
1723+ bus = dbus.SystemBus()
1724+
1725+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1726+ "org.bluez.Manager")
1727+
1728+ option_list = [
1729+ make_option("-i", "--adapter", action="store",
1730+ type="string", dest="dev_id"),
1731+ make_option("-b", "--device", action="store",
1732+ type="string", dest="address"),
1733+
1734+ ]
1735+ parser = OptionParser(option_list=option_list)
1736+
1737+ (options, args) = parser.parse_args()
1738+
1739+ if options.dev_id:
1740+ adapter_path = manager.FindAdapter(options.dev_id)
1741+ else:
1742+ adapter_path = manager.DefaultAdapter()
1743+
1744+ adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
1745+ "org.bluez.Adapter")
1746+
1747+ if (len(args) < 1):
1748+ print "Usage: %s <command>" % (sys.argv[0])
1749+ print ""
1750+ print " -b MAC LinkLossAlertLevel <none|mild|high>"
1751+ print " -b MAC ImmediateAlertLevel <none|mild|high>"
1752+ sys.exit(1)
1753+
1754+ device_path = adapter.FindDevice(options.address)
1755+
1756+ bus.add_signal_receiver(property_changed, bus_name="org.bluez",
1757+ dbus_interface="org.bluez.Proximity",
1758+ signal_name="PropertyChanged")
1759+
1760+ proximity = dbus.Interface(bus.get_object("org.bluez",
1761+ device_path), "org.bluez.Proximity")
1762+
1763+ print "Proximity SetProperty('%s', '%s')" % (args[0], args[1])
1764+ proximity.SetProperty(args[0], args[1])
1765+
1766+ mainloop = gobject.MainLoop()
1767+ mainloop.run()
1768
1769=== added file '.pc/python3.patch/test/test-sap-server'
1770--- .pc/python3.patch/test/test-sap-server 1970-01-01 00:00:00 +0000
1771+++ .pc/python3.patch/test/test-sap-server 2012-04-27 03:38:31 +0000
1772@@ -0,0 +1,138 @@
1773+#!/usr/bin/python
1774+
1775+from sap import *
1776+import time
1777+
1778+def connect_disconnect_by_client(sap):
1779+
1780+ print "[Test] Connect - Disconnect by client \n"
1781+
1782+ try:
1783+ if not sap.isConnected():
1784+ sap.connect()
1785+
1786+ if sap.proc_connect():
1787+ if sap.proc_disconnectByClient():
1788+ print "OK"
1789+ return 0
1790+
1791+ print "NOT OK"
1792+ return 1
1793+
1794+ except BluetoothError , e:
1795+ print "Error " + str(e)
1796+
1797+
1798+def connect_disconnect_by_server_gracefully(sap, timeout=0):
1799+
1800+ print "[Test] Connect - Disconnect by server with timer \n"
1801+
1802+ try:
1803+ if not sap.isConnected():
1804+ sap.connect()
1805+
1806+ if sap.proc_connect():
1807+ if sap.proc_disconnectByServer(timeout):
1808+ print "OK"
1809+ return 0
1810+
1811+ print "NOT OK"
1812+ return 1
1813+
1814+ except BluetoothError , e:
1815+ print "Error " + str(e)
1816+
1817+
1818+def connect_txAPDU_disconnect_by_client(sap):
1819+
1820+ print "[Test] Connect - TX APDU - Disconnect by client \n"
1821+
1822+ try:
1823+ if not sap.isConnected():
1824+ sap.connect()
1825+
1826+ if sap.proc_connect():
1827+ if not sap.proc_transferAPDU():
1828+ print "NOT OK 1"
1829+ return 1
1830+
1831+ if not sap.proc_transferAPDU():
1832+ print "NOT OK 2"
1833+ return 1
1834+
1835+ if not sap.proc_transferAPDU():
1836+ print "NOT OK 3"
1837+ return 1
1838+
1839+ if not sap.proc_transferAPDU():
1840+ print "NOT OK 4"
1841+ return 1
1842+
1843+ if sap.proc_disconnectByClient():
1844+ print "OK"
1845+ return 0
1846+
1847+ print "NOT OK"
1848+ return 1
1849+
1850+ except BluetoothError , e:
1851+ print "Error " + str(e)
1852+
1853+def connect_rfcomm_only_and_wait_for_close_by_server(sap):
1854+
1855+ print "[Test] Connect rfcomm only - Disconnect by server timeout \n"
1856+
1857+ if not sap.isConnected():
1858+ sap.connect()
1859+
1860+ time.sleep(40)
1861+ print "OK"
1862+
1863+def power_sim_off_on(sap):
1864+
1865+ print "[Test] Powe sim off \n"
1866+
1867+ try:
1868+ if not sap.isConnected():
1869+ sap.connect()
1870+
1871+ if sap.proc_connect():
1872+ if not sap.proc_resetSim():
1873+ print "NOT OK"
1874+ return 1
1875+
1876+ if not sap.proc_powerSimOff():
1877+ print "NOT OK"
1878+ return 1
1879+
1880+ if not sap.proc_powerSimOn():
1881+ print "NOT OK"
1882+ return 1
1883+
1884+ if sap.proc_disconnectByClient():
1885+ print "OK"
1886+ return 0
1887+
1888+ print "NOT OK"
1889+ return 1
1890+
1891+ except BluetoothError , e:
1892+ print "Error " + str(e)
1893+
1894+
1895+if __name__ == "__main__":
1896+
1897+ host = "00:00:00:00:00:0" # server bd_addr
1898+ port = 8 # sap server port
1899+
1900+ try:
1901+ s = SAPClient(host, port)
1902+ except BluetoothError , e:
1903+ print "Error " + str(e)
1904+
1905+ connect_disconnect_by_client(s)
1906+ connect_disconnect_by_server_gracefully(s)
1907+ connect_disconnect_by_server_gracefully(s, 40) # wait 40 sec for srv to close rfcomm sock
1908+ connect_rfcomm_only_and_wait_for_close_by_server(s)
1909+ connect_txAPDU_disconnect_by_client(s)
1910+ power_sim_off_on(s)
1911
1912=== added file '.pc/python3.patch/test/test-serial'
1913--- .pc/python3.patch/test/test-serial 1970-01-01 00:00:00 +0000
1914+++ .pc/python3.patch/test/test-serial 2012-04-27 03:38:31 +0000
1915@@ -0,0 +1,56 @@
1916+#!/usr/bin/python
1917+
1918+import sys
1919+import time
1920+import dbus
1921+from optparse import OptionParser, make_option
1922+
1923+bus = dbus.SystemBus()
1924+
1925+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1926+ "org.bluez.Manager")
1927+option_list = [
1928+ make_option("-i", "--device", action="store",
1929+ type="string", dest="dev_id"),
1930+ ]
1931+parser = OptionParser(option_list=option_list)
1932+
1933+(options, args) = parser.parse_args()
1934+
1935+if options.dev_id:
1936+ adapter_path = manager.FindAdapter(options.dev_id)
1937+else:
1938+ adapter_path = manager.DefaultAdapter()
1939+
1940+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
1941+ "org.bluez.Adapter")
1942+
1943+if (len(args) < 1):
1944+ print "Usage: %s <address> [service]" % (sys.argv[0])
1945+ sys.exit(1)
1946+
1947+address = args[0]
1948+
1949+if (len(args) < 2):
1950+ service = "spp"
1951+else:
1952+ service = args[1]
1953+
1954+path = adapter.FindDevice(address)
1955+
1956+serial = dbus.Interface(bus.get_object("org.bluez", path),
1957+ "org.bluez.Serial")
1958+
1959+node = serial.Connect(service)
1960+
1961+print "Connected %s to %s" % (node, address)
1962+
1963+print "Press CTRL-C to disconnect"
1964+
1965+try:
1966+ time.sleep(1000)
1967+ print "Terminating connection"
1968+except:
1969+ pass
1970+
1971+serial.Disconnect(node)
1972
1973=== added file '.pc/python3.patch/test/test-serial-proxy'
1974--- .pc/python3.patch/test/test-serial-proxy 1970-01-01 00:00:00 +0000
1975+++ .pc/python3.patch/test/test-serial-proxy 2012-04-27 03:38:31 +0000
1976@@ -0,0 +1,64 @@
1977+#!/usr/bin/python
1978+
1979+import sys
1980+import time
1981+import dbus
1982+import socket
1983+from optparse import OptionParser, make_option
1984+
1985+bus = dbus.SystemBus()
1986+
1987+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
1988+ "org.bluez.Manager")
1989+option_list = [
1990+ make_option("-i", "--device", action="store",
1991+ type="string", dest="dev_id"),
1992+ ]
1993+parser = OptionParser(option_list=option_list)
1994+
1995+(options, args) = parser.parse_args()
1996+
1997+if options.dev_id:
1998+ adapter_path = manager.FindAdapter(options.dev_id)
1999+else:
2000+ adapter_path = manager.DefaultAdapter()
2001+
2002+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
2003+ "org.bluez.Adapter")
2004+
2005+if (len(args) < 1):
2006+ print "Usage: %s <socket_name> [service]" % (sys.argv[0])
2007+ sys.exit(1)
2008+
2009+socket_name = args[0]
2010+
2011+if (len(args) < 2):
2012+ service = "spp"
2013+else:
2014+ service = args[1]
2015+
2016+sk = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
2017+sk.bind(socket_name)
2018+sk.listen(1)
2019+
2020+proxy_manager = dbus.Interface(bus.get_object("org.bluez", adapter_path),
2021+ "org.bluez.SerialProxyManager")
2022+proxy_path = proxy_manager.CreateProxy(service, socket_name)
2023+
2024+proxy = dbus.Interface(bus.get_object("org.bluez", proxy_path),
2025+ "org.bluez.SerialProxy")
2026+proxy.Enable()
2027+
2028+conn, addr = sk.accept()
2029+
2030+print "Waiting for message"
2031+
2032+while 1:
2033+ data = conn.recv(1024)
2034+ if data:
2035+ print(data)
2036+ break
2037+
2038+proxy.Disable()
2039+proxy_manager.RemoveProxy(proxy_path)
2040+conn.close()
2041
2042=== added file '.pc/python3.patch/test/test-service'
2043--- .pc/python3.patch/test/test-service 1970-01-01 00:00:00 +0000
2044+++ .pc/python3.patch/test/test-service 2012-04-27 03:38:31 +0000
2045@@ -0,0 +1,47 @@
2046+#!/usr/bin/python
2047+
2048+import sys
2049+import dbus
2050+import time
2051+from optparse import OptionParser, make_option
2052+
2053+bus = dbus.SystemBus()
2054+
2055+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
2056+
2057+option_list = [
2058+ make_option("-i", "--device", action="store",
2059+ type="string", dest="dev_id"),
2060+ ]
2061+parser = OptionParser(option_list=option_list)
2062+
2063+(options, args) = parser.parse_args()
2064+
2065+if options.dev_id:
2066+ adapter_path = manager.FindAdapter(options.dev_id)
2067+else:
2068+ adapter_path = manager.DefaultAdapter()
2069+
2070+service = dbus.Interface(bus.get_object("org.bluez", adapter_path),
2071+ "org.bluez.Service")
2072+
2073+if (len(args) < 1):
2074+ print "Usage: %s <command>" % (sys.argv[0])
2075+ print ""
2076+ print " addrecord <file>"
2077+ sys.exit(1)
2078+
2079+if (args[0] == "addrecord"):
2080+ if (len(args) < 2):
2081+ print "Need file parameter"
2082+ else:
2083+ f = open(args[1])
2084+ record = f.read()
2085+ f.close()
2086+ handle = service.AddRecord(record)
2087+ print "0x%x" % (handle)
2088+ time.sleep(120)
2089+ sys.exit(0)
2090+
2091+print "Unknown command"
2092+sys.exit(1)
2093
2094=== added file '.pc/python3.patch/test/test-telephony'
2095--- .pc/python3.patch/test/test-telephony 1970-01-01 00:00:00 +0000
2096+++ .pc/python3.patch/test/test-telephony 2012-04-27 03:38:31 +0000
2097@@ -0,0 +1,176 @@
2098+#!/usr/bin/python
2099+
2100+import sys
2101+import dbus
2102+from optparse import OptionParser, make_option
2103+
2104+bus = dbus.SystemBus()
2105+
2106+manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
2107+
2108+option_list = [
2109+ make_option("-i", "--device", action="store",
2110+ type="string", dest="dev_id"),
2111+ ]
2112+parser = OptionParser(option_list=option_list)
2113+
2114+(options, args) = parser.parse_args()
2115+
2116+if options.dev_id:
2117+ adapter_path = manager.FindAdapter(options.dev_id)
2118+else:
2119+ adapter_path = manager.DefaultAdapter()
2120+
2121+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
2122+ "org.bluez.Adapter")
2123+
2124+test = dbus.Interface(bus.get_object("org.bluez", "/org/bluez/test"),
2125+ "org.bluez.TelephonyTest")
2126+
2127+if len(args) < 1:
2128+ print """Usage: %s <command>
2129+
2130+ connect <bdaddr>
2131+ disconnect <bdaddr>
2132+ outgoing <number>
2133+ incoming <number>
2134+ cancel
2135+ signal <level>
2136+ battery <level>
2137+ roaming <yes|no>
2138+ registration <status>
2139+ subscriber <number>
2140+ speakergain <bdaddr> [level]
2141+ microphonegain <bdaddr> [level]
2142+ play <bdaddr>
2143+ stop <bdaddr>
2144+ """ % sys.argv[0]
2145+ sys.exit(1)
2146+
2147+if args[0] == "connect":
2148+ if len(args) < 2:
2149+ print "Need device address parameter"
2150+ sys.exit(1)
2151+ device = adapter.FindDevice(args[1])
2152+ headset = dbus.Interface(bus.get_object("org.bluez", device),
2153+ "org.bluez.Headset")
2154+ headset.Connect()
2155+ sys.exit(0)
2156+
2157+if args[0] == "disconnect":
2158+ if len(args) < 2:
2159+ print "Need device address parameter"
2160+ sys.exit(1)
2161+ device = adapter.FindDevice(args[1])
2162+ headset = dbus.Interface(bus.get_object("org.bluez", device),
2163+ "org.bluez.Headset")
2164+ headset.Disconnect()
2165+ sys.exit(0)
2166+
2167+if args[0] == "speakergain":
2168+ if len(args) < 2:
2169+ print "Need device address parameter"
2170+ sys.exit(1)
2171+ device = adapter.FindDevice(args[1])
2172+ headset = dbus.Interface(bus.get_object("org.bluez", device),
2173+ "org.bluez.Headset")
2174+ if len(args) > 2:
2175+ headset.SetProperty('SpeakerGain', dbus.UInt16(args[2]))
2176+ else:
2177+ props = headset.GetProperties()
2178+ print props['SpeakerGain']
2179+
2180+ sys.exit(0)
2181+
2182+if args[0] == "microphonegain":
2183+ if len(args) < 2:
2184+ print "Need device address parameter"
2185+ sys.exit(1)
2186+ device = adapter.FindDevice(args[1])
2187+ headset = dbus.Interface(bus.get_object("org.bluez", device),
2188+ "org.bluez.Headset")
2189+ if len(args) > 2:
2190+ headset.SetProperty('MicrophoneGain', dbus.UInt16(args[2]))
2191+ else:
2192+ props = headset.GetProperties()
2193+ print props['MicrophoneGain']
2194+
2195+ sys.exit(0)
2196+
2197+if args[0] == "play":
2198+ if len(args) < 2:
2199+ print "Need device address parameter"
2200+ sys.exit(1)
2201+ device = adapter.FindDevice(args[1])
2202+ headset = dbus.Interface(bus.get_object("org.bluez", device),
2203+ "org.bluez.Headset")
2204+ headset.Play()
2205+
2206+ sys.exit(0)
2207+
2208+if args[0] == "stop":
2209+ if len(args) < 2:
2210+ print "Need device address parameter"
2211+ sys.exit(1)
2212+ device = adapter.FindDevice(args[1])
2213+ headset = dbus.Interface(bus.get_object("org.bluez", device),
2214+ "org.bluez.Headset")
2215+ headset.Stop()
2216+
2217+ sys.exit(0)
2218+
2219+if args[0] == "outgoing":
2220+ if len(args) > 1:
2221+ test.OutgoingCall(args[1])
2222+ else:
2223+ print "Need number parameter"
2224+ sys.exit(0)
2225+
2226+if args[0] == "incoming":
2227+ if len(args) > 1:
2228+ test.IncomingCall(args[1])
2229+ else:
2230+ print "Need number parameter"
2231+ sys.exit(0)
2232+
2233+if args[0] == "cancel":
2234+ test.CancelCall()
2235+ sys.exit(0)
2236+
2237+if args[0] == "signal":
2238+ if len(args) > 1:
2239+ test.SignalStrength(args[1])
2240+ else:
2241+ print "Need signal strength parameter"
2242+ sys.exit(0)
2243+
2244+if args[0] == "battery":
2245+ if len(args) > 1:
2246+ test.BatteryLevel(args[1])
2247+ else:
2248+ print "Need battery level parameter"
2249+ sys.exit(0)
2250+
2251+if args[0] == "roaming":
2252+ if len(args) > 1:
2253+ test.RoamingStatus(args[1] == "yes" or False)
2254+ else:
2255+ print "Need yes/no parameter"
2256+ sys.exit(0)
2257+
2258+if args[0] == "registration":
2259+ if len(args) > 1:
2260+ test.RegistrationStatus(args[1] == "yes" or False)
2261+ else:
2262+ print "Need yes/no parameter"
2263+ sys.exit(0)
2264+
2265+if args[0] == "subscriber":
2266+ if len(args) > 1:
2267+ test.SetSubscriberNumber(args[1])
2268+ else:
2269+ print "Need number parameter"
2270+ sys.exit(0)
2271+
2272+print "Unknown command"
2273+sys.exit(1)
2274
2275=== added file '.pc/python3.patch/test/test-thermometer'
2276--- .pc/python3.patch/test/test-thermometer 1970-01-01 00:00:00 +0000
2277+++ .pc/python3.patch/test/test-thermometer 2012-04-27 03:38:31 +0000
2278@@ -0,0 +1,88 @@
2279+#!/usr/bin/python
2280+
2281+'''
2282+Thermometer test script
2283+'''
2284+
2285+import gobject
2286+
2287+import sys
2288+import dbus
2289+import dbus.service
2290+import dbus.mainloop.glib
2291+from optparse import OptionParser, make_option
2292+
2293+class Watcher(dbus.service.Object):
2294+ @dbus.service.method("org.bluez.ThermometerWatcher",
2295+ in_signature="a{sv}", out_signature="")
2296+ def MeasurementReceived(self, measure):
2297+ print measure["Measurement"], " measurement received"
2298+ print "Exponent: ", measure["Exponent"]
2299+ print "Mantissa: ", measure["Mantissa"]
2300+ print "Unit: ", measure["Unit"]
2301+
2302+ if measure.has_key("Time"):
2303+ print "Time: ", measure["Time"]
2304+
2305+ print "Type: ", measure["Type"]
2306+
2307+def property_changed(name, value):
2308+
2309+ print "PropertyChanged('%s', '%s')" % (name, value)
2310+
2311+if __name__ == "__main__":
2312+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
2313+
2314+ bus = dbus.SystemBus()
2315+
2316+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
2317+ "org.bluez.Manager")
2318+
2319+ option_list = [
2320+ make_option("-i", "--adapter", action="store",
2321+ type="string", dest="adapter"),
2322+ make_option("-b", "--device", action="store",
2323+ type="string", dest="address"),
2324+ ]
2325+
2326+ parser = OptionParser(option_list=option_list)
2327+
2328+ (options, args) = parser.parse_args()
2329+
2330+ if not options.address:
2331+ print "Usage: %s [-i <adapter>] -b <bdaddr> [command]" % (sys.argv[0])
2332+ print "Possible commands:"
2333+ print "\tEnableIntermediateMeasurement"
2334+ sys.exit(1)
2335+
2336+ if options.adapter:
2337+ adapter_path = manager.FindAdapter(options.adapter)
2338+ else:
2339+ adapter_path = manager.DefaultAdapter()
2340+
2341+ adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
2342+ "org.bluez.Adapter")
2343+
2344+ device_path = adapter.FindDevice(options.address)
2345+
2346+ bus.add_signal_receiver(property_changed, bus_name="org.bluez",
2347+ dbus_interface="org.bluez.Thermometer",
2348+ signal_name="PropertyChanged")
2349+
2350+ thermometer = dbus.Interface(bus.get_object("org.bluez",
2351+ device_path), "org.bluez.Thermometer")
2352+
2353+ path = "/test/watcher"
2354+ watcher = Watcher(bus, path)
2355+
2356+ thermometer.RegisterWatcher(path)
2357+
2358+ if len(args) > 0:
2359+ if args[0] == "EnableIntermediateMeasurement":
2360+ thermometer.EnableIntermediateMeasurement(path)
2361+ else:
2362+ print "unknown command"
2363+ sys.exit(1)
2364+
2365+ mainloop = gobject.MainLoop()
2366+ mainloop.run()
2367
2368=== modified file 'debian/changelog'
2369--- debian/changelog 2012-03-21 15:27:57 +0000
2370+++ debian/changelog 2012-04-27 03:38:31 +0000
2371@@ -1,3 +1,9 @@
2372+bluez (4.98-2ubuntu8) UNRELEASED; urgency=low
2373+
2374+ * Switch to python3.
2375+
2376+ -- Steve Langasek <steve.langasek@ubuntu.com> Wed, 25 Apr 2012 23:07:20 -0700
2377+
2378 bluez (4.98-2ubuntu7) precise; urgency=low
2379
2380 * debian/patches/10-unregister_interface_on_exit.patch: unregister the SAP
2381
2382=== modified file 'debian/control'
2383--- debian/control 2012-03-13 19:41:36 +0000
2384+++ debian/control 2012-04-27 03:38:31 +0000
2385@@ -20,7 +20,8 @@
2386 libcap-ng-dev,
2387 libudev-dev,
2388 libreadline-dev,
2389- check (>= 0.9.8-1.1)
2390+ check (>= 0.9.8-1.1),
2391+ python3-dev
2392 Vcs-Svn: svn://svn.debian.org/svn/pkg-bluetooth/packages/bluez/trunk
2393 Vcs-Browser: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk
2394 Homepage: http://www.bluez.org
2395@@ -73,7 +74,7 @@
2396 Package: bluez
2397 Architecture: amd64 armel i386 ia64 mips mipsel powerpc s390 s390x sparc alpha armhf avr32 hppa m68k powerpcspe sh4 sparc64 ppc64
2398 Pre-Depends: ${misc:Pre-Depends}
2399-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, module-init-tools, udev (>= 170-1), lsb-base, dbus, python-dbus
2400+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, module-init-tools, udev (>= 170-1), lsb-base, dbus, python3-dbus
2401 Replaces: bluez-input, bluez-network, bluez-serial, bluez-utils (<= 3.36-3), bluez-audio (<= 3.36-3), udev (<< 170-1)
2402 Conflicts: bluez-utils (<= 3.36-3), bluez-audio (<= 3.36-3)
2403 Breaks: udev (<< 170-1)
2404
2405=== added file 'debian/patches/python3.patch'
2406--- debian/patches/python3.patch 1970-01-01 00:00:00 +0000
2407+++ debian/patches/python3.patch 2012-04-27 03:38:31 +0000
2408@@ -0,0 +1,984 @@
2409+Index: trunk/test/list-devices
2410+===================================================================
2411+--- trunk.orig/test/list-devices
2412++++ trunk/test/list-devices
2413+@@ -1,4 +1,4 @@
2414+-#!/usr/bin/python
2415++#!/usr/bin/python3
2416+
2417+ import dbus
2418+
2419+Index: trunk/test/monitor-bluetooth
2420+===================================================================
2421+--- trunk.orig/test/monitor-bluetooth
2422++++ trunk/test/monitor-bluetooth
2423+@@ -1,4 +1,4 @@
2424+-#!/usr/bin/python
2425++#!/usr/bin/python3
2426+
2427+ import gobject
2428+
2429+Index: trunk/test/simple-agent
2430+===================================================================
2431+--- trunk.orig/test/simple-agent
2432++++ trunk/test/simple-agent
2433+@@ -1,6 +1,6 @@
2434+-#!/usr/bin/python
2435++#!/usr/bin/python3
2436+
2437+-import gobject
2438++from gi.repository import GObject
2439+
2440+ import sys
2441+ import dbus
2442+@@ -20,14 +20,14 @@
2443+ @dbus.service.method("org.bluez.Agent",
2444+ in_signature="", out_signature="")
2445+ def Release(self):
2446+- print "Release"
2447++ print("Release")
2448+ if self.exit_on_release:
2449+ mainloop.quit()
2450+
2451+ @dbus.service.method("org.bluez.Agent",
2452+ in_signature="os", out_signature="")
2453+ def Authorize(self, device, uuid):
2454+- print "Authorize (%s, %s)" % (device, uuid)
2455++ print("Authorize (%s, %s)" % (device, uuid))
2456+ authorize = raw_input("Authorize connection (yes/no): ")
2457+ if (authorize == "yes"):
2458+ return
2459+@@ -36,25 +36,25 @@
2460+ @dbus.service.method("org.bluez.Agent",
2461+ in_signature="o", out_signature="s")
2462+ def RequestPinCode(self, device):
2463+- print "RequestPinCode (%s)" % (device)
2464++ print("RequestPinCode (%s)" % (device))
2465+ return raw_input("Enter PIN Code: ")
2466+
2467+ @dbus.service.method("org.bluez.Agent",
2468+ in_signature="o", out_signature="u")
2469+ def RequestPasskey(self, device):
2470+- print "RequestPasskey (%s)" % (device)
2471++ print("RequestPasskey (%s)" % (device))
2472+ passkey = raw_input("Enter passkey: ")
2473+ return dbus.UInt32(passkey)
2474+
2475+ @dbus.service.method("org.bluez.Agent",
2476+ in_signature="ou", out_signature="")
2477+ def DisplayPasskey(self, device, passkey):
2478+- print "DisplayPasskey (%s, %d)" % (device, passkey)
2479++ print("DisplayPasskey (%s, %d)" % (device, passkey))
2480+
2481+ @dbus.service.method("org.bluez.Agent",
2482+ in_signature="ou", out_signature="")
2483+ def RequestConfirmation(self, device, passkey):
2484+- print "RequestConfirmation (%s, %d)" % (device, passkey)
2485++ print("RequestConfirmation (%s, %d)" % (device, passkey))
2486+ confirm = raw_input("Confirm passkey (yes/no): ")
2487+ if (confirm == "yes"):
2488+ return
2489+@@ -63,7 +63,7 @@
2490+ @dbus.service.method("org.bluez.Agent",
2491+ in_signature="s", out_signature="")
2492+ def ConfirmModeChange(self, mode):
2493+- print "ConfirmModeChange (%s)" % (mode)
2494++ print("ConfirmModeChange (%s)" % (mode))
2495+ authorize = raw_input("Authorize mode change (yes/no): ")
2496+ if (authorize == "yes"):
2497+ return
2498+@@ -72,14 +72,14 @@
2499+ @dbus.service.method("org.bluez.Agent",
2500+ in_signature="", out_signature="")
2501+ def Cancel(self):
2502+- print "Cancel"
2503++ print("Cancel")
2504+
2505+ def create_device_reply(device):
2506+- print "New device (%s)" % (device)
2507++ print("New device (%s)" % (device))
2508+ mainloop.quit()
2509+
2510+ def create_device_error(error):
2511+- print "Creating device failed: %s" % (error)
2512++ print("Creating device failed: %s" % (error))
2513+ mainloop.quit()
2514+
2515+ if __name__ == '__main__':
2516+@@ -109,7 +109,7 @@
2517+ path = "/test/agent"
2518+ agent = Agent(bus, path)
2519+
2520+- mainloop = gobject.MainLoop()
2521++ mainloop = GObject.MainLoop()
2522+
2523+ if len(args) > 1:
2524+ if len(args) > 2:
2525+@@ -122,9 +122,10 @@
2526+ error_handler=create_device_error)
2527+ else:
2528+ adapter.RegisterAgent(path, capability)
2529+- print "Agent registered"
2530++ print("Agent registered")
2531+
2532+ mainloop.run()
2533+
2534+ #adapter.UnregisterAgent(path)
2535+- #print "Agent unregistered"
2536++ #print("Agent unregistered")
2537++
2538+Index: trunk/test/simple-endpoint
2539+===================================================================
2540+--- trunk.orig/test/simple-endpoint
2541++++ trunk/test/simple-endpoint
2542+@@ -1,4 +1,4 @@
2543+-#!/usr/bin/python
2544++#!/usr/bin/python3
2545+
2546+ import sys
2547+ import dbus
2548+Index: trunk/test/simple-service
2549+===================================================================
2550+--- trunk.orig/test/simple-service
2551++++ trunk/test/simple-service
2552+@@ -1,4 +1,4 @@
2553+-#!/usr/bin/python
2554++#!/usr/bin/python3
2555+
2556+ import sys
2557+ import time
2558+@@ -114,13 +114,13 @@
2559+
2560+ handle = service.AddRecord(xml)
2561+
2562+-print "Service record with handle 0x%04x added" % (handle)
2563++print("Service record with handle 0x%04x added" % (handle))
2564+
2565+-print "Press CTRL-C to remove service record"
2566++print("Press CTRL-C to remove service record")
2567+
2568+ try:
2569+ time.sleep(1000)
2570+- print "Terminating session"
2571++ print("Terminating session")
2572+ except:
2573+ pass
2574+
2575+Index: trunk/test/test-adapter
2576+===================================================================
2577+--- trunk.orig/test/test-adapter
2578++++ trunk/test/test-adapter
2579+@@ -1,4 +1,4 @@
2580+-#!/usr/bin/python
2581++#!/usr/bin/python3
2582+
2583+ import sys
2584+ import dbus
2585+@@ -26,28 +26,28 @@
2586+ "org.bluez.Adapter")
2587+
2588+ if (len(args) < 1):
2589+- print "Usage: %s <command>" % (sys.argv[0])
2590+- print ""
2591+- print " address"
2592+- print " list"
2593+- print " name [name]"
2594+- print " powered [on/off]"
2595+- print " pairable [on/off]"
2596+- print " pairabletimeout [timeout]"
2597+- print " discoverable [on/off]"
2598+- print " discoverabletimeout [timeout]"
2599+- print " discovering"
2600++ print("Usage: %s <command>" % (sys.argv[0]))
2601++ print("")
2602++ print(" address")
2603++ print(" list")
2604++ print(" name [name]")
2605++ print(" powered [on/off]")
2606++ print(" pairable [on/off]")
2607++ print(" pairabletimeout [timeout]")
2608++ print(" discoverable [on/off]")
2609++ print(" discoverabletimeout [timeout]")
2610++ print(" discovering")
2611+ sys.exit(1)
2612+
2613+ if (args[0] == "address"):
2614+ properties = adapter.GetProperties()
2615+- print properties["Address"]
2616++ print(properties["Address"])
2617+ sys.exit(0)
2618+
2619+ if (args[0] == "name"):
2620+ if (len(args) < 2):
2621+ properties = adapter.GetProperties()
2622+- print properties["Name"]
2623++ print(properties["Name"])
2624+ else:
2625+ adapter.SetProperty("Name", args[1])
2626+ sys.exit(0)
2627+@@ -59,19 +59,19 @@
2628+ adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
2629+ "org.bluez.Adapter")
2630+ prop = adapter.GetProperties()
2631+- print " [ %s ]" % (adapter_path)
2632+- for (key, value) in prop.iteritems():
2633++ print(" [ %s ]" % (adapter_path))
2634++ for (key, value) in prop.items():
2635+ if (key == "Class"):
2636+- print " %s = 0x%06x" % (key, value)
2637++ print(" %s = 0x%06x" % (key, value))
2638+ else:
2639+- print " %s = %s" % (key, value)
2640+- print
2641++ print(" %s = %s" % (key, value))
2642++ print()
2643+ sys.exit(0)
2644+
2645+ if (args[0] == "powered"):
2646+ if (len(args) < 2):
2647+ properties = adapter.GetProperties()
2648+- print properties["Powered"]
2649++ print(properties["Powered"])
2650+ else:
2651+ if (args[1] == "on"):
2652+ value = dbus.Boolean(1)
2653+@@ -85,7 +85,7 @@
2654+ if (args[0] == "pairable"):
2655+ if (len(args) < 2):
2656+ properties = adapter.GetProperties()
2657+- print properties["Pairable"]
2658++ print(properties["Pairable"])
2659+ else:
2660+ if (args[1] == "on"):
2661+ value = dbus.Boolean(1)
2662+@@ -99,7 +99,7 @@
2663+ if (args[0] == "pairabletimeout"):
2664+ if (len(args) < 2):
2665+ properties = adapter.GetProperties()
2666+- print properties["PairableTimeout"]
2667++ print(properties["PairableTimeout"])
2668+ else:
2669+ timeout = dbus.UInt32(args[1])
2670+ adapter.SetProperty("PairableTimeout", timeout)
2671+@@ -108,7 +108,7 @@
2672+ if (args[0] == "discoverable"):
2673+ if (len(args) < 2):
2674+ properties = adapter.GetProperties()
2675+- print properties["Discoverable"]
2676++ print(properties["Discoverable"])
2677+ else:
2678+ if (args[1] == "on"):
2679+ value = dbus.Boolean(1)
2680+@@ -122,7 +122,7 @@
2681+ if (args[0] == "discoverabletimeout"):
2682+ if (len(args) < 2):
2683+ properties = adapter.GetProperties()
2684+- print properties["DiscoverableTimeout"]
2685++ print(properties["DiscoverableTimeout"])
2686+ else:
2687+ timeout = dbus.UInt32(args[1])
2688+ adapter.SetProperty("DiscoverableTimeout", timeout)
2689+@@ -130,8 +130,8 @@
2690+
2691+ if (args[0] == "discovering"):
2692+ properties = adapter.GetProperties()
2693+- print properties["Discovering"]
2694++ print(properties["Discovering"])
2695+ sys.exit(0)
2696+
2697+-print "Unknown command"
2698++print("Unknown command")
2699+ sys.exit(1)
2700+Index: trunk/test/test-attrib
2701+===================================================================
2702+--- trunk.orig/test/test-attrib
2703++++ trunk/test/test-attrib
2704+@@ -1,4 +1,4 @@
2705+-#!/usr/bin/python
2706++#!/usr/bin/python3
2707+ # Script for testing the Attribute D-Bus API
2708+
2709+ import sys
2710+Index: trunk/test/test-audio
2711+===================================================================
2712+--- trunk.orig/test/test-audio
2713++++ trunk/test/test-audio
2714+@@ -1,4 +1,4 @@
2715+-#!/usr/bin/python
2716++#!/usr/bin/python3
2717+
2718+ import sys
2719+ import dbus
2720+@@ -25,11 +25,11 @@
2721+ "org.bluez.Adapter")
2722+
2723+ if len(args) < 2:
2724+- print """Usage: %s <command>
2725++ print("""Usage: %s <command>
2726+
2727+ connect <bdaddr>
2728+ disconnect <bdaddr>
2729+- """ % sys.argv[0]
2730++ """ % sys.argv[0])
2731+ sys.exit(1)
2732+
2733+ device = adapter.FindDevice(args[1])
2734+@@ -41,5 +41,5 @@
2735+ elif args[0] == "disconnect":
2736+ audio.Disconnect()
2737+ else:
2738+- print "Unknown command"
2739++ print("Unknown command")
2740+ sys.exit(1)
2741+Index: trunk/test/test-device
2742+===================================================================
2743+--- trunk.orig/test/test-device
2744++++ trunk/test/test-device
2745+@@ -1,6 +1,6 @@
2746+-#!/usr/bin/python
2747++#!/usr/bin/python3
2748+
2749+-import gobject
2750++from gi.repository import GObject
2751+
2752+ import sys
2753+ import dbus
2754+@@ -10,7 +10,7 @@
2755+
2756+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
2757+ bus = dbus.SystemBus()
2758+-mainloop = gobject.MainLoop()
2759++mainloop = GObject.MainLoop()
2760+
2761+ manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
2762+
2763+@@ -31,19 +31,19 @@
2764+ "org.bluez.Adapter")
2765+
2766+ if (len(args) < 1):
2767+- print "Usage: %s <command>" % (sys.argv[0])
2768+- print ""
2769+- print " list"
2770+- print " services <address>"
2771+- print " create <address>"
2772+- print " remove <address|path>"
2773+- print " disconnect <address>"
2774+- print " discover <address> [pattern]"
2775+- print " class <address>"
2776+- print " name <address>"
2777+- print " alias <address> [alias]"
2778+- print " trusted <address> [yes/no]"
2779+- print " blocked <address> [yes/no]"
2780++ print("Usage: %s <command>" % (sys.argv[0]))
2781++ print("")
2782++ print(" list")
2783++ print(" services <address>")
2784++ print(" create <address>")
2785++ print(" remove <address|path>")
2786++ print(" disconnect <address>")
2787++ print(" discover <address> [pattern]")
2788++ print(" class <address>")
2789++ print(" name <address>")
2790++ print(" alias <address> [alias]")
2791++ print(" trusted <address> [yes/no]")
2792++ print(" blocked <address> [yes/no]")
2793+ sys.exit(1)
2794+
2795+ if (args[0] == "list"):
2796+@@ -51,23 +51,23 @@
2797+ device = dbus.Interface(bus.get_object("org.bluez", path),
2798+ "org.bluez.Device")
2799+ properties = device.GetProperties()
2800+- print "%s %s" % (properties["Address"], properties["Alias"])
2801++ print("%s %s" % (properties["Address"], properties["Alias"]))
2802+
2803+ sys.exit(0)
2804+
2805+ def create_device_reply(device):
2806+- print "New device (%s)" % device
2807++ print("New device (%s)" % device)
2808+ mainloop.quit()
2809+ sys.exit(0)
2810+
2811+ def create_device_error(error):
2812+- print "Creating device failed: %s" % error
2813++ print("Creating device failed: %s" % error)
2814+ mainloop.quit()
2815+ sys.exit(1)
2816+
2817+ if (args[0] == "create"):
2818+ if (len(args) < 2):
2819+- print "Need address parameter"
2820++ print("Need address parameter")
2821+ else:
2822+ adapter.CreateDevice(args[1],
2823+ reply_handler=create_device_reply,
2824+@@ -76,7 +76,7 @@
2825+
2826+ if (args[0] == "remove"):
2827+ if (len(args) < 2):
2828+- print "Need address or object path parameter"
2829++ print("Need address or object path parameter")
2830+ else:
2831+ try:
2832+ path = adapter.FindDevice(args[1])
2833+@@ -87,7 +87,7 @@
2834+
2835+ if (args[0] == "disconnect"):
2836+ if (len(args) < 2):
2837+- print "Need address parameter"
2838++ print("Need address parameter")
2839+ else:
2840+ path = adapter.FindDevice(args[1])
2841+ device = dbus.Interface(bus.get_object("org.bluez", path),
2842+@@ -97,7 +97,7 @@
2843+
2844+ if (args[0] == "discover"):
2845+ if (len(args) < 2):
2846+- print "Need address parameter"
2847++ print("Need address parameter")
2848+ else:
2849+ path = adapter.FindDevice(args[1])
2850+ device = dbus.Interface(bus.get_object("org.bluez", path),
2851+@@ -110,57 +110,57 @@
2852+ for key in services.keys():
2853+ p = re.compile(">.*?<")
2854+ xml = p.sub("><", services[key].replace("\n", ""))
2855+- print "[ 0x%5x ]" % (key)
2856+- print xml
2857+- print
2858++ print("[ 0x%5x ]" % (key))
2859++ print(xml)
2860++ print()
2861+ sys.exit(0)
2862+
2863+ if (args[0] == "class"):
2864+ if (len(args) < 2):
2865+- print "Need address parameter"
2866++ print("Need address parameter")
2867+ else:
2868+ path = adapter.FindDevice(args[1])
2869+ device = dbus.Interface(bus.get_object("org.bluez", path),
2870+ "org.bluez.Device")
2871+ properties = device.GetProperties()
2872+- print "0x%06x" % (properties["Class"])
2873++ print("0x%06x" % (properties["Class"]))
2874+ sys.exit(0)
2875+
2876+ if (args[0] == "name"):
2877+ if (len(args) < 2):
2878+- print "Need address parameter"
2879++ print("Need address parameter")
2880+ else:
2881+ path = adapter.FindDevice(args[1])
2882+ device = dbus.Interface(bus.get_object("org.bluez", path),
2883+ "org.bluez.Device")
2884+ properties = device.GetProperties()
2885+- print properties["Name"]
2886++ print(properties["Name"])
2887+ sys.exit(0)
2888+
2889+ if (args[0] == "alias"):
2890+ if (len(args) < 2):
2891+- print "Need address parameter"
2892++ print("Need address parameter")
2893+ else:
2894+ path = adapter.FindDevice(args[1])
2895+ device = dbus.Interface(bus.get_object("org.bluez", path),
2896+ "org.bluez.Device")
2897+ if (len(args) < 3):
2898+ properties = device.GetProperties()
2899+- print properties["Alias"]
2900++ print(properties["Alias"])
2901+ else:
2902+ device.SetProperty("Alias", args[2])
2903+ sys.exit(0)
2904+
2905+ if (args[0] == "trusted"):
2906+ if (len(args) < 2):
2907+- print "Need address parameter"
2908++ print("Need address parameter")
2909+ else:
2910+ path = adapter.FindDevice(args[1])
2911+ device = dbus.Interface(bus.get_object("org.bluez", path),
2912+ "org.bluez.Device")
2913+ if (len(args) < 3):
2914+ properties = device.GetProperties()
2915+- print properties["Trusted"]
2916++ print(properties["Trusted"])
2917+ else:
2918+ if (args[2] == "yes"):
2919+ value = dbus.Boolean(1)
2920+@@ -173,14 +173,14 @@
2921+
2922+ if (args[0] == "blocked"):
2923+ if (len(args) < 2):
2924+- print "Need address parameter"
2925++ print("Need address parameter")
2926+ else:
2927+ path = adapter.FindDevice(args[1])
2928+ device = dbus.Interface(bus.get_object("org.bluez", path),
2929+ "org.bluez.Device")
2930+ if (len(args) < 3):
2931+ properties = device.GetProperties()
2932+- print properties["Blocked"]
2933++ print(properties["Blocked"])
2934+ else:
2935+ if (args[2] == "yes"):
2936+ value = dbus.Boolean(1)
2937+@@ -193,15 +193,15 @@
2938+
2939+ if (args[0] == "services"):
2940+ if (len(args) < 2):
2941+- print "Need address parameter"
2942++ print("Need address parameter")
2943+ else:
2944+ path = adapter.FindDevice(args[1])
2945+ device = dbus.Interface(bus.get_object("org.bluez", path),
2946+ "org.bluez.Device")
2947+ properties = device.GetProperties()
2948+ for path in properties["Services"]:
2949+- print path
2950++ print(path)
2951+ sys.exit(0)
2952+
2953+-print "Unknown command"
2954++print("Unknown command")
2955+ sys.exit(1)
2956+Index: trunk/test/test-discovery
2957+===================================================================
2958+--- trunk.orig/test/test-discovery
2959++++ trunk/test/test-discovery
2960+@@ -1,20 +1,20 @@
2961+-#!/usr/bin/python
2962++#!/usr/bin/python3
2963+
2964+-import gobject
2965++from gi.repository import GObject
2966+
2967+ import dbus
2968+ import dbus.mainloop.glib
2969+ from optparse import OptionParser, make_option
2970+
2971+ def device_found(address, properties):
2972+- print "[ " + address + " ]"
2973++ print("[ " + address + " ]")
2974+
2975+ for key in properties.keys():
2976+ value = properties[key]
2977+ if (key == "Class"):
2978+- print " %s = 0x%06x" % (key, value)
2979++ print(" %s = 0x%06x" % (key, value))
2980+ else:
2981+- print " %s = %s" % (key, value)
2982++ print(" %s = %s" % (key, value))
2983+
2984+ def property_changed(name, value):
2985+ if (name == "Discovering" and not value):
2986+@@ -53,5 +53,5 @@
2987+
2988+ adapter.StartDiscovery()
2989+
2990+- mainloop = gobject.MainLoop()
2991++ mainloop = GObject.MainLoop()
2992+ mainloop.run()
2993+Index: trunk/test/test-health
2994+===================================================================
2995+--- trunk.orig/test/test-health
2996++++ trunk/test/test-health
2997+@@ -1,4 +1,4 @@
2998+-#!/usr/bin/python
2999++#!/usr/bin/python3
3000+ # -*- coding: utf-8 -*-
3001+
3002+ import dbus
3003+Index: trunk/test/test-health-sink
3004+===================================================================
3005+--- trunk.orig/test/test-health-sink
3006++++ trunk/test/test-health-sink
3007+@@ -1,4 +1,4 @@
3008+-#!/usr/bin/python
3009++#!/usr/bin/python3
3010+ # -*- coding: utf-8 -*-
3011+
3012+ import dbus
3013+Index: trunk/test/test-input
3014+===================================================================
3015+--- trunk.orig/test/test-input
3016++++ trunk/test/test-input
3017+@@ -1,4 +1,4 @@
3018+-#!/usr/bin/python
3019++#!/usr/bin/python3
3020+
3021+ import sys
3022+ import dbus
3023+@@ -25,11 +25,11 @@
3024+ "org.bluez.Adapter")
3025+
3026+ if len(args) < 2:
3027+- print """Usage: %s <command>
3028++ print("""Usage: %s <command>
3029+
3030+ connect <bdaddr>
3031+ disconnect <bdaddr>
3032+- """ % sys.argv[0]
3033++ """ % sys.argv[0])
3034+ sys.exit(1)
3035+
3036+ device = adapter.FindDevice(args[1])
3037+@@ -41,5 +41,5 @@
3038+ elif args[0] == "disconnect":
3039+ input.Disconnect()
3040+ else:
3041+- print "Unknown command"
3042++ print("Unknown command")
3043+ sys.exit(1)
3044+Index: trunk/test/test-manager
3045+===================================================================
3046+--- trunk.orig/test/test-manager
3047++++ trunk/test/test-manager
3048+@@ -1,18 +1,18 @@
3049+-#!/usr/bin/python
3050++#!/usr/bin/python3
3051+
3052+-import gobject
3053++from gi.repository import GObject
3054+
3055+ import dbus
3056+ import dbus.mainloop.glib
3057+
3058+ def adapter_added(path):
3059+- print "Adapter with path %s added" % (path)
3060++ print("Adapter with path %s added" % (path))
3061+
3062+ def adapter_removed(path):
3063+- print "Adapter with path %s removed" % (path)
3064++ print("Adapter with path %s removed" % (path))
3065+
3066+ def default_changed(path):
3067+- print "Default adapter is now at path %s" % (path)
3068++ print("Default adapter is now at path %s" % (path))
3069+
3070+ if __name__ == "__main__":
3071+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
3072+@@ -34,5 +34,5 @@
3073+ except:
3074+ pass
3075+
3076+- mainloop = gobject.MainLoop()
3077++ mainloop = GObject.MainLoop()
3078+ mainloop.run()
3079+Index: trunk/test/test-network
3080+===================================================================
3081+--- trunk.orig/test/test-network
3082++++ trunk/test/test-network
3083+@@ -1,4 +1,4 @@
3084+-#!/usr/bin/python
3085++#!/usr/bin/python3
3086+
3087+ import sys
3088+ import time
3089+@@ -27,7 +27,7 @@
3090+ "org.bluez.Adapter")
3091+
3092+ if (len(args) < 1):
3093+- print "Usage: %s <address> [service]" % (sys.argv[0])
3094++ print("Usage: %s <address> [service]" % (sys.argv[0]))
3095+ sys.exit(1)
3096+
3097+ address = args[0]
3098+@@ -44,13 +44,13 @@
3099+
3100+ iface = network.Connect(service)
3101+
3102+-print "Connected %s to %s" % (device, address)
3103++print("Connected %s to %s" % (device, address))
3104+
3105+-print "Press CTRL-C to disconnect"
3106++print("Press CTRL-C to disconnect")
3107+
3108+ try:
3109+ time.sleep(1000)
3110+- print "Terminating connection"
3111++ print("Terminating connection")
3112+ except:
3113+ pass
3114+
3115+Index: trunk/test/test-oob
3116+===================================================================
3117+--- trunk.orig/test/test-oob
3118++++ trunk/test/test-oob
3119+@@ -1,4 +1,4 @@
3120+-#!/usr/bin/python
3121++#!/usr/bin/python3
3122+
3123+ import gobject
3124+
3125+Index: trunk/test/test-proximity
3126+===================================================================
3127+--- trunk.orig/test/test-proximity
3128++++ trunk/test/test-proximity
3129+@@ -1,4 +1,4 @@
3130+-#!/usr/bin/python
3131++#!/usr/bin/python3
3132+
3133+ '''
3134+ Proximity Monitor test script
3135+Index: trunk/test/test-sap-server
3136+===================================================================
3137+--- trunk.orig/test/test-sap-server
3138++++ trunk/test/test-sap-server
3139+@@ -1,4 +1,4 @@
3140+-#!/usr/bin/python
3141++#!/usr/bin/python3
3142+
3143+ from sap import *
3144+ import time
3145+Index: trunk/test/test-serial
3146+===================================================================
3147+--- trunk.orig/test/test-serial
3148++++ trunk/test/test-serial
3149+@@ -1,4 +1,4 @@
3150+-#!/usr/bin/python
3151++#!/usr/bin/python3
3152+
3153+ import sys
3154+ import time
3155+@@ -26,7 +26,7 @@
3156+ "org.bluez.Adapter")
3157+
3158+ if (len(args) < 1):
3159+- print "Usage: %s <address> [service]" % (sys.argv[0])
3160++ print("Usage: %s <address> [service]" % (sys.argv[0]))
3161+ sys.exit(1)
3162+
3163+ address = args[0]
3164+@@ -43,13 +43,13 @@
3165+
3166+ node = serial.Connect(service)
3167+
3168+-print "Connected %s to %s" % (node, address)
3169++print("Connected %s to %s" % (node, address))
3170+
3171+-print "Press CTRL-C to disconnect"
3172++print("Press CTRL-C to disconnect")
3173+
3174+ try:
3175+ time.sleep(1000)
3176+- print "Terminating connection"
3177++ print("Terminating connection")
3178+ except:
3179+ pass
3180+
3181+Index: trunk/test/test-serial-proxy
3182+===================================================================
3183+--- trunk.orig/test/test-serial-proxy
3184++++ trunk/test/test-serial-proxy
3185+@@ -1,4 +1,4 @@
3186+-#!/usr/bin/python
3187++#!/usr/bin/python3
3188+
3189+ import sys
3190+ import time
3191+Index: trunk/test/test-service
3192+===================================================================
3193+--- trunk.orig/test/test-service
3194++++ trunk/test/test-service
3195+@@ -1,4 +1,4 @@
3196+-#!/usr/bin/python
3197++#!/usr/bin/python3
3198+
3199+ import sys
3200+ import dbus
3201+@@ -26,22 +26,22 @@
3202+ "org.bluez.Service")
3203+
3204+ if (len(args) < 1):
3205+- print "Usage: %s <command>" % (sys.argv[0])
3206+- print ""
3207+- print " addrecord <file>"
3208++ print("Usage: %s <command>" % (sys.argv[0]))
3209++ print("")
3210++ print(" addrecord <file>")
3211+ sys.exit(1)
3212+
3213+ if (args[0] == "addrecord"):
3214+ if (len(args) < 2):
3215+- print "Need file parameter"
3216++ print("Need file parameter")
3217+ else:
3218+ f = open(args[1])
3219+ record = f.read()
3220+ f.close()
3221+ handle = service.AddRecord(record)
3222+- print "0x%x" % (handle)
3223++ print("0x%x" % (handle))
3224+ time.sleep(120)
3225+ sys.exit(0)
3226+
3227+-print "Unknown command"
3228++print("Unknown command")
3229+ sys.exit(1)
3230+Index: trunk/test/test-telephony
3231+===================================================================
3232+--- trunk.orig/test/test-telephony
3233++++ trunk/test/test-telephony
3234+@@ -1,4 +1,4 @@
3235+-#!/usr/bin/python
3236++#!/usr/bin/python3
3237+
3238+ import sys
3239+ import dbus
3240+@@ -28,7 +28,7 @@
3241+ "org.bluez.TelephonyTest")
3242+
3243+ if len(args) < 1:
3244+- print """Usage: %s <command>
3245++ print("""Usage: %s <command>
3246+
3247+ connect <bdaddr>
3248+ disconnect <bdaddr>
3249+@@ -44,12 +44,12 @@
3250+ microphonegain <bdaddr> [level]
3251+ play <bdaddr>
3252+ stop <bdaddr>
3253+- """ % sys.argv[0]
3254++ """ % sys.argv[0])
3255+ sys.exit(1)
3256+
3257+ if args[0] == "connect":
3258+ if len(args) < 2:
3259+- print "Need device address parameter"
3260++ print("Need device address parameter")
3261+ sys.exit(1)
3262+ device = adapter.FindDevice(args[1])
3263+ headset = dbus.Interface(bus.get_object("org.bluez", device),
3264+@@ -59,7 +59,7 @@
3265+
3266+ if args[0] == "disconnect":
3267+ if len(args) < 2:
3268+- print "Need device address parameter"
3269++ print("Need device address parameter")
3270+ sys.exit(1)
3271+ device = adapter.FindDevice(args[1])
3272+ headset = dbus.Interface(bus.get_object("org.bluez", device),
3273+@@ -69,7 +69,7 @@
3274+
3275+ if args[0] == "speakergain":
3276+ if len(args) < 2:
3277+- print "Need device address parameter"
3278++ print("Need device address parameter")
3279+ sys.exit(1)
3280+ device = adapter.FindDevice(args[1])
3281+ headset = dbus.Interface(bus.get_object("org.bluez", device),
3282+@@ -78,13 +78,13 @@
3283+ headset.SetProperty('SpeakerGain', dbus.UInt16(args[2]))
3284+ else:
3285+ props = headset.GetProperties()
3286+- print props['SpeakerGain']
3287++ print(props['SpeakerGain'])
3288+
3289+ sys.exit(0)
3290+
3291+ if args[0] == "microphonegain":
3292+ if len(args) < 2:
3293+- print "Need device address parameter"
3294++ print("Need device address parameter")
3295+ sys.exit(1)
3296+ device = adapter.FindDevice(args[1])
3297+ headset = dbus.Interface(bus.get_object("org.bluez", device),
3298+@@ -93,13 +93,13 @@
3299+ headset.SetProperty('MicrophoneGain', dbus.UInt16(args[2]))
3300+ else:
3301+ props = headset.GetProperties()
3302+- print props['MicrophoneGain']
3303++ print(props['MicrophoneGain'])
3304+
3305+ sys.exit(0)
3306+
3307+ if args[0] == "play":
3308+ if len(args) < 2:
3309+- print "Need device address parameter"
3310++ print("Need device address parameter")
3311+ sys.exit(1)
3312+ device = adapter.FindDevice(args[1])
3313+ headset = dbus.Interface(bus.get_object("org.bluez", device),
3314+@@ -110,7 +110,7 @@
3315+
3316+ if args[0] == "stop":
3317+ if len(args) < 2:
3318+- print "Need device address parameter"
3319++ print("Need device address parameter")
3320+ sys.exit(1)
3321+ device = adapter.FindDevice(args[1])
3322+ headset = dbus.Interface(bus.get_object("org.bluez", device),
3323+@@ -123,14 +123,14 @@
3324+ if len(args) > 1:
3325+ test.OutgoingCall(args[1])
3326+ else:
3327+- print "Need number parameter"
3328++ print("Need number parameter")
3329+ sys.exit(0)
3330+
3331+ if args[0] == "incoming":
3332+ if len(args) > 1:
3333+ test.IncomingCall(args[1])
3334+ else:
3335+- print "Need number parameter"
3336++ print("Need number parameter")
3337+ sys.exit(0)
3338+
3339+ if args[0] == "cancel":
3340+@@ -141,36 +141,36 @@
3341+ if len(args) > 1:
3342+ test.SignalStrength(args[1])
3343+ else:
3344+- print "Need signal strength parameter"
3345++ print("Need signal strength parameter")
3346+ sys.exit(0)
3347+
3348+ if args[0] == "battery":
3349+ if len(args) > 1:
3350+ test.BatteryLevel(args[1])
3351+ else:
3352+- print "Need battery level parameter"
3353++ print("Need battery level parameter")
3354+ sys.exit(0)
3355+
3356+ if args[0] == "roaming":
3357+ if len(args) > 1:
3358+ test.RoamingStatus(args[1] == "yes" or False)
3359+ else:
3360+- print "Need yes/no parameter"
3361++ print("Need yes/no parameter")
3362+ sys.exit(0)
3363+
3364+ if args[0] == "registration":
3365+ if len(args) > 1:
3366+ test.RegistrationStatus(args[1] == "yes" or False)
3367+ else:
3368+- print "Need yes/no parameter"
3369++ print("Need yes/no parameter")
3370+ sys.exit(0)
3371+
3372+ if args[0] == "subscriber":
3373+ if len(args) > 1:
3374+ test.SetSubscriberNumber(args[1])
3375+ else:
3376+- print "Need number parameter"
3377++ print("Need number parameter")
3378+ sys.exit(0)
3379+
3380+-print "Unknown command"
3381++print("Unknown command")
3382+ sys.exit(1)
3383+Index: trunk/test/test-thermometer
3384+===================================================================
3385+--- trunk.orig/test/test-thermometer
3386++++ trunk/test/test-thermometer
3387+@@ -1,4 +1,4 @@
3388+-#!/usr/bin/python
3389++#!/usr/bin/python3
3390+
3391+ '''
3392+ Thermometer test script
3393
3394=== modified file 'debian/patches/series'
3395--- debian/patches/series 2012-03-21 15:27:57 +0000
3396+++ debian/patches/series 2012-04-27 03:38:31 +0000
3397@@ -9,3 +9,4 @@
3398 enable_audio_profiles.patch
3399 10-unregister_interface_on_exit.patch
3400 11-explicitly_close.patch
3401+python3.patch
3402
3403=== modified file 'debian/rules'
3404--- debian/rules 2012-02-22 10:51:07 +0000
3405+++ debian/rules 2012-04-27 03:38:31 +0000
3406@@ -71,5 +71,8 @@
3407 install -D -m 0644 $(CURDIR)/debian/bluetooth-dbus.conf \
3408 $(CURDIR)/debian/bluez/etc/dbus-1/system.d/bluetooth.conf
3409
3410+common-install-arch::
3411+ dh_python3
3412+
3413 clean::
3414 -rm -f $(CURDIR)/debian/bluez-pcmcia-support.udev
3415
3416=== modified file 'test/list-devices'
3417--- test/list-devices 2012-01-24 05:35:09 +0000
3418+++ test/list-devices 2012-04-27 03:38:31 +0000
3419@@ -1,4 +1,4 @@
3420-#!/usr/bin/python
3421+#!/usr/bin/python3
3422
3423 import dbus
3424
3425
3426=== modified file 'test/monitor-bluetooth'
3427--- test/monitor-bluetooth 2010-12-02 12:17:48 +0000
3428+++ test/monitor-bluetooth 2012-04-27 03:38:31 +0000
3429@@ -1,4 +1,4 @@
3430-#!/usr/bin/python
3431+#!/usr/bin/python3
3432
3433 import gobject
3434
3435
3436=== modified file 'test/simple-agent'
3437--- test/simple-agent 2011-07-28 16:47:35 +0000
3438+++ test/simple-agent 2012-04-27 03:38:31 +0000
3439@@ -1,6 +1,6 @@
3440-#!/usr/bin/python
3441+#!/usr/bin/python3
3442
3443-import gobject
3444+from gi.repository import GObject
3445
3446 import sys
3447 import dbus
3448@@ -20,14 +20,14 @@
3449 @dbus.service.method("org.bluez.Agent",
3450 in_signature="", out_signature="")
3451 def Release(self):
3452- print "Release"
3453+ print("Release")
3454 if self.exit_on_release:
3455 mainloop.quit()
3456
3457 @dbus.service.method("org.bluez.Agent",
3458 in_signature="os", out_signature="")
3459 def Authorize(self, device, uuid):
3460- print "Authorize (%s, %s)" % (device, uuid)
3461+ print("Authorize (%s, %s)" % (device, uuid))
3462 authorize = raw_input("Authorize connection (yes/no): ")
3463 if (authorize == "yes"):
3464 return
3465@@ -36,25 +36,25 @@
3466 @dbus.service.method("org.bluez.Agent",
3467 in_signature="o", out_signature="s")
3468 def RequestPinCode(self, device):
3469- print "RequestPinCode (%s)" % (device)
3470+ print("RequestPinCode (%s)" % (device))
3471 return raw_input("Enter PIN Code: ")
3472
3473 @dbus.service.method("org.bluez.Agent",
3474 in_signature="o", out_signature="u")
3475 def RequestPasskey(self, device):
3476- print "RequestPasskey (%s)" % (device)
3477+ print("RequestPasskey (%s)" % (device))
3478 passkey = raw_input("Enter passkey: ")
3479 return dbus.UInt32(passkey)
3480
3481 @dbus.service.method("org.bluez.Agent",
3482 in_signature="ou", out_signature="")
3483 def DisplayPasskey(self, device, passkey):
3484- print "DisplayPasskey (%s, %d)" % (device, passkey)
3485+ print("DisplayPasskey (%s, %d)" % (device, passkey))
3486
3487 @dbus.service.method("org.bluez.Agent",
3488 in_signature="ou", out_signature="")
3489 def RequestConfirmation(self, device, passkey):
3490- print "RequestConfirmation (%s, %d)" % (device, passkey)
3491+ print("RequestConfirmation (%s, %d)" % (device, passkey))
3492 confirm = raw_input("Confirm passkey (yes/no): ")
3493 if (confirm == "yes"):
3494 return
3495@@ -63,7 +63,7 @@
3496 @dbus.service.method("org.bluez.Agent",
3497 in_signature="s", out_signature="")
3498 def ConfirmModeChange(self, mode):
3499- print "ConfirmModeChange (%s)" % (mode)
3500+ print("ConfirmModeChange (%s)" % (mode))
3501 authorize = raw_input("Authorize mode change (yes/no): ")
3502 if (authorize == "yes"):
3503 return
3504@@ -72,14 +72,14 @@
3505 @dbus.service.method("org.bluez.Agent",
3506 in_signature="", out_signature="")
3507 def Cancel(self):
3508- print "Cancel"
3509+ print("Cancel")
3510
3511 def create_device_reply(device):
3512- print "New device (%s)" % (device)
3513+ print("New device (%s)" % (device))
3514 mainloop.quit()
3515
3516 def create_device_error(error):
3517- print "Creating device failed: %s" % (error)
3518+ print("Creating device failed: %s" % (error))
3519 mainloop.quit()
3520
3521 if __name__ == '__main__':
3522@@ -109,7 +109,7 @@
3523 path = "/test/agent"
3524 agent = Agent(bus, path)
3525
3526- mainloop = gobject.MainLoop()
3527+ mainloop = GObject.MainLoop()
3528
3529 if len(args) > 1:
3530 if len(args) > 2:
3531@@ -122,9 +122,10 @@
3532 error_handler=create_device_error)
3533 else:
3534 adapter.RegisterAgent(path, capability)
3535- print "Agent registered"
3536+ print("Agent registered")
3537
3538 mainloop.run()
3539
3540 #adapter.UnregisterAgent(path)
3541- #print "Agent unregistered"
3542+ #print("Agent unregistered")
3543+
3544
3545=== modified file 'test/simple-endpoint'
3546--- test/simple-endpoint 2010-12-02 12:17:48 +0000
3547+++ test/simple-endpoint 2012-04-27 03:38:31 +0000
3548@@ -1,4 +1,4 @@
3549-#!/usr/bin/python
3550+#!/usr/bin/python3
3551
3552 import sys
3553 import dbus
3554
3555=== modified file 'test/simple-service'
3556--- test/simple-service 2008-10-07 12:10:29 +0000
3557+++ test/simple-service 2012-04-27 03:38:31 +0000
3558@@ -1,4 +1,4 @@
3559-#!/usr/bin/python
3560+#!/usr/bin/python3
3561
3562 import sys
3563 import time
3564@@ -114,13 +114,13 @@
3565
3566 handle = service.AddRecord(xml)
3567
3568-print "Service record with handle 0x%04x added" % (handle)
3569+print("Service record with handle 0x%04x added" % (handle))
3570
3571-print "Press CTRL-C to remove service record"
3572+print("Press CTRL-C to remove service record")
3573
3574 try:
3575 time.sleep(1000)
3576- print "Terminating session"
3577+ print("Terminating session")
3578 except:
3579 pass
3580
3581
3582=== modified file 'test/test-adapter'
3583--- test/test-adapter 2012-02-22 10:51:07 +0000
3584+++ test/test-adapter 2012-04-27 03:38:31 +0000
3585@@ -1,4 +1,4 @@
3586-#!/usr/bin/python
3587+#!/usr/bin/python3
3588
3589 import sys
3590 import dbus
3591@@ -26,28 +26,28 @@
3592 "org.bluez.Adapter")
3593
3594 if (len(args) < 1):
3595- print "Usage: %s <command>" % (sys.argv[0])
3596- print ""
3597- print " address"
3598- print " list"
3599- print " name [name]"
3600- print " powered [on/off]"
3601- print " pairable [on/off]"
3602- print " pairabletimeout [timeout]"
3603- print " discoverable [on/off]"
3604- print " discoverabletimeout [timeout]"
3605- print " discovering"
3606+ print("Usage: %s <command>" % (sys.argv[0]))
3607+ print("")
3608+ print(" address")
3609+ print(" list")
3610+ print(" name [name]")
3611+ print(" powered [on/off]")
3612+ print(" pairable [on/off]")
3613+ print(" pairabletimeout [timeout]")
3614+ print(" discoverable [on/off]")
3615+ print(" discoverabletimeout [timeout]")
3616+ print(" discovering")
3617 sys.exit(1)
3618
3619 if (args[0] == "address"):
3620 properties = adapter.GetProperties()
3621- print properties["Address"]
3622+ print(properties["Address"])
3623 sys.exit(0)
3624
3625 if (args[0] == "name"):
3626 if (len(args) < 2):
3627 properties = adapter.GetProperties()
3628- print properties["Name"]
3629+ print(properties["Name"])
3630 else:
3631 adapter.SetProperty("Name", args[1])
3632 sys.exit(0)
3633@@ -59,19 +59,19 @@
3634 adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
3635 "org.bluez.Adapter")
3636 prop = adapter.GetProperties()
3637- print " [ %s ]" % (adapter_path)
3638- for (key, value) in prop.iteritems():
3639+ print(" [ %s ]" % (adapter_path))
3640+ for (key, value) in prop.items():
3641 if (key == "Class"):
3642- print " %s = 0x%06x" % (key, value)
3643+ print(" %s = 0x%06x" % (key, value))
3644 else:
3645- print " %s = %s" % (key, value)
3646- print
3647+ print(" %s = %s" % (key, value))
3648+ print()
3649 sys.exit(0)
3650
3651 if (args[0] == "powered"):
3652 if (len(args) < 2):
3653 properties = adapter.GetProperties()
3654- print properties["Powered"]
3655+ print(properties["Powered"])
3656 else:
3657 if (args[1] == "on"):
3658 value = dbus.Boolean(1)
3659@@ -85,7 +85,7 @@
3660 if (args[0] == "pairable"):
3661 if (len(args) < 2):
3662 properties = adapter.GetProperties()
3663- print properties["Pairable"]
3664+ print(properties["Pairable"])
3665 else:
3666 if (args[1] == "on"):
3667 value = dbus.Boolean(1)
3668@@ -99,7 +99,7 @@
3669 if (args[0] == "pairabletimeout"):
3670 if (len(args) < 2):
3671 properties = adapter.GetProperties()
3672- print properties["PairableTimeout"]
3673+ print(properties["PairableTimeout"])
3674 else:
3675 timeout = dbus.UInt32(args[1])
3676 adapter.SetProperty("PairableTimeout", timeout)
3677@@ -108,7 +108,7 @@
3678 if (args[0] == "discoverable"):
3679 if (len(args) < 2):
3680 properties = adapter.GetProperties()
3681- print properties["Discoverable"]
3682+ print(properties["Discoverable"])
3683 else:
3684 if (args[1] == "on"):
3685 value = dbus.Boolean(1)
3686@@ -122,7 +122,7 @@
3687 if (args[0] == "discoverabletimeout"):
3688 if (len(args) < 2):
3689 properties = adapter.GetProperties()
3690- print properties["DiscoverableTimeout"]
3691+ print(properties["DiscoverableTimeout"])
3692 else:
3693 timeout = dbus.UInt32(args[1])
3694 adapter.SetProperty("DiscoverableTimeout", timeout)
3695@@ -130,8 +130,8 @@
3696
3697 if (args[0] == "discovering"):
3698 properties = adapter.GetProperties()
3699- print properties["Discovering"]
3700+ print(properties["Discovering"])
3701 sys.exit(0)
3702
3703-print "Unknown command"
3704+print("Unknown command")
3705 sys.exit(1)
3706
3707=== modified file 'test/test-attrib'
3708--- test/test-attrib 2011-03-24 10:27:09 +0000
3709+++ test/test-attrib 2012-04-27 03:38:31 +0000
3710@@ -1,4 +1,4 @@
3711-#!/usr/bin/python
3712+#!/usr/bin/python3
3713 # Script for testing the Attribute D-Bus API
3714
3715 import sys
3716
3717=== modified file 'test/test-audio'
3718--- test/test-audio 2010-12-20 14:59:20 +0000
3719+++ test/test-audio 2012-04-27 03:38:31 +0000
3720@@ -1,4 +1,4 @@
3721-#!/usr/bin/python
3722+#!/usr/bin/python3
3723
3724 import sys
3725 import dbus
3726@@ -25,11 +25,11 @@
3727 "org.bluez.Adapter")
3728
3729 if len(args) < 2:
3730- print """Usage: %s <command>
3731+ print("""Usage: %s <command>
3732
3733 connect <bdaddr>
3734 disconnect <bdaddr>
3735- """ % sys.argv[0]
3736+ """ % sys.argv[0])
3737 sys.exit(1)
3738
3739 device = adapter.FindDevice(args[1])
3740@@ -41,5 +41,5 @@
3741 elif args[0] == "disconnect":
3742 audio.Disconnect()
3743 else:
3744- print "Unknown command"
3745+ print("Unknown command")
3746 sys.exit(1)
3747
3748=== modified file 'test/test-device'
3749--- test/test-device 2011-01-07 13:21:49 +0000
3750+++ test/test-device 2012-04-27 03:38:31 +0000
3751@@ -1,6 +1,6 @@
3752-#!/usr/bin/python
3753+#!/usr/bin/python3
3754
3755-import gobject
3756+from gi.repository import GObject
3757
3758 import sys
3759 import dbus
3760@@ -10,7 +10,7 @@
3761
3762 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
3763 bus = dbus.SystemBus()
3764-mainloop = gobject.MainLoop()
3765+mainloop = GObject.MainLoop()
3766
3767 manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
3768
3769@@ -31,19 +31,19 @@
3770 "org.bluez.Adapter")
3771
3772 if (len(args) < 1):
3773- print "Usage: %s <command>" % (sys.argv[0])
3774- print ""
3775- print " list"
3776- print " services <address>"
3777- print " create <address>"
3778- print " remove <address|path>"
3779- print " disconnect <address>"
3780- print " discover <address> [pattern]"
3781- print " class <address>"
3782- print " name <address>"
3783- print " alias <address> [alias]"
3784- print " trusted <address> [yes/no]"
3785- print " blocked <address> [yes/no]"
3786+ print("Usage: %s <command>" % (sys.argv[0]))
3787+ print("")
3788+ print(" list")
3789+ print(" services <address>")
3790+ print(" create <address>")
3791+ print(" remove <address|path>")
3792+ print(" disconnect <address>")
3793+ print(" discover <address> [pattern]")
3794+ print(" class <address>")
3795+ print(" name <address>")
3796+ print(" alias <address> [alias]")
3797+ print(" trusted <address> [yes/no]")
3798+ print(" blocked <address> [yes/no]")
3799 sys.exit(1)
3800
3801 if (args[0] == "list"):
3802@@ -51,23 +51,23 @@
3803 device = dbus.Interface(bus.get_object("org.bluez", path),
3804 "org.bluez.Device")
3805 properties = device.GetProperties()
3806- print "%s %s" % (properties["Address"], properties["Alias"])
3807+ print("%s %s" % (properties["Address"], properties["Alias"]))
3808
3809 sys.exit(0)
3810
3811 def create_device_reply(device):
3812- print "New device (%s)" % device
3813+ print("New device (%s)" % device)
3814 mainloop.quit()
3815 sys.exit(0)
3816
3817 def create_device_error(error):
3818- print "Creating device failed: %s" % error
3819+ print("Creating device failed: %s" % error)
3820 mainloop.quit()
3821 sys.exit(1)
3822
3823 if (args[0] == "create"):
3824 if (len(args) < 2):
3825- print "Need address parameter"
3826+ print("Need address parameter")
3827 else:
3828 adapter.CreateDevice(args[1],
3829 reply_handler=create_device_reply,
3830@@ -76,7 +76,7 @@
3831
3832 if (args[0] == "remove"):
3833 if (len(args) < 2):
3834- print "Need address or object path parameter"
3835+ print("Need address or object path parameter")
3836 else:
3837 try:
3838 path = adapter.FindDevice(args[1])
3839@@ -87,7 +87,7 @@
3840
3841 if (args[0] == "disconnect"):
3842 if (len(args) < 2):
3843- print "Need address parameter"
3844+ print("Need address parameter")
3845 else:
3846 path = adapter.FindDevice(args[1])
3847 device = dbus.Interface(bus.get_object("org.bluez", path),
3848@@ -97,7 +97,7 @@
3849
3850 if (args[0] == "discover"):
3851 if (len(args) < 2):
3852- print "Need address parameter"
3853+ print("Need address parameter")
3854 else:
3855 path = adapter.FindDevice(args[1])
3856 device = dbus.Interface(bus.get_object("org.bluez", path),
3857@@ -110,57 +110,57 @@
3858 for key in services.keys():
3859 p = re.compile(">.*?<")
3860 xml = p.sub("><", services[key].replace("\n", ""))
3861- print "[ 0x%5x ]" % (key)
3862- print xml
3863- print
3864+ print("[ 0x%5x ]" % (key))
3865+ print(xml)
3866+ print()
3867 sys.exit(0)
3868
3869 if (args[0] == "class"):
3870 if (len(args) < 2):
3871- print "Need address parameter"
3872+ print("Need address parameter")
3873 else:
3874 path = adapter.FindDevice(args[1])
3875 device = dbus.Interface(bus.get_object("org.bluez", path),
3876 "org.bluez.Device")
3877 properties = device.GetProperties()
3878- print "0x%06x" % (properties["Class"])
3879+ print("0x%06x" % (properties["Class"]))
3880 sys.exit(0)
3881
3882 if (args[0] == "name"):
3883 if (len(args) < 2):
3884- print "Need address parameter"
3885+ print("Need address parameter")
3886 else:
3887 path = adapter.FindDevice(args[1])
3888 device = dbus.Interface(bus.get_object("org.bluez", path),
3889 "org.bluez.Device")
3890 properties = device.GetProperties()
3891- print properties["Name"]
3892+ print(properties["Name"])
3893 sys.exit(0)
3894
3895 if (args[0] == "alias"):
3896 if (len(args) < 2):
3897- print "Need address parameter"
3898+ print("Need address parameter")
3899 else:
3900 path = adapter.FindDevice(args[1])
3901 device = dbus.Interface(bus.get_object("org.bluez", path),
3902 "org.bluez.Device")
3903 if (len(args) < 3):
3904 properties = device.GetProperties()
3905- print properties["Alias"]
3906+ print(properties["Alias"])
3907 else:
3908 device.SetProperty("Alias", args[2])
3909 sys.exit(0)
3910
3911 if (args[0] == "trusted"):
3912 if (len(args) < 2):
3913- print "Need address parameter"
3914+ print("Need address parameter")
3915 else:
3916 path = adapter.FindDevice(args[1])
3917 device = dbus.Interface(bus.get_object("org.bluez", path),
3918 "org.bluez.Device")
3919 if (len(args) < 3):
3920 properties = device.GetProperties()
3921- print properties["Trusted"]
3922+ print(properties["Trusted"])
3923 else:
3924 if (args[2] == "yes"):
3925 value = dbus.Boolean(1)
3926@@ -173,14 +173,14 @@
3927
3928 if (args[0] == "blocked"):
3929 if (len(args) < 2):
3930- print "Need address parameter"
3931+ print("Need address parameter")
3932 else:
3933 path = adapter.FindDevice(args[1])
3934 device = dbus.Interface(bus.get_object("org.bluez", path),
3935 "org.bluez.Device")
3936 if (len(args) < 3):
3937 properties = device.GetProperties()
3938- print properties["Blocked"]
3939+ print(properties["Blocked"])
3940 else:
3941 if (args[2] == "yes"):
3942 value = dbus.Boolean(1)
3943@@ -193,15 +193,15 @@
3944
3945 if (args[0] == "services"):
3946 if (len(args) < 2):
3947- print "Need address parameter"
3948+ print("Need address parameter")
3949 else:
3950 path = adapter.FindDevice(args[1])
3951 device = dbus.Interface(bus.get_object("org.bluez", path),
3952 "org.bluez.Device")
3953 properties = device.GetProperties()
3954 for path in properties["Services"]:
3955- print path
3956+ print(path)
3957 sys.exit(0)
3958
3959-print "Unknown command"
3960+print("Unknown command")
3961 sys.exit(1)
3962
3963=== modified file 'test/test-discovery'
3964--- test/test-discovery 2010-12-20 14:59:20 +0000
3965+++ test/test-discovery 2012-04-27 03:38:31 +0000
3966@@ -1,20 +1,20 @@
3967-#!/usr/bin/python
3968+#!/usr/bin/python3
3969
3970-import gobject
3971+from gi.repository import GObject
3972
3973 import dbus
3974 import dbus.mainloop.glib
3975 from optparse import OptionParser, make_option
3976
3977 def device_found(address, properties):
3978- print "[ " + address + " ]"
3979+ print("[ " + address + " ]")
3980
3981 for key in properties.keys():
3982 value = properties[key]
3983 if (key == "Class"):
3984- print " %s = 0x%06x" % (key, value)
3985+ print(" %s = 0x%06x" % (key, value))
3986 else:
3987- print " %s = %s" % (key, value)
3988+ print(" %s = %s" % (key, value))
3989
3990 def property_changed(name, value):
3991 if (name == "Discovering" and not value):
3992@@ -53,5 +53,5 @@
3993
3994 adapter.StartDiscovery()
3995
3996- mainloop = gobject.MainLoop()
3997+ mainloop = GObject.MainLoop()
3998 mainloop.run()
3999
4000=== modified file 'test/test-health'
4001--- test/test-health 2012-01-24 05:35:09 +0000
4002+++ test/test-health 2012-04-27 03:38:31 +0000
4003@@ -1,4 +1,4 @@
4004-#!/usr/bin/python
4005+#!/usr/bin/python3
4006 # -*- coding: utf-8 -*-
4007
4008 import dbus
4009
4010=== modified file 'test/test-health-sink'
4011--- test/test-health-sink 2012-01-24 05:35:09 +0000
4012+++ test/test-health-sink 2012-04-27 03:38:31 +0000
4013@@ -1,4 +1,4 @@
4014-#!/usr/bin/python
4015+#!/usr/bin/python3
4016 # -*- coding: utf-8 -*-
4017
4018 import dbus
4019
4020=== modified file 'test/test-input'
4021--- test/test-input 2010-12-20 14:59:20 +0000
4022+++ test/test-input 2012-04-27 03:38:31 +0000
4023@@ -1,4 +1,4 @@
4024-#!/usr/bin/python
4025+#!/usr/bin/python3
4026
4027 import sys
4028 import dbus
4029@@ -25,11 +25,11 @@
4030 "org.bluez.Adapter")
4031
4032 if len(args) < 2:
4033- print """Usage: %s <command>
4034+ print("""Usage: %s <command>
4035
4036 connect <bdaddr>
4037 disconnect <bdaddr>
4038- """ % sys.argv[0]
4039+ """ % sys.argv[0])
4040 sys.exit(1)
4041
4042 device = adapter.FindDevice(args[1])
4043@@ -41,5 +41,5 @@
4044 elif args[0] == "disconnect":
4045 input.Disconnect()
4046 else:
4047- print "Unknown command"
4048+ print("Unknown command")
4049 sys.exit(1)
4050
4051=== modified file 'test/test-manager'
4052--- test/test-manager 2010-12-02 12:17:48 +0000
4053+++ test/test-manager 2012-04-27 03:38:31 +0000
4054@@ -1,18 +1,18 @@
4055-#!/usr/bin/python
4056+#!/usr/bin/python3
4057
4058-import gobject
4059+from gi.repository import GObject
4060
4061 import dbus
4062 import dbus.mainloop.glib
4063
4064 def adapter_added(path):
4065- print "Adapter with path %s added" % (path)
4066+ print("Adapter with path %s added" % (path))
4067
4068 def adapter_removed(path):
4069- print "Adapter with path %s removed" % (path)
4070+ print("Adapter with path %s removed" % (path))
4071
4072 def default_changed(path):
4073- print "Default adapter is now at path %s" % (path)
4074+ print("Default adapter is now at path %s" % (path))
4075
4076 if __name__ == "__main__":
4077 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
4078@@ -34,5 +34,5 @@
4079 except:
4080 pass
4081
4082- mainloop = gobject.MainLoop()
4083+ mainloop = GObject.MainLoop()
4084 mainloop.run()
4085
4086=== modified file 'test/test-network'
4087--- test/test-network 2010-12-20 14:59:20 +0000
4088+++ test/test-network 2012-04-27 03:38:31 +0000
4089@@ -1,4 +1,4 @@
4090-#!/usr/bin/python
4091+#!/usr/bin/python3
4092
4093 import sys
4094 import time
4095@@ -27,7 +27,7 @@
4096 "org.bluez.Adapter")
4097
4098 if (len(args) < 1):
4099- print "Usage: %s <address> [service]" % (sys.argv[0])
4100+ print("Usage: %s <address> [service]" % (sys.argv[0]))
4101 sys.exit(1)
4102
4103 address = args[0]
4104@@ -44,13 +44,13 @@
4105
4106 iface = network.Connect(service)
4107
4108-print "Connected %s to %s" % (device, address)
4109+print("Connected %s to %s" % (device, address))
4110
4111-print "Press CTRL-C to disconnect"
4112+print("Press CTRL-C to disconnect")
4113
4114 try:
4115 time.sleep(1000)
4116- print "Terminating connection"
4117+ print("Terminating connection")
4118 except:
4119 pass
4120
4121
4122=== modified file 'test/test-oob'
4123--- test/test-oob 2011-05-17 19:02:14 +0000
4124+++ test/test-oob 2012-04-27 03:38:31 +0000
4125@@ -1,4 +1,4 @@
4126-#!/usr/bin/python
4127+#!/usr/bin/python3
4128
4129 import gobject
4130
4131
4132=== modified file 'test/test-proximity'
4133--- test/test-proximity 2012-01-24 05:35:09 +0000
4134+++ test/test-proximity 2012-04-27 03:38:31 +0000
4135@@ -1,4 +1,4 @@
4136-#!/usr/bin/python
4137+#!/usr/bin/python3
4138
4139 '''
4140 Proximity Monitor test script
4141
4142=== modified file 'test/test-sap-server'
4143--- test/test-sap-server 2011-04-05 10:09:16 +0000
4144+++ test/test-sap-server 2012-04-27 03:38:31 +0000
4145@@ -1,4 +1,4 @@
4146-#!/usr/bin/python
4147+#!/usr/bin/python3
4148
4149 from sap import *
4150 import time
4151
4152=== modified file 'test/test-serial'
4153--- test/test-serial 2011-01-27 18:00:26 +0000
4154+++ test/test-serial 2012-04-27 03:38:31 +0000
4155@@ -1,4 +1,4 @@
4156-#!/usr/bin/python
4157+#!/usr/bin/python3
4158
4159 import sys
4160 import time
4161@@ -26,7 +26,7 @@
4162 "org.bluez.Adapter")
4163
4164 if (len(args) < 1):
4165- print "Usage: %s <address> [service]" % (sys.argv[0])
4166+ print("Usage: %s <address> [service]" % (sys.argv[0]))
4167 sys.exit(1)
4168
4169 address = args[0]
4170@@ -43,13 +43,13 @@
4171
4172 node = serial.Connect(service)
4173
4174-print "Connected %s to %s" % (node, address)
4175+print("Connected %s to %s" % (node, address))
4176
4177-print "Press CTRL-C to disconnect"
4178+print("Press CTRL-C to disconnect")
4179
4180 try:
4181 time.sleep(1000)
4182- print "Terminating connection"
4183+ print("Terminating connection")
4184 except:
4185 pass
4186
4187
4188=== modified file 'test/test-serial-proxy'
4189--- test/test-serial-proxy 2012-01-24 05:35:09 +0000
4190+++ test/test-serial-proxy 2012-04-27 03:38:31 +0000
4191@@ -1,4 +1,4 @@
4192-#!/usr/bin/python
4193+#!/usr/bin/python3
4194
4195 import sys
4196 import time
4197
4198=== modified file 'test/test-service'
4199--- test/test-service 2011-01-27 18:00:26 +0000
4200+++ test/test-service 2012-04-27 03:38:31 +0000
4201@@ -1,4 +1,4 @@
4202-#!/usr/bin/python
4203+#!/usr/bin/python3
4204
4205 import sys
4206 import dbus
4207@@ -26,22 +26,22 @@
4208 "org.bluez.Service")
4209
4210 if (len(args) < 1):
4211- print "Usage: %s <command>" % (sys.argv[0])
4212- print ""
4213- print " addrecord <file>"
4214+ print("Usage: %s <command>" % (sys.argv[0]))
4215+ print("")
4216+ print(" addrecord <file>")
4217 sys.exit(1)
4218
4219 if (args[0] == "addrecord"):
4220 if (len(args) < 2):
4221- print "Need file parameter"
4222+ print("Need file parameter")
4223 else:
4224 f = open(args[1])
4225 record = f.read()
4226 f.close()
4227 handle = service.AddRecord(record)
4228- print "0x%x" % (handle)
4229+ print("0x%x" % (handle))
4230 time.sleep(120)
4231 sys.exit(0)
4232
4233-print "Unknown command"
4234+print("Unknown command")
4235 sys.exit(1)
4236
4237=== modified file 'test/test-telephony'
4238--- test/test-telephony 2011-01-27 18:00:26 +0000
4239+++ test/test-telephony 2012-04-27 03:38:31 +0000
4240@@ -1,4 +1,4 @@
4241-#!/usr/bin/python
4242+#!/usr/bin/python3
4243
4244 import sys
4245 import dbus
4246@@ -28,7 +28,7 @@
4247 "org.bluez.TelephonyTest")
4248
4249 if len(args) < 1:
4250- print """Usage: %s <command>
4251+ print("""Usage: %s <command>
4252
4253 connect <bdaddr>
4254 disconnect <bdaddr>
4255@@ -44,12 +44,12 @@
4256 microphonegain <bdaddr> [level]
4257 play <bdaddr>
4258 stop <bdaddr>
4259- """ % sys.argv[0]
4260+ """ % sys.argv[0])
4261 sys.exit(1)
4262
4263 if args[0] == "connect":
4264 if len(args) < 2:
4265- print "Need device address parameter"
4266+ print("Need device address parameter")
4267 sys.exit(1)
4268 device = adapter.FindDevice(args[1])
4269 headset = dbus.Interface(bus.get_object("org.bluez", device),
4270@@ -59,7 +59,7 @@
4271
4272 if args[0] == "disconnect":
4273 if len(args) < 2:
4274- print "Need device address parameter"
4275+ print("Need device address parameter")
4276 sys.exit(1)
4277 device = adapter.FindDevice(args[1])
4278 headset = dbus.Interface(bus.get_object("org.bluez", device),
4279@@ -69,7 +69,7 @@
4280
4281 if args[0] == "speakergain":
4282 if len(args) < 2:
4283- print "Need device address parameter"
4284+ print("Need device address parameter")
4285 sys.exit(1)
4286 device = adapter.FindDevice(args[1])
4287 headset = dbus.Interface(bus.get_object("org.bluez", device),
4288@@ -78,13 +78,13 @@
4289 headset.SetProperty('SpeakerGain', dbus.UInt16(args[2]))
4290 else:
4291 props = headset.GetProperties()
4292- print props['SpeakerGain']
4293+ print(props['SpeakerGain'])
4294
4295 sys.exit(0)
4296
4297 if args[0] == "microphonegain":
4298 if len(args) < 2:
4299- print "Need device address parameter"
4300+ print("Need device address parameter")
4301 sys.exit(1)
4302 device = adapter.FindDevice(args[1])
4303 headset = dbus.Interface(bus.get_object("org.bluez", device),
4304@@ -93,13 +93,13 @@
4305 headset.SetProperty('MicrophoneGain', dbus.UInt16(args[2]))
4306 else:
4307 props = headset.GetProperties()
4308- print props['MicrophoneGain']
4309+ print(props['MicrophoneGain'])
4310
4311 sys.exit(0)
4312
4313 if args[0] == "play":
4314 if len(args) < 2:
4315- print "Need device address parameter"
4316+ print("Need device address parameter")
4317 sys.exit(1)
4318 device = adapter.FindDevice(args[1])
4319 headset = dbus.Interface(bus.get_object("org.bluez", device),
4320@@ -110,7 +110,7 @@
4321
4322 if args[0] == "stop":
4323 if len(args) < 2:
4324- print "Need device address parameter"
4325+ print("Need device address parameter")
4326 sys.exit(1)
4327 device = adapter.FindDevice(args[1])
4328 headset = dbus.Interface(bus.get_object("org.bluez", device),
4329@@ -123,14 +123,14 @@
4330 if len(args) > 1:
4331 test.OutgoingCall(args[1])
4332 else:
4333- print "Need number parameter"
4334+ print("Need number parameter")
4335 sys.exit(0)
4336
4337 if args[0] == "incoming":
4338 if len(args) > 1:
4339 test.IncomingCall(args[1])
4340 else:
4341- print "Need number parameter"
4342+ print("Need number parameter")
4343 sys.exit(0)
4344
4345 if args[0] == "cancel":
4346@@ -141,36 +141,36 @@
4347 if len(args) > 1:
4348 test.SignalStrength(args[1])
4349 else:
4350- print "Need signal strength parameter"
4351+ print("Need signal strength parameter")
4352 sys.exit(0)
4353
4354 if args[0] == "battery":
4355 if len(args) > 1:
4356 test.BatteryLevel(args[1])
4357 else:
4358- print "Need battery level parameter"
4359+ print("Need battery level parameter")
4360 sys.exit(0)
4361
4362 if args[0] == "roaming":
4363 if len(args) > 1:
4364 test.RoamingStatus(args[1] == "yes" or False)
4365 else:
4366- print "Need yes/no parameter"
4367+ print("Need yes/no parameter")
4368 sys.exit(0)
4369
4370 if args[0] == "registration":
4371 if len(args) > 1:
4372 test.RegistrationStatus(args[1] == "yes" or False)
4373 else:
4374- print "Need yes/no parameter"
4375+ print("Need yes/no parameter")
4376 sys.exit(0)
4377
4378 if args[0] == "subscriber":
4379 if len(args) > 1:
4380 test.SetSubscriberNumber(args[1])
4381 else:
4382- print "Need number parameter"
4383+ print("Need number parameter")
4384 sys.exit(0)
4385
4386-print "Unknown command"
4387+print("Unknown command")
4388 sys.exit(1)
4389
4390=== modified file 'test/test-thermometer'
4391--- test/test-thermometer 2012-01-24 05:35:09 +0000
4392+++ test/test-thermometer 2012-04-27 03:38:31 +0000
4393@@ -1,4 +1,4 @@
4394-#!/usr/bin/python
4395+#!/usr/bin/python3
4396
4397 '''
4398 Thermometer test script

Subscribers

People subscribed via source and target branches