ValveSoftware/steamos_kernel — pull request #6 by ArtVandelae (2014-09-14 21:53:08+00:00)
Title: Backport support for the DualShock 3 and 4 controllers.

Over the last several months the upstream kernel driver has had a lot of work done to fully support these controllers and this backport adds the same level of support for them to the 3.10 SteamOS kernel.

David Herrmann's async HIDP registration patch was needed to prevent an -EIO error when connecting these controllers via Bluetooth since the initialization phase requires sending and receiving reports before the probe function returns.

A workaround in HIDP is needed since these controllers want output reports sent on the control channel when running over Bluetooth. Kernel 3.15 had extensive changes made to the HID system to support this properly, but backporting these changes would have been a huge effort and touched many files. I'm not proud of this hack-ish workaround, but it gets the job done.

In addition to backporting the upstream changes, a couple of additions were added so that these controllers function nicely on a gaming box without needing extra software: The Sixaxis code-path now automatically sends an output report to the controller after the first input report is received (after the PS button is pressed to activate the controller on USB) so that the LEDs are set properly and stop flashing. Additionally, the LED values are set using the same method as the xpad driver so they reflect the system joystick device number.

Note that the DualShock 4 needs BlueZ 5.14 or higher to pair and connect via Bluetooth and support for force-feedback needs to be set in the kernel configuration system.