[PATCH 1/6] HID: sony: Fix Sixaxis cable state detection
From: Frank Praznik <hidden>
Date: 2014-03-01 03:59:25
Subsystem:
hid core layer, the rest · Maintainers:
Jiri Kosina, Benjamin Tissoires, Linus Torvalds
From: Frank Praznik <hidden>
Date: 2014-03-01 03:59:25
Subsystem:
hid core layer, the rest · Maintainers:
Jiri Kosina, Benjamin Tissoires, Linus Torvalds
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 <redacted> --- drivers/hid/hid-sony.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index b1aa6f0..31ba01a 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;
--
1.8.5.3