aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/EventClients/Clients/PS3 Sixaxis Controller/README.ubuntu1
-rw-r--r--tools/EventClients/lib/python/ps3/sixaxis.py18
2 files changed, 17 insertions, 2 deletions
diff --git a/tools/EventClients/Clients/PS3 Sixaxis Controller/README.ubuntu b/tools/EventClients/Clients/PS3 Sixaxis Controller/README.ubuntu
new file mode 100644
index 0000000000..bf4a5a43a8
--- /dev/null
+++ b/tools/EventClients/Clients/PS3 Sixaxis Controller/README.ubuntu
@@ -0,0 +1 @@
+sudo apt-get install python-usb python-pyudev python-bluez
diff --git a/tools/EventClients/lib/python/ps3/sixaxis.py b/tools/EventClients/lib/python/ps3/sixaxis.py
index c8f2d4f48d..9ba60cc1e9 100644
--- a/tools/EventClients/lib/python/ps3/sixaxis.py
+++ b/tools/EventClients/lib/python/ps3/sixaxis.py
@@ -154,7 +154,21 @@ def smooth(arr, val):
arr.pop(cnt)
return average(arr)
+def set_l2cap_mtu2(sock, mtu):
+ SOL_L2CAP = 6
+ L2CAP_OPTIONS = 1
+
+ s = sock.getsockopt (SOL_L2CAP, L2CAP_OPTIONS, 12)
+ o = list( struct.unpack ("HHHBBBH", s) )
+ o[0] = o[1] = mtu
+ s = struct.pack ("HHHBBBH", *o)
+ try:
+ sock.setsockopt (SOL_L2CAP, L2CAP_OPTIONS, s)
+ except:
+ print "Warning: Unable to set mtu"
+
class sixaxis():
+
def __init__(self, xbmc, control_sock, interrupt_sock):
self.xbmc = xbmc
@@ -172,8 +186,8 @@ class sixaxis():
self.psdown = 0
self.mouse_enabled = 0
- set_l2cap_mtu(control_sock, 64)
- set_l2cap_mtu(interrupt_sock, 64)
+ set_l2cap_mtu2(control_sock, 64)
+ set_l2cap_mtu2(interrupt_sock, 64)
time.sleep(0.25) # If we ask to quickly here, it sometimes doesn't start
# sixaxis needs this to enable it