Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 914c5783 authored by Frank Praznik's avatar Frank Praznik Committed by Jiri Kosina
Browse files

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: default avatarFrank Praznik <frank.praznik@oh.rr.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent dccf2f65
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;