diff options
author | Frank Praznik <frank.praznik@oh.rr.com> | 2014-02-15 13:35:42 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-02-17 17:17:36 -0500 |
commit | a43e94a38b91e30f36e8c9ef91bf7bd93061a3a1 (patch) | |
tree | 4f6e7bdec56d1d4e076b825b8ac6fcd0e105c602 /drivers/hid | |
parent | 68330d83c0b35120f70c529f6ddd70750081bbb0 (diff) |
HID: sony: Correct Sixaxis battery reporting
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-sony.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 947d2088a700..0111d3028c4b 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -845,12 +845,12 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size) | |||
845 | */ | 845 | */ |
846 | if (rd[30] >= 0xee) { | 846 | if (rd[30] >= 0xee) { |
847 | battery_capacity = 100; | 847 | battery_capacity = 100; |
848 | battery_charging = rd[30] & 0x01; | 848 | battery_charging = !(rd[30] & 0x01); |
849 | } else { | 849 | } else { |
850 | battery_capacity = sixaxis_battery_capacity[rd[30]]; | 850 | battery_capacity = sixaxis_battery_capacity[rd[30]]; |
851 | battery_charging = 0; | 851 | battery_charging = 0; |
852 | } | 852 | } |
853 | cable_state = (rd[31] >> 4) & 0x01; | 853 | cable_state = !((rd[31] >> 4) & 0x01); |
854 | 854 | ||
855 | spin_lock_irqsave(&sc->lock, flags); | 855 | spin_lock_irqsave(&sc->lock, flags); |
856 | sc->cable_state = cable_state; | 856 | sc->cable_state = cable_state; |