linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris <coderight+lkml@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: hid-sony appears to be broken for some (new?) DualShock 4 controllers
Date: Fri, 23 Oct 2015 21:20:58 -0400	[thread overview]
Message-ID: <562ADCFA.7060109@gmail.com> (raw)

I have a brand new DualShock 4 and the descriptor is a different size 
than what the hid-sony driver expects. This causes the controller to not 
work at all over wireless except for the trackpad. On USB it sort of 
works but the motion sense does not. This affects kernels starting at 
3.15 all the way to the current 4.3rc6.

In sony_report_fixup() it looks for a size of 467 for USB or 357 for 
Bluetooth but my controller's descriptor size is 499 USB and 365 BT.

I changed the sizes and the controller seems to be fully functional now. 
Is the descriptor size check actually even necessary? Don't all DS4's 
require the modified descriptor table regardless? I don't know.

These are the changes I made against 4.3rc6:
---
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 661f94f..d93a6a8 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1137,11 +1137,11 @@ static __u8 *sony_report_fixup(struct hid_device 
*hdev, __u8 *rdesc,
          * the gyroscope values to corresponding axes so we need a
          * modified one.
          */
-       if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && *rsize == 467) {
+       if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && (*rsize == 467 
|| *rsize == 499)) {
                 hid_info(hdev, "Using modified Dualshock 4 report 
descriptor with gyroscope axes\n");
                 rdesc = dualshock4_usb_rdesc;
                 *rsize = sizeof(dualshock4_usb_rdesc);
-       } else if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) && *rsize == 
357) {
+       } else if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) && (*rsize == 
357 || *rsize == 365)) {
                 hid_info(hdev, "Using modified Dualshock 4 Bluetooth 
report descriptor\n");
                 rdesc = dualshock4_bt_rdesc;
                 *rsize = sizeof(dualshock4_bt_rdesc);

                 reply	other threads:[~2015-10-24  1:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562ADCFA.7060109@gmail.com \
    --to=coderight+lkml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).