State of the xpad Xbox Controller Driver

Since my last post regarding the Xbox 360 Wireless Controller on Ubuntu, I have spent quite some time digging through different version of the xpad driver and their issues.

The following issues are those I encountered with xpad upstream at the time I wrote the first post. Some of them are fixed by now,  while for others the fixes are pending – but lets start from the beginning..

However if all you want is a driver where the mentioned bugs are fixed

Xbox360 Wireless: Blinking LEDs

This is the issue that originally got me digging into the driver. It is just annoying when the LEDs continue blinking even though the controller is already paired. The underlying issue is that the driver did not send the correct LED packet to the controller.

A patch for this issue was submitted on 31. January 2014 by Pierre-Loup A. Griffais (a Valve Employee) to the Linux mailing list.
However it was part of a patch series which needed some more work – an updated series was promised, but that never happened.

On 19. May 2014 the still unfinished changes from that series appeared in the steamos_kernel (by a collabora employee). Actually the code in the steamos kernel seems to predate the mailing list version as it is in much more “hacky” state.

After learning about this I split the clean LED related fixes out of the patch series and resubmitted them for review. At the time of writing they should be merged in Linux 4.2rc1.

Xbox360 Wireless: Ghost Controllers

Another issue with the Wireless Controller is that it always reports the maximum of 4 connected gamepads – regardless of how many pads are actually connected.
If you have only one gamepad connected, pads 2-4 will also appear, but always read zero.

This issue was also already tackled in the patch series of 31. January 2014. However this was actually one of the features that required more work.
The patch force disconnected all pads at driver load, requiring the user to manually re-connect them. The driver could then simply wait for the connected signal to create the input devices on demand.

The suggested improvement was to simply ask the receiver about the currently connected pads.  The required packet was discovered by Zachary Lund during his work on an alternative Xbox360 Controller Driver.

I fixed the respective parts of the available patch series and hopefully, this will be mainlined with Linux 4.5.

Xbox360 Wireless: different button mapping

This is not really a bug, but rather a questionable default: while Xbox360 Controllers treats the D-Pad as 2 axes by default, the wireless version of the same controller treats the D-Pad as 4 separate buttons.

I guess this is the kind of stuff that gives game developers nightmares, so I updated the driver to report the D-Pad as 2 axes as well to retain compability.

This will be mainlined with Linux 4.4

All Controllers: Dropped Force Feedback Packets

An even more subtle bug is the dropping of Force Feedback Packets. If force feedback request get submitted faster than they can be forwarded to the hardware, they get dropped. This one is really subtle because there exists almost no software that uses Force Feedback on Linux – and even then one would not notice the effect most of the time.

The notable exception is when a stop force feedback packet gets lost and the gamepad rumbles forever.

The patch in the steamos kernel, however is over engineered and leaky as it allows filling up all of your RAM if the application sends FFB packets too fast.

A clean solution will be probably mainlined with Linux 4.5

Xbox360 Wireless: Broken Suspend/ Resume

After waking up from suspend, the wireless receiver ignores all incoming packets. This means that neither force feedback is working nor can be the LED blinking be disabled.

Note that problem is probably not in xpad but rather in the different way the Linux USB subsystem behaves when compared to windows.

Resetting the USB device on resume fixed the issue

A improved patch-set might get mainlined with Linux 4.5.

Xbox One: Force Feedback Support

The Xbox One Controller Support was actually developed in Linux upstream and by Valve in parallel. The implementations are mostly the same, but differ in the way force feedback is implemented. The difference boils down to this.

In case you own a Xbox One Controller and Force Feedback is not working, you could give this version a try and report the results here.

Xbox One: Covert Forces Edition

The Covert Forces Edition of the Xbox One controller started using a new USB device id, which seemed that it not only featured a different color, but also different hardware.

However apparently the Covert Forces id is not Covert Forces pad exclusive, but
rather denotes a new Firmware Version that can be found on all new controllers and can be also flashed on old hardware using Windows 10.

This new Firmware needs an extended initialization sequence which will probably end up in linux 4.5.

Header Image CC-by Futurilla