* [PATCH] hid: sony: Add power supply support for PS3 remote
@ 2016-03-09 1:40 Frederic Jacob
2016-03-09 16:58 ` Bastien Nocera
0 siblings, 1 reply; 3+ messages in thread
From: Frederic Jacob @ 2016-03-09 1:40 UTC (permalink / raw)
To: jikos; +Cc: linux-input, linux-kernel, Frederic Jacob
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hid: sony: Add power supply support for PS3 remote
2016-03-09 1:40 [PATCH] hid: sony: Add power supply support for PS3 remote Frederic Jacob
@ 2016-03-09 16:58 ` Bastien Nocera
2016-03-10 2:54 ` Frederic Jacob
0 siblings, 1 reply; 3+ messages in thread
From: Bastien Nocera @ 2016-03-09 16:58 UTC (permalink / raw)
To: Frederic Jacob, jikos; +Cc: linux-input, linux-kernel
Hey Frederic,
On Tue, 2016-03-08 at 20:40 -0500, Frederic Jacob wrote:
> Add power supply support for the PS3 remote controller
Isn't something like "add battery state reporting for PS3 remotes"
better?
Also, as I don't think it's physically possible to have the PS3 remote
both connected and charging at the same time, maybe the comment
in sixaxis_parse_report() should be modified to make it clear that the
PS3 remote doesn't have that problem.
Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hid: sony: Add power supply support for PS3 remote
2016-03-09 16:58 ` Bastien Nocera
@ 2016-03-10 2:54 ` Frederic Jacob
0 siblings, 0 replies; 3+ messages in thread
From: Frederic Jacob @ 2016-03-10 2:54 UTC (permalink / raw)
To: Bastien Nocera, jikos; +Cc: linux-input, linux-kernel
On 03/09/2016 11:58 AM, Bastien Nocera wrote:
> Hey Frederic,
>
> On Tue, 2016-03-08 at 20:40 -0500, Frederic Jacob wrote:
>> Add power supply support for the PS3 remote controller
> Isn't something like "add battery state reporting for PS3 remotes"
> better?
>
> Also, as I don't think it's physically possible to have the PS3 remote
> both connected and charging at the same time, maybe the comment
> in sixaxis_parse_report() should be modified to make it clear that the
> PS3 remote doesn't have that problem.
>
> Cheers
I hesitated to use a message similar as to what you suggest
but changed it to use the technical term, but I prefer yours.
As for the comment in sixaxis_parse_report() what do you think if I add
at the end of the comment?
" The PS3 remote cannot be charged so it is always set to discharging
and unplugged."
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-10 2:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 1:40 [PATCH] hid: sony: Add power supply support for PS3 remote Frederic Jacob
2016-03-09 16:58 ` Bastien Nocera
2016-03-10 2:54 ` Frederic Jacob
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).