Button Mapping is off.
Discoded opened this issue · 6 comments
Pressing:
X prints "on_square_press"
Triangle prints "on_circle_press"
Circle prints "on_x_press"
Square prints "on_triangle_release"
@Discoded please share which:
- OS is being used
- python version
- controller is being used
- and code how you initialize the controller and start listening
@ArturSpirin
OS: Ubuntu 18.04.4 LTS
Python Version: 3.6.9
Controller: DualShock 4 connected with a micro-usb
from pyPS4Controller.controller import Controller
class MyController(Controller):
def __init__(self, **kwargs):
Controller.__init__(self, **kwargs)
def on_x_press(self):
print("Hello world")
def on_x_release(self):
print("Goodbye world")
controller = MyController(interface="/dev/input/js0", connecting_using_ds4drv=False)
# you can start listening before controller is paired, as long as you pair it within the timeout window
controller.listen(timeout=60)
I installed the library/module by calling pip3 install pyPS4Controller
@Discoded Thanks for providing the info. Wonder if its related to the USB connection, I have not tried using this module via USB. Ill try to repro today after work.
@ArturSpirin thanks for the library! I have the exact same bug as @Discoded on two seperate devices:
OS: Ubuntu 18.04.4 LTS
Python Version: 3.6.9
Controller: DualShock 4 connected over Bluetooth (connected via bluetooth GUI)
OS: Raspbian GNU/Linux 10 (buster) (Raspberry pi 3b+)
Python version: 3.7.3
Controller: DualShock 4 connected over Bluetooth (via bluetoothctl)
@Discoded, @thaije I'm able to repro a similar issue on my Linux Mint machine. It works on my Raspberry pi 3b+ though, I think I'm running Raspbian Buster Lite on it.
I wont be able to fix this for all machines - I just don't have the time to research it, I suspect different flavors of Linux will have different data stream thus mapping would have to be different for each. So I wont attempt to create new mappings, instead I will push a change which will allow to overload functions which detect button presses and thus give the ability to create your own mapping or adjust the current mapping to any degree.