Esempio n. 1
0
 def run(self):
     evm = evminit()
     sc = SteamController(callback=evm.process)
     sc.run()
     del sc
     del evm
     gc.collect()
Esempio n. 2
0
 def run(self):
     evm = evminit()
     sc = SteamController(callback=evm.process)
     sc.run()
     del sc
     del evm
     gc.collect()
Esempio n. 3
0
    def _main():
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument('command',
                            type=str,
                            choices=['start', 'stop', 'restart', 'debug'])
        parser.add_argument('-i',
                            '--index',
                            type=int,
                            choices=[0, 1, 2, 3],
                            default=None)
        args = parser.parse_args()
        if args.index != None:
            daemon = SCDaemon('/tmp/steamcontroller{:d}.pid'.format(
                args.index))
        else:
            daemon = SCDaemon('/tmp/steamcontroller.pid')

        if 'start' == args.command:
            daemon.start()
        elif 'stop' == args.command:
            daemon.stop()
        elif 'restart' == args.command:
            daemon.restart()
        elif 'debug' == args.command:
            try:
                evm = evminit()
                sc = SteamController(callback=evm.process)
                sc.run()

            except KeyboardInterrupt:
                pass
Esempio n. 4
0
File: sc.py Progetto: rorik/UBUBOT
 def run(self):
     if self.lock is not None:
         self.lock.start()
     dm_evm = evminit()
     dm_sc = SteamController(callback=dm_evm.process)
     dm_sc.run()
     del dm_sc
     del dm_evm
     gc.collect()
Esempio n. 5
0
 def run(self):
     while True:
         try:
             xb = steamcontroller.uinput.Xbox360()
             sc = SteamController(callback=scInput2Uinput, callback_args=[xb, ])
             sc.run()
         except KeyboardInterrupt:
             return
         except:
             pass
Esempio n. 6
0
def _main():

    try:
        sc = SteamController(callback=dump)
        sc.handleEvents()
        sc._sendControl(struct.pack('>' + 'I' * 1, 0x81000000))
        sc._sendControl(struct.pack('>' + 'I' * 6, 0x87153284, 0x03180000, 0x31020008, 0x07000707, 0x00301400, 0x2f010000))

        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xad020000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xad020000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xad020000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0x8e000000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0x85000000))

        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xb4000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x9610730b, 0xc7191248, 0x074eff14, 0x464e82d6, 0xaa960000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x9610e0b5, 0xda3a1e90, 0x5b325088, 0x0a6224d2, 0x67690000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x96107ef6, 0x0e193e8c, 0xe61d2eda, 0xb80906eb, 0x9fe90000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x96106e4a, 0xa4753ef0, 0x017ab50a, 0x24390f1f, 0x71fa0000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0x83000000))

       #sc._sendControl(struct.pack('>' + 'I' * 6, 0xae150100, 0x00000001, 0x02110000, 0x02030000, 0x000a6d92, 0xd2550400))
        sc.run()

    except KeyboardInterrupt:
        pass
    except Exception as e:
        sys.stderr.write(str(e) + '\n')

    print("Bye")
Esempio n. 7
0
def _main():

    try:
        sc = SteamController(callback=dump)
        sc.run()
    except KeyboardInterrupt:
        pass
    except Exception as e:
        sys.stderr.write(str(e) + '\n')

    print("Bye")
Esempio n. 8
0
def _main():

    try:
        sc = SteamController(callback=dump)
        sc.run()
    except KeyboardInterrupt:
        pass
    except Exception as e:
        sys.stderr.write(str(e) + '\n')

    print("Bye")
Esempio n. 9
0
    def _main():
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument('command', type=str, choices=['start', 'stop', 'restart', 'debug'])
        args = parser.parse_args()
        daemon = SCDaemon('/tmp/steamcontroller.pid')

        if 'start' == args.command:
            daemon.start()
        elif 'stop' == args.command:
            daemon.stop()
        elif 'restart' == args.command:
            daemon.restart()
        elif 'debug' == args.command:
            xb = steamcontroller.uinput.Xbox360()
            sc = SteamController(callback=scInput2Uinput, callback_args=[xb, ])
            sc.run()
Esempio n. 10
0
    def _main():
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument("command", type=str, choices=["start", "stop", "restart", "debug"])
        args = parser.parse_args()
        daemon = SCDaemon("/tmp/steamcontroller.pid")

        if "start" == args.command:
            daemon.start()
        elif "stop" == args.command:
            daemon.stop()
        elif "restart" == args.command:
            daemon.restart()
        elif "debug" == args.command:
            try:
                evm = evminit()
                sc = SteamController(callback=evm.process)
                sc.run()
            except KeyboardInterrupt:
                return
Esempio n. 11
0
    def _main():
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument('command', type=str, choices=['start', 'stop', 'restart', 'debug'])
        args = parser.parse_args()
        daemon = SCDaemon('/tmp/steamcontroller.pid')

        if 'start' == args.command:
            daemon.start()
        elif 'stop' == args.command:
            daemon.stop()
        elif 'restart' == args.command:
            daemon.restart()
        elif 'debug' == args.command:
            try:
                evm = evminit()
                sc = SteamController(callback=evm.process)
                sc.run()
            except KeyboardInterrupt:
                return
Esempio n. 12
0
    def _main():
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument('command',
                            type=str,
                            choices=['start', 'stop', 'restart', 'debug'])
        args = parser.parse_args()
        daemon = SCDaemon('/tmp/steamcontroller.pid')

        if 'start' == args.command:
            daemon.start()
        elif 'stop' == args.command:
            daemon.stop()
        elif 'restart' == args.command:
            daemon.restart()
        elif 'debug' == args.command:
            try:
                evm = evminit()
                sc = SteamController(callback=evm.process)
                sc.run()
            except KeyboardInterrupt:
                return
Esempio n. 13
0
    def _main():
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument('command', type=str, choices=['start', 'stop', 'restart', 'debug'])
        parser.add_argument('-i', '--index', type=int, choices=[0,1,2,3], default=None)
        args = parser.parse_args()
        if args.index != None:
            daemon = SCDaemon('/tmp/steamcontroller{:d}.pid'.format(args.index))
        else:
            daemon = SCDaemon('/tmp/steamcontroller.pid')

        if 'start' == args.command:
            daemon.start()
        elif 'stop' == args.command:
            daemon.stop()
        elif 'restart' == args.command:
            daemon.restart()
        elif 'debug' == args.command:
            try:
                evm = evminit()
                sc = SteamController(callback=evm.process)
                sc.run()
            except KeyboardInterrupt:
                return
Esempio n. 14
0
def _main():

    try:
        sc = SteamController(callback=dump)
        for line in sys.stdin:
            sc.handleEvents()
            words = [int('0x' + x, 16) for x in line.split()]
            sc._sendControl(struct.pack('>' + 'I' * len(words), *words))
        sc.run()

    except KeyboardInterrupt:
        pass
    except Exception as e:
        sys.stderr.write(str(e) + '\n')

    print("Bye")
Esempio n. 15
0
def _main():

    try:
        sc = SteamController(callback=dump)
        sc.handleEvents()
        sc._sendControl(struct.pack('>' + 'I' * 1, 0x81000000))
        sc._sendControl(
            struct.pack('>' + 'I' * 6, 0x87153284, 0x03180000, 0x31020008,
                        0x07000707, 0x00301400, 0x2f010000))

        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xad020000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xad020000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xad020000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0x8e000000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0x85000000))

        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xb4000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x9610730b, 0xc7191248, 0x074eff14, 0x464e82d6, 0xaa960000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x9610e0b5, 0xda3a1e90, 0x5b325088, 0x0a6224d2, 0x67690000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x96107ef6, 0x0e193e8c, 0xe61d2eda, 0xb80906eb, 0x9fe90000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0xa1000000))
        #sc._sendControl(struct.pack('>' + 'I' * 5, 0x96106e4a, 0xa4753ef0, 0x017ab50a, 0x24390f1f, 0x71fa0000))
        #sc._sendControl(struct.pack('>' + 'I' * 1, 0x83000000))

        #sc._sendControl(struct.pack('>' + 'I' * 6, 0xae150100, 0x00000001, 0x02110000, 0x02030000, 0x000a6d92, 0xd2550400))
        sc.run()

    except KeyboardInterrupt:
        pass
    except Exception as e:
        sys.stderr.write(str(e) + '\n')

    print("Bye")
    def __init__(self):
        # Initialize dict that stores the controller button states. The keys corresponds to the
        # button values (sci.buttons) from the controller.The values for the triggers, pads and
        # giro's are also added to the dict.
        self.btns = {0:     {'type': 'trigger', 'name': 'LTRIG', 'value': 0}
                    ,2<< 0: {'type': 'trigger', 'name': 'RTRIG', 'value': 0} 
                    ,2<< 1: {'type': 'pad',     'name': 'LPAD_X', 'value': 0} 
                    ,2<< 2: {'type': 'pad',     'name': 'LPAD_Y', 'value': 0} 
                    ,2<< 3: {'type': 'pad',     'name': 'RPAD_X', 'value': 0} 
                    ,2<< 4: {'type': 'pad',     'name': 'RPAD_Y', 'value': 0}
                    
                    ,2<<15: {'type': 'giro',    'name': 'GPITCH', 'value': 0}
                    ,2<<16: {'type': 'giro',    'name': 'GROLL',  'value': 0}
                    ,2<<17: {'type': 'giro',    'name': 'GYAW',   'value': 0}

                    ,2<< 7: {'type': 'button',  'name': 'RT',     'value': 0}          #2^7=256
                    ,2<< 8: {'type': 'button',  'name': 'LT',     'value': 0}          #2^8=512
                    ,2<< 9: {'type': 'button',  'name': 'RB',     'value': 0}
                    ,2<<10: {'type': 'button',  'name': 'LB',     'value': 0}
                    ,2<<11: {'type': 'button',  'name': 'Y',      'value': 0}
                    ,2<<12: {'type': 'button',  'name': 'B',      'value': 0}
                    ,2<<13: {'type': 'button',  'name': 'X',      'value': 0}
                    ,2<<14: {'type': 'button',  'name': 'A',      'value': 0}
                    ,2<<19: {'type': 'button',  'name': 'BACK',   'value': 0}          #2^19=1048576
                    ,2<<20: {'type': 'button',  'name': 'STEAM',  'value': 0}
                    ,2<<21: {'type': 'button',  'name': 'START',  'value': 0}
                    ,2<<22: {'type': 'button',  'name': 'LGRIP',  'value': 0}
                    ,2<<23: {'type': 'button',  'name': 'RGRIP',  'value': 0}
                    ,2<<24: {'type': 'button',  'name': 'LPAD',   'value': 0}
                    ,2<<25: {'type': 'button',  'name': 'RPAD',   'value': 0}
                    ,2<<26: {'type': 'button',  'name': 'LPADTOUCH', 'value': 0}
                    ,2<<27: {'type': 'button',  'name': 'RPADTOUCH', 'value': 0}     #2^27=268435546
        }

        # Add additional dict that translates human friendly name to event code.
        self.btn_keys = {self.btns[x]['name']:x for x in self.btns}

        # Create device for Steam Controller
        try:
            # Create SteamController device
            self.device = SteamController(callback=self.get_events)

            # Create thread to start SteamController.run() in the background
            self.thread = threading.Thread(target=self.device.run)
            self.thread.start()
            print("Steam controller thread started")
            
        except Exception as e:
            sys.stderr.write(str(e) + '\n')
Esempio n. 17
0
def _main():

    try:
        sc = SteamController(callback=dump)
        for line in sys.stdin:
            sc.handleEvents()
            words = [int('0x' + x, 16) for x in  line.split()]
            sc._sendControl(struct.pack('>' + 'I' * len(words), *words))
        sc.run()

    except KeyboardInterrupt:
        pass
    except Exception as e:
        sys.stderr.write(str(e) + '\n')

    print("Bye")
Esempio n. 18
0
    def __init__(self, buttons=None, stick_deadzone=0.1):
        super(SCThread, self).__init__()

        self.stick_deadzone = stick_deadzone
        self._stick_lock = False

        evm = EventMapper()
        evm.setPadButtonCallback(Pos.LEFT, self.padtouch)
        evm.setPadButtonCallback(Pos.RIGHT, self.padtouch)
        evm.setStickAxesCallback(self.stick_axes)

        evm.setFirstPadTouchCallback(Pos.LEFT, self.first_padtouch)
        evm.setFirstPadTouchCallback(Pos.RIGHT, self.first_padtouch)

        evm.setGyroCallback(self.gyro)

        if buttons is None:
            buttons = (
                SCButtons.STEAM,
                SCButtons.A,
                SCButtons.B,
                SCButtons.X,
                SCButtons.Y,
                SCButtons.LT,
                SCButtons.RT,
                SCButtons.LB,
                SCButtons.RB,
                SCButtons.LGRIP,
                SCButtons.RGRIP,
                SCButtons.START,
                SCButtons.BACK
            )

        for btn in buttons:
            evm.setButtonCallback(btn, self.button_press)

        self.sc = SteamController(callback=evm.process)
        self.sc.handleEvents()
        self.sc._sendControl(struct.pack('>' + 'I' * 6,
                                    0x87153284,
                                    0x03180000,
                                    0x31020008,
                                    0x07000707,
                                    0x00301400,
                                    0x2f010000))
Esempio n. 19
0
def evminit():
    evm = EventMapper()
    evm.setButtonCallback(SCButtons.STEAM, button_pressed_callback)
    evm.setButtonCallback(SCButtons.A, button_pressed_callback)
    evm.setButtonCallback(SCButtons.B, button_pressed_callback)
    evm.setButtonCallback(SCButtons.X, button_pressed_callback)
    evm.setButtonCallback(SCButtons.Y, button_pressed_callback)
    evm.setButtonCallback(SCButtons.LB, button_pressed_callback)
    evm.setButtonCallback(SCButtons.RB, button_pressed_callback)
    evm.setButtonCallback(SCButtons.LT, button_pressed_callback)
    evm.setButtonCallback(SCButtons.RT, button_pressed_callback)
    evm.setButtonCallback(SCButtons.LGRIP, button_pressed_callback)
    evm.setButtonCallback(SCButtons.RGRIP, button_pressed_callback)
    evm.setButtonCallback(SCButtons.START, button_pressed_callback)
    evm.setButtonCallback(SCButtons.BACK, button_pressed_callback)
    evm.setPadButtonCallback(Pos.LEFT, touchpad_touch_callback)
    evm.setPadButtonCallback(Pos.RIGHT, touchpad_click_callback, clicked=True)
    evm.setStickAxesCallback(stick_axes_callback)
    evm.setStickPressedCallback(stick_pressed_callback)
    evm.setTrigAxesCallback(Pos.RIGHT, tigger_axes_callback)
    evm.setTrigAxesCallback(Pos.LEFT, tigger_axes_callback)
    return evm


if __name__ == '__main__':
    evm = evminit()
    sc = SteamController(callback=evm.process)
    sc.run()


Esempio n. 20
0
class SCThread(QtCore.QThread):
    def __init__(self, buttons=None, stick_deadzone=0.1):
        super(SCThread, self).__init__()

        self.stick_deadzone = stick_deadzone
        self._stick_lock = False

        evm = EventMapper()
        evm.setPadButtonCallback(Pos.LEFT, self.padtouch)
        evm.setPadButtonCallback(Pos.RIGHT, self.padtouch)
        evm.setStickAxesCallback(self.stick_axes)

        evm.setFirstPadTouchCallback(Pos.LEFT, self.first_padtouch)
        evm.setFirstPadTouchCallback(Pos.RIGHT, self.first_padtouch)

        evm.setGyroCallback(self.gyro)

        if buttons is None:
            buttons = (
                SCButtons.STEAM,
                SCButtons.A,
                SCButtons.B,
                SCButtons.X,
                SCButtons.Y,
                SCButtons.LT,
                SCButtons.RT,
                SCButtons.LB,
                SCButtons.RB,
                SCButtons.LGRIP,
                SCButtons.RGRIP,
                SCButtons.START,
                SCButtons.BACK
            )

        for btn in buttons:
            evm.setButtonCallback(btn, self.button_press)

        self.sc = SteamController(callback=evm.process)
        self.sc.handleEvents()
        self.sc._sendControl(struct.pack('>' + 'I' * 6,
                                    0x87153284,
                                    0x03180000,
                                    0x31020008,
                                    0x07000707,
                                    0x00301400,
                                    0x2f010000))

    def gyro(self, pitch, yaw, roll):
        self.emit(GYRO, pitch, yaw, roll)

    def stick_axes(self, evm, x, y):
        if (x**2 + y**2) < 2**30 * self.stick_deadzone:
            self._stick_lock = False
            return

        if self._stick_lock:
            return

        rads = math.atan2(x, y)
        degrees = (rads if rads > 0 else rads + 2 * math.pi) * 360 / (2 * math.pi)

        btn = _degrees_to_btn(degrees)
        if btn is None:
            return

        self.emit(BUTTON, btn, True)
        self._stick_lock = True

    def button_press(self, evm, btn, pressed):
        self.emit(BUTTON, btn, pressed)

    def padtouch(self, evm, pad, x, y):
        signal = PAD_TOUCH_LEFT if pad == Pos.LEFT else PAD_TOUCH_RIGHT
        self.emit(signal, x, y)

    def first_padtouch(self, pad, x, y):
        signal = FIRST_PAD_TOUCH_LEFT if pad == Pos.LEFT else FIRST_PAD_TOUCH_RIGHT
        self.emit(signal, x, y)

    def run(self):
        self.sc.run()

    def haptic_feedback_pad(self, pos, amplitude, **kwargs):
        self.sc.addFeedback(pos, amplitude=amplitude, **kwargs)
Esempio n. 21
0
def joythread():
    sc = SteamController(callback=joyParse)
    sc.run()
Esempio n. 22
0
 def run(self):
     evm = evminit()
     sc = SteamController(callback=evm.process)
     sc.run()
Esempio n. 23
0
def _main():
    app = QtGui.QApplication([])

    win = pg.GraphicsWindow(title="Steam Controller")
    win.resize(1000, 600)
    win.nextRow()

    p1 = win.addPlot(name="plot1", title='Pitch')
    win.nextColumn()

    p2 = win.addPlot(name="plot2", title='Roll')
    p2.setYLink("plot1")
    win.nextColumn()

    p3 = win.addPlot(name="plot3", title='Yaw')
    p3.setYLink("plot1")
    win.nextRow()

    p4 = win.addPlot(name="plot4", title='Others', colspan=5)
    win.nextRow()


    p1.addLegend()
    p1.showGrid(x=True, y=True, alpha=0.5)
    p1.setYRange(-8000, 8000)

    p2.addLegend()
    p2.showGrid(x=True, y=True, alpha=0.5)
    p2.setYRange(-8000, 8000)

    p3.addLegend()
    p3.showGrid(x=True, y=True, alpha=0.5)
    p3.setYRange(-8000, 8000)

    p4.addLegend()
    p4.showGrid(x=True, y=True, alpha=0.5)
    p4.setYRange(-32767, 32767)


    imu = {
        'gpitch' : [],
        'groll'  : [],
        'gyaw'   : [],
        'q1'     : [],
        'q2'     : [],
        'q3'     : [],
        'q4'     : [],
    }

    curves = {
        'gpitch' : p1.plot(times, [], pen=(0, 2), name='vel'),
        'groll'  : p2.plot(times, [], pen=(0, 2), name='vel'),
        'gyaw'   : p3.plot(times, [], pen=(0, 2), name='vel'),
        'q1'     : p4.plot(times, [], pen=(0, 4), name='1'),
        'q2'     : p4.plot(times, [], pen=(1, 4), name='2'),
        'q3'     : p4.plot(times, [], pen=(2, 4), name='3'),
        'q4'     : p4.plot(times, [], pen=(3, 4), name='4'),
    }

    def update(sc, sci):
        global times
        if sci.status != 15361:
            return
        cur = time.time()
        times.append(cur)
        times = [x for x in times if cur - x <= 10.0]

        for name in imu.keys():
            imu[name].append(sci._asdict()[name])
            imu[name] = imu[name][-len(times):]
            curves[name].setData(times, imu[name])

    app.processEvents()
    sc = SteamController(callback=update)
    sc.handleEvents()
    sc._sendControl(struct.pack('>' + 'I' * 6,
                                0x87153284,
                                0x03180000,
                                0x31020008,
                                0x07000707,
                                0x00301400,
                                0x2f010000))
    def closeEvent(event):
        global run
        run = False
        event.accept()

    win.closeEvent = closeEvent
    app.processEvents()

    try:
        i = 0
        while run:
            i = i + 1
            sc.handleEvents()
            app.processEvents()
    except KeyboardInterrupt:
        print("Bye")
Esempio n. 24
0
File: scosk.py Progetto: ren2r/scosk
            vkp.l.px = (0x8000 + x * 12 // 10) * WSX // (0x1fffe)
            vkp.l.py = (0x8000 - y * 12 // 10) * WSY // (0xffff)


ovr = Overlay() if not USE_GTK else Overlay2()
vkp = VirtualKeypad()


# Assumes existence of evm, vkp
def update(sc, sci):
    if not USE_GTK:
        if QUIT in [p.type for p in pygame.event.get()]:
            sys.exit()
    if sci.status != 15361:
        return
    evm.process(sc, sci)
    vkp.renderKeyboards()

    ovr.drawPointer(False, vkp.l.px, vkp.l.py, vkp.l.pb)
    ovr.drawPointer(True, vkp.r.px, vkp.r.py, vkp.r.pb)
    ovr.update()


if __name__ == '__main__':
    ovr.drawKeycap(False, "PLEASE INSERT CONTROLLER", WSX // 4, WSY // 4,
                   WSX // 2, WSY // 2)
    ovr.update()
    evm = OSKEventMapper()
    sc = SteamController(callback=update)
    sc.run()
Esempio n. 25
0

def evminit():
    evm = EventMapper()
    evm.setButtonCallback(SCButtons.STEAM, steam_pressed)
    evm.setButtonCallback(SCButtons.A, a_pressed)
    evm.setButtonCallback(SCButtons.B, b_pressed)
    evm.setButtonCallback(SCButtons.X, x_pressed)
    evm.setButtonCallback(SCButtons.Y, y_pressed)
    evm.setButtonCallback(SCButtons.LB, bumper_pressed)
    evm.setButtonCallback(SCButtons.RB, bumper_pressed)
    evm.setButtonCallback(SCButtons.LGRIP, grip_pressed)
    evm.setButtonCallback(SCButtons.RGRIP, grip_pressed)
    evm.setButtonCallback(SCButtons.START, start_pressed)
    evm.setButtonCallback(SCButtons.BACK, back_pressed)
    evm.setPadButtonCallback(Pos.LEFT, pad_axes)
    evm.setPadButtonCallback(Pos.RIGHT, pad_axes)
    evm.setPadButtonCallback(Pos.LEFT, pad_pressed, clicked=True)
    evm.setPadButtonCallback(Pos.RIGHT, pad_pressed, clicked=True)
    evm.setStickAxesCallback(stick_axes)
    evm.setStickPressedCallback(stick_pressed)
    evm.setTrigAxesCallback(Pos.RIGHT, trig_axes)
    evm.setTrigAxesCallback(Pos.LEFT, trig_axes)
    return evm


if __name__ == '__main__':
    evm = evminit()
    sc = SteamController(callback=evm.process)
    sc.run()
Esempio n. 26
0
 def run(self):
     evm = evminit()
     sc = SteamController(callback=evm.process)
     sc.run()