aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients/lib
diff options
context:
space:
mode:
authorelupus <elupus@xbmc.org>2011-10-27 22:48:11 +0200
committerelupus <elupus@xbmc.org>2011-10-27 22:48:25 +0200
commit3395c63fea67980288bceb72acd29e4696fc6bae (patch)
treed1f72400e92b027febd24acfb62d6d6a5555ebe0 /tools/EventClients/lib
parent9acb325f6d88cd819e4fab20251a0c9cde483e62 (diff)
ps3d: made commandline sixpair usable
Diffstat (limited to 'tools/EventClients/lib')
-rwxr-xr-xtools/EventClients/lib/python/ps3/sixpair.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/EventClients/lib/python/ps3/sixpair.py b/tools/EventClients/lib/python/ps3/sixpair.py
index c9b2bbb8c4..bb022c4278 100755
--- a/tools/EventClients/lib/python/ps3/sixpair.py
+++ b/tools/EventClients/lib/python/ps3/sixpair.py
@@ -12,9 +12,7 @@ passed_value = 0x03f5
def find_sixaxes():
res = []
for bus in usb.busses():
- print bus.dirname
for dev in bus.devices:
- print "-" + dev.filename
if dev.idVendor == vendor and dev.idProduct == product:
res.append(dev)
return res
@@ -92,10 +90,24 @@ def update_pair(dev, mac):
if __name__=="__main__":
devs = find_sixaxes()
+
+ mac = None
+ if len(sys.argv) > 1:
+ try:
+ mac = sys.argv[1].split(':')
+ mac = tuple([int(x, 16) for x in mac])
+ if len(mac) != 6:
+ print "Invalid length of HCI address, should be 6 parts"
+ mac = None
+ except:
+ print "Failed to parse HCI address"
+ mac = None
for dev in devs:
- msg = get_pair(dev)
- print "Found sixaxis paired to: %02x:%02x:%02x:%02x:%02x:%02x" % (msg[0], msg[1], msg[2], msg[3], msg[4], msg[5]); msg
+ if mac:
+ update_pair(dev, mac)
+ else:
+ print "Found sixaxis paired to: " + mac_to_string(get_pair(dev))