Skip to content

Commit

Permalink
HID: sony: Fix Sixaxis cable state detection
Browse files Browse the repository at this point in the history
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 <frank.praznik@oh.rr.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Frank Praznik authored and Jiri Kosina committed Apr 1, 2014
1 parent dccf2f6 commit 914c578
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-sony.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 914c578

Please sign in to comment.