PlayStation 4 Controller Support

../_images/ps4.jpg

DualShock4 Controller

Nothing more to do for this controller, it pairs over Pairing Controllers over Bluetooth with no issues. On modern kernels this now does support motion events as well as the touchpad, treating the touchpad as a pair of axes reading the last location of a single touch. See the last part of Standard Names for details on how to access these properties.

class approxeng.input.dualshock4.DualShock4(dead_zone=0.05, hot_zone=0.05, **kwargs)[source]

Driver for the Sony PlayStation 4 controller, the DualShock4

__init__(dead_zone=0.05, hot_zone=0.05, **kwargs)[source]

Create a new DualShock4 driver

Parameters:
  • dead_zone (float) – Used to set the dead zone for each CentredAxis in the controller.

  • hot_zone (float) – Used to set the hot zone for each CentredAxis in the controller.

static registration_ids()[source]
Returns:

list of (vendor_id, product_id) for this controller

set_leds(hue: float = 0.0, saturation: float = 1.0, value: float = 1.0)[source]

The DualShock4 has an LED bar on the front of the controller. This function allows you to set the value of this bar. Note that the controller must be connected for this to work, if it’s not the call will just be ignored.

Parameters:
  • hue – The hue of the colour, defaults to 0, specified as a floating point value between 0.0 and 1.0.

  • saturation – Saturation of the colour, defaults to 1.0, specified as a floating point value between 0.0 and 1.0.

  • value – Value of the colour (i.e. how bright the light is overall), defaults to 1.0, specified as a floating point value between 0.0 and 1.0