joystick.jstest#

class platypush.backend.joystick.jstest.JoystickJstestBackend(device: str = '/dev/input/js0', jstest_path: str = '/usr/bin/jstest', **kwargs)[source]#

Bases: Backend

This backend can be used to intercept events from a joystick device if the device does not work with the standard platypush.backend.joystick.JoystickBackend backend (this may especially happen with some Bluetooth joysticks that don’t support the ioctl requests used by inputs).

This backend only works on Linux and it requires the joystick package to be installed.

NOTE: This backend can be quite slow, since it has to run another program (jstest) and parse its output. Consider it as a last resort if your joystick works with neither platypush.backend.joystick.JoystickBackend nor platypush.backend.joystick.JoystickLinuxBackend.

Instructions on Debian-based distros:

# apt-get install joystick

Instructions on Arch-based distros:

# pacman -S joyutils

To test if your joystick is compatible, connect it to your device, check for its path (usually under /dev/input/js*) and run:

$ jstest /dev/input/js[n]

Triggers:

__init__(device: str = '/dev/input/js0', jstest_path: str = '/usr/bin/jstest', **kwargs)[source]#
Parameters:
  • device – Path to the joystick device (default: /dev/input/js0).

  • jstest_path – Path to the jstest executable that comes with the joystick system package (default: /usr/bin/jstest).

run()[source]#

Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.