Skip to content

Commit

Permalink
HID: sony: Correct Sixaxis battery reporting
Browse files Browse the repository at this point in the history
The battery_charging and cable_state flags were backwards on the Sixaxis.
The low bit of report byte 30 is 0 when charging and 1 when not.
Bit 5 of byte 31 is 0 when a USB cable is connected and 1 when not.

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 Feb 17, 2014
1 parent 68330d8 commit a43e94a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hid/hid-sony.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
*/
if (rd[30] >= 0xee) {
battery_capacity = 100;
battery_charging = rd[30] & 0x01;
battery_charging = !(rd[30] & 0x01);
} else {
battery_capacity = sixaxis_battery_capacity[rd[30]];
battery_charging = 0;
}
cable_state = (rd[31] >> 4) & 0x01;
cable_state = !((rd[31] >> 4) & 0x01);

spin_lock_irqsave(&sc->lock, flags);
sc->cable_state = cable_state;
Expand Down

0 comments on commit a43e94a

Please sign in to comment.