xbox360controller icon indicating copy to clipboard operation
xbox360controller copied to clipboard

Xbox One

Open binaryhellstorm opened this issue 3 years ago • 4 comments

Trying this with the Xbox One bluetooth controller and it seems to be reading the B and X keys as axis.

binaryhellstorm avatar Aug 08 '20 21:08 binaryhellstorm

Don't have one of those so I can't confirm or fix this issue :shrug:

PR welcome, though I'm not really interested in adding support for multiple controllers.

linusg avatar Aug 08 '20 21:08 linusg

Please add support for Xbox One, or make a module for that with a similar interface. This is the easiest to use module I've found, but it only supports Xbox 360.

xboxone08 avatar Sep 10 '20 00:09 xboxone08

@xboxone08 I appreciate it, but again, I don't have the required hardware (Xbox One controller) for testing so that's no going to happen.

linusg avatar Sep 10 '20 16:09 linusg

@xboxone08 I'm using linusg's work as base to use my Xbox One Wireless controller (using xpadneo driver). It doesn't "know" the Trigger Axis though when used "normally". I can get values from them by using the Raw mode though.

Try this code snippet and see if the output shows you something useful:

import signal
from xbox360controller import Xbox360Controller

def on_button_pressed(button):
    print('Button {0} was pressed'.format(button.name))

def on_button_released(button):
    print('Button {0} was released'.format(button.name))

def on_axis_moved_raw(axis):
    print('Axis {0} moved to {1}'.format(axis.name, axis.value))

try:
    with Xbox360Controller(0, axis_threshold=0.2, raw_mode=True) as controller:
        # Button events
        for b in controller.buttons:
            b.when_pressed = on_button_pressed
            b.when_released = on_button_released

        for a in controller.axes:
            a.when_moved = on_axis_moved_raw

        signal.pause()
except KeyboardInterrupt:
    pass

wullxz avatar Sep 11 '20 23:09 wullxz