public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Jacob <frederic.jacob.78@gmail.com>
To: jikos@kernel.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Frederic Jacob <frederic.jacob.78@gmail.com>
Subject: [PATCH] hid: sony: Add power supply support for PS3 remote
Date: Tue,  8 Mar 2016 20:40:59 -0500	[thread overview]
Message-ID: <1457487659-3970-1-git-send-email-frederic.jacob.78@gmail.com> (raw)

Add power supply support for the PS3 remote controller

Signed-off-by: Frederic Jacob <frederic.jacob.78@gmail.com>

---
 drivers/hid/hid-sony.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 9b8db0e..b78e149 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -61,7 +61,8 @@
 				DUALSHOCK4_CONTROLLER | MOTION_CONTROLLER |\
 				NAVIGATION_CONTROLLER)
 #define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\
-				MOTION_CONTROLLER_BT | NAVIGATION_CONTROLLER)
+				MOTION_CONTROLLER_BT | NAVIGATION_CONTROLLER |\
+				PS3REMOTE)
 #define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\
 				MOTION_CONTROLLER)

@@ -1177,7 +1178,12 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
 	 * It does not report the actual level while charging so it
 	 * is set to 100% while charging is in progress.
 	 */
-	offset = (sc->quirks & MOTION_CONTROLLER) ? 12 : 30;
+	if (sc->quirks & MOTION_CONTROLLER)
+		offset = 12;
+	else if (sc->quirks & PS3REMOTE)
+		offset = 11;
+	else
+		offset = 30;

 	if (rd[offset] >= 0xee) {
 		battery_capacity = 100;
@@ -1301,6 +1307,9 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
 	} else if ((sc->quirks & NAVIGATION_CONTROLLER) && rd[0] == 0x01 &&
 			size == 49) {
 		sixaxis_parse_report(sc, rd, size);
+	} else if ((sc->quirks & PS3REMOTE) && rd[0] == 0x01 &&
+			size == 12) {
+		sixaxis_parse_report(sc, rd, size);
 	} else if (((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && rd[0] == 0x01 &&
 			size == 64) || ((sc->quirks & DUALSHOCK4_CONTROLLER_BT)
 			&& rd[0] == 0x11 && size == 78)) {
--
2.5.0

             reply	other threads:[~2016-03-09  1:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09  1:40 Frederic Jacob [this message]
2016-03-09 16:58 ` [PATCH] hid: sony: Add power supply support for PS3 remote Bastien Nocera
2016-03-10  2:54   ` Frederic Jacob

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=1457487659-3970-1-git-send-email-frederic.jacob.78@gmail.com \
    --to=frederic.jacob.78@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --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