From: Frank Praznik Date: Sat, 15 Mar 2014 13:41:15 +0000 (-0400) Subject: HID: sony: Fix Sixaxis cable state detection X-Git-Tag: MMI-PSA29.97-13-9~12475^2~1^3~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=914c578391c7cf55d88e2a553208e7523d0ddf1a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git HID: sony: Fix Sixaxis cable state detection Byte 31 of the Sixaxis report can change depending on whether or not the controller is rumbling. Using bit 3 is the only reliable way to detect the state of the cable regardless of rumble activity. Signed-off-by: Frank Praznik Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index b1aa6f00c827..31ba01a39e81 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -864,7 +864,7 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size) battery_capacity = sixaxis_battery_capacity[index]; battery_charging = 0; } - cable_state = !((rd[31] >> 4) & 0x01); + cable_state = !(rd[31] & 0x04); spin_lock_irqsave(&sc->lock, flags); sc->cable_state = cable_state;