Exemple #1
0
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 as e:
            print("Failed to initialize sixwatch" + str(e))
            pass

    while True:
        if hid.listen():
            (csock, addr) = hid.get_control_socket()
            device_name = bt_lookup_name(addr[0])
            if device_name == devices[0]:
                # handle PS3 controller
                handle_ps3_controller(hid, ipaddr)
            elif device_name == devices[1]:
                # handle the PS3 remote
                handle_ps3_remote(hid, ipaddr)
            else:
                print("Unknown Device: %s" % (device_name))
Exemple #2
0
def start_hidd(bdaddr=None, ipaddr="127.0.0.1"):
    devices = ['PLAYSTATION(R)3 Controller', 'BD Remote Control']
    hid = HID(bdaddr)
    while True:
        if hid.listen():
            (csock, addr) = hid.get_control_socket()
            device_name = bt_lookup_name(addr[0])
            if device_name == devices[0]:
                # handle PS3 controller
                handle_ps3_controller(hid, ipaddr)
            elif device_name == devices[1]:
                # handle the PS3 remote
                handle_ps3_remote(hid, ipaddr)
            else:
                print "Unknown Device: %s" % (device_name)
Exemple #3
0
def start_hidd(bdaddr=None, ipaddr="127.0.0.1"):
    devices = [ 'PLAYSTATION(R)3 Controller',
                'BD Remote Control' ]
    hid = HID(bdaddr)
    while True:
        if hid.listen():
            (csock, addr) = hid.get_control_socket()
            device_name = bt_lookup_name(addr[0])
            if device_name == devices[0]:
                # handle PS3 controller
                handle_ps3_controller(hid, ipaddr)
            elif device_name == devices[1]:
                # handle the PS3 remote
                handle_ps3_remote(hid, ipaddr)
            else:
                print "Unknown Device: %s" % (device_name)
Exemple #4
0
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 as e:
            print("Failed to initialize sixwatch" + str(e))
            pass

    while True:
        if hid.listen():
            (csock, addr) = hid.get_control_socket()
            device_name = bt_lookup_name(addr[0])
            if device_name == devices[0]:
                # handle PS3 controller
                handle_ps3_controller(hid, ipaddr)
            elif device_name == devices[1]:
                # handle the PS3 remote
                handle_ps3_remote(hid, ipaddr)
            else:
                print("Unknown Device: %s" % (device_name))
Exemple #5
0
    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()
            device_name = bt_lookup_name(addr[0])
            if device_name == devices[0]:
                # handle PS3 controller
                handle_ps3_controller(hid, ipaddr)
            elif device_name == devices[1]:
                # handle the PS3 remote
                handle_ps3_remote(hid, ipaddr)
            else:
                print "Unknown Device: %s" % (device_name)

def handle_ps3_controller(hid, ipaddr):
    print "Received connection from a Sixaxis PS3 Controller"
    csock = hid.get_control_socket()[0]
    isock = hid.get_interrupt_socket()[0]
    sixaxis = PS3SixaxisThread(csock, isock, ipaddr)
    add_thread(sixaxis)
Exemple #6
0
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()
            device_name = bt_lookup_name(addr[0])
            if device_name == devices[0]:
                # handle PS3 controller
                handle_ps3_controller(hid, ipaddr)
            elif device_name == devices[1]:
                # handle the PS3 remote
                handle_ps3_remote(hid, ipaddr)
            else:
                print "Unknown Device: %s" % (device_name)


def handle_ps3_controller(hid, ipaddr):
    print "Received connection from a Sixaxis PS3 Controller"
    csock = hid.get_control_socket()[0]
    isock = hid.get_interrupt_socket()[0]
    sixaxis = PS3SixaxisThread(csock, isock, ipaddr)