joystick.jstest
Platypush documentation
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 theioctl
requests used byinputs
).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 neitherplatypush.backend.joystick.JoystickBackend
norplatypush.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:
platypush.message.event.joystick.JoystickConnectedEvent
when the joystick is connected.platypush.message.event.joystick.JoystickDisconnectedEvent
when the joystick is disconnected.platypush.message.event.joystick.JoystickStateEvent
when the state of the joystick (i.e. some of itsaxes or buttons values) changes.
platypush.message.event.joystick.JoystickButtonPressedEvent
when a joystick button is pressed.platypush.message.event.joystick.JoystickButtonReleasedEvent
when a joystick button is released.platypush.message.event.joystick.JoystickAxisEvent
when an axis value of the joystick changes.