Bug 107081

Summary: Some Sony DualShock 4 controllers do not work
Product: Drivers Reporter: Chris Osgood (q45e7uj7)
Component: Input DevicesAssignee: drivers_input-devices
Status: RESOLVED CODE_FIX    
Severity: normal CC: dmitry.torokhov
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.15+ Subsystem:
Regression: No Bisected commit-id:
Attachments: hid-sony.c patch

Description Chris Osgood 2015-11-03 14:02:09 UTC
Created attachment 191941 [details]
hid-sony.c patch

This bug is present in all kernels starting at 3.15.0

I have a brand new Sony DualShock 4 that seems to use a slightly different protocol than the hid-sony driver expects. I'm not sure why this controller is different. Maybe updated firmware from Sony or maybe because it has never been connected to a PS4. Whatever the case, the device descriptor size is different from what hid-sony expects and because of that it does not remap the descriptor table as required. This causes only the trackpad to function and none of the other controls work. So basically the controller does not work at all.

The current hid-sony driver expects a descriptor size of 467 when using USB or 357 when using Bluetooth. The controller I have uses 499 and 365 respectively.

I have created a patch that fixes it for me. I have only tested the patch against kernels 4.1, 4.2, and 4.3 but it's simple enough that it should be trivially portable to any 3.15+ kernel. The attached patch is based against the current git 4.3 kernel.

I wonder if the descriptor size check is even necessary. My patch adds the size of my controller's descriptor to keep with the original code style. However, don't all DualShock 4 controllers require remapping the descriptor table, regardless of descriptor size matching?
Comment 1 Dmitry Torokhov 2015-12-11 19:31:27 UTC
Chris,

Thank you for the patch. Please format it as outlined in Documentation/SubmittingPatches (and make sure you add your signed-off-by) and send as plaintext mail to linux-input@vger.kernel.org (cc jkosina@suse.cz) and we'll be happy to apply it.

Your questions are better asked on the mailing list as well.

Thanks!
Comment 2 Scall 2016-07-08 19:13:12 UTC
This issue with newer DualShock 4 controllers when connected via bluetooth has already been fixed since Linux 4.5.