HID: sony: Correct Sixaxis battery reporting
PATCH 1/1 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 <[email protected]>
--- drivers/hid/hid-sony.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-sony.c +2 -2
@@ -850,12 +850,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;
Signature · 1 line
1.8.5.3
Jiri Kosina
AppliedQuoted 5 lines · Frank Praznik
The
battery_chargingandcable_stateflags 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 <[email protected]>
Applied, thanks Frank.
Signature · 2 lines
Jiri Kosina SUSE Labs