xbmc / peripheral.joystick

Kodi joystick support (drivers and button maps)
GNU General Public License v2.0
24 stars 46 forks source link

Update Wireless PS4 controller button map #235

Closed garbear closed 2 years ago

garbear commented 2 years ago

Description

This PR updates the Wireless PS4 controller (both v1 and v2) added in https://github.com/xbmc/peripheral.joystick/pull/117 to use analog axes for the triggers instead of digital buttons.

The central problem is due to an astrological phenomenon colloquially known as "joystick driver fuckery". To make our lives more difficult, the linux driver for PS4 controllers sends both a button press and an anolog axis for each trigger. The button press is sent when the analog axis crosses the 0.5 threshold. However, the button mapper waits for a slightly higher threshold for analog axes, causing the digital button to be used for the trigger. Even worse, when the axis is detected, it is erroneously assigned to the next trigger and causes "skipping" in the mapper.

To allow for mapping PS4 controllers, I added an "Ignore Input" button which I describe here: https://kodi.wiki/view/HOW-TO:PlayStation_4_controller

The configuration block in this diff is what the output of the "Ignore Input" approach created.

(Additional controller profiles not needed, Kodi should automatically translate to other controllers when the default map is known.)

Motivation and context

While working on Smart Home (https://github.com/xbmc/xbmc/pull/21183) and connecting my LEGO train to the PS4 controller output, I noticed that the train could only go zero throttle or full throttle.

Lego Train via PS4 Controller

And let me tell you, at full throttle of LEGO 9v motors overvolted to 12V and pumped via a high current robotics motor controller, the train FLIES off the track.

Related PRs

Introduced in https://github.com/xbmc/peripheral.joystick/pull/117

garbear commented 2 years ago

Merging to release new versions for @razzeee's flatpack work.