aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients/lib/python/bt/hid.py
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/lib/python/bt/hid.py
parent1e015aa0e97628c7fa91fc5b4bf7dd4d51ce6e9c (diff)
ps3d.py: automatically pair sixaxis with bluetooth dongle when connected over usb
Diffstat (limited to 'tools/EventClients/lib/python/bt/hid.py')
-rw-r--r--tools/EventClients/lib/python/bt/hid.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/EventClients/lib/python/bt/hid.py b/tools/EventClients/lib/python/bt/hid.py
index 7a4999b506..7cdf1529bc 100644
--- a/tools/EventClients/lib/python/bt/hid.py
+++ b/tools/EventClients/lib/python/bt/hid.py
@@ -16,6 +16,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from bluetooth import *
+import fcntl
+import bluetooth._bluetooth as _bt
+import array
class HID:
def __init__(self, bdaddress=None):
@@ -56,6 +59,13 @@ class HID:
self.connected = False
return False
+ def get_local_address(self):
+ hci = BluetoothSocket( HCI )
+ fd = hci.fileno()
+ buf = array.array('B', [0] * 96)
+ fcntl.ioctl(fd, _bt.HCIGETDEVINFO, buf, 1)
+ data = struct.unpack_from("H8s6B", buf.tostring())
+ return data[2:8][::-1]
def get_control_socket(self):
if self.connected: