aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients/Clients
diff options
context:
space:
mode:
authorelupus <elupus@xbmc.org>2011-10-27 22:26:07 +0200
committerelupus <elupus@xbmc.org>2011-10-27 22:26:42 +0200
commit4fd9254f9ca67342ff197bea4472ad0e25adbc3f (patch)
treec399ad820b098114b7370852573f8ffa24753f69 /tools/EventClients/Clients
parent1e015aa0e97628c7fa91fc5b4bf7dd4d51ce6e9c (diff)
ps3d.py: automatically pair sixaxis with bluetooth dongle when connected over usb
Diffstat (limited to 'tools/EventClients/Clients')
-rwxr-xr-xtools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py b/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
index dfc2c11fd5..cc6450327e 100755
--- a/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
+++ b/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
@@ -33,6 +33,12 @@ if os.path.exists("../../lib/python"):
from ps3 import sixaxis
from ps3_remote import process_keys as process_remote
try:
+ from ps3 import sixwatch
+ except Exception, e:
+ print "Failed to import sixwatch now disabled: " + str(e)
+ sixwatch = None
+
+ try:
import zeroconf
except:
zeroconf = None
@@ -46,6 +52,11 @@ else:
from xbmc.ps3_remote import process_keys as process_remote
from xbmc.defs import *
try:
+ from xbmc.ps3 import sixwatch
+ except Exception, e:
+ print "Failed to import sixwatch now disabled: " + str(e)
+ sixwatch = None
+ try:
import xbmc.zeroconf as zeroconf
except:
zeroconf = None
@@ -235,6 +246,18 @@ class PS3RemoteThread ( StoppableThread ):
pass
return
+class SixWatch(threading.Thread):
+ def __init__(self, mac):
+ threading.Thread.__init__(self)
+ self.mac = mac
+ self.daemon = True
+ self.start()
+ def run(self):
+ try:
+ sixwatch.main(self.mac)
+ except Exception, e:
+ print "Exception caught in sixwatch, aborting: " + str(e)
+ pass
class ZeroconfThread ( threading.Thread ):
"""
@@ -294,6 +317,15 @@ def start_hidd(bdaddr=None, ipaddr="127.0.0.1"):
devices = [ 'PLAYSTATION(R)3 Controller',
'BD Remote Control' ]
hid = HID(bdaddr)
+ watch = None
+ if sixwatch:
+ try:
+ print "Starting USB sixwatch"
+ watch = SixWatch(hid.get_local_address())
+ except Exception, e:
+ print "Failed to initialize sixwatch" + str(e)
+ pass
+
while True:
if hid.listen():
(csock, addr) = hid.get_control_socket()