55
55
DUALSHOCK4_CONTROLLER_BT)
56
56
#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\
57
57
DUALSHOCK4_CONTROLLER | MOTION_CONTROLLER)
58
- #define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)
58
+ #define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\
59
+ MOTION_CONTROLLER_BT)
59
60
#define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER |\
60
61
MOTION_CONTROLLER)
61
62
@@ -1041,6 +1042,7 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
1041
1042
{
1042
1043
static const __u8 sixaxis_battery_capacity [] = { 0 , 1 , 25 , 50 , 75 , 100 };
1043
1044
unsigned long flags ;
1045
+ int offset ;
1044
1046
__u8 cable_state , battery_capacity , battery_charging ;
1045
1047
1046
1048
/*
@@ -1049,12 +1051,14 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
1049
1051
* It does not report the actual level while charging so it
1050
1052
* is set to 100% while charging is in progress.
1051
1053
*/
1052
- if (rd [30 ] >= 0xee ) {
1054
+ offset = (sc -> quirks & MOTION_CONTROLLER ) ? 12 : 30 ;
1055
+
1056
+ if (rd [offset ] >= 0xee ) {
1053
1057
battery_capacity = 100 ;
1054
- battery_charging = !(rd [30 ] & 0x01 );
1058
+ battery_charging = !(rd [offset ] & 0x01 );
1055
1059
cable_state = 1 ;
1056
1060
} else {
1057
- __u8 index = rd [30 ] <= 5 ? rd [30 ] : 5 ;
1061
+ __u8 index = rd [offset ] <= 5 ? rd [offset ] : 5 ;
1058
1062
battery_capacity = sixaxis_battery_capacity [index ];
1059
1063
battery_charging = 0 ;
1060
1064
cable_state = 0 ;
@@ -1154,6 +1158,8 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
1154
1158
swap (rd [45 ], rd [46 ]);
1155
1159
swap (rd [47 ], rd [48 ]);
1156
1160
1161
+ sixaxis_parse_report (sc , rd , size );
1162
+ } else if ((sc -> quirks & MOTION_CONTROLLER_BT ) && rd [0 ] == 0x01 && size == 49 ) {
1157
1163
sixaxis_parse_report (sc , rd , size );
1158
1164
} else if (((sc -> quirks & DUALSHOCK4_CONTROLLER_USB ) && rd [0 ] == 0x01 &&
1159
1165
size == 64 ) || ((sc -> quirks & DUALSHOCK4_CONTROLLER_BT )
@@ -1976,6 +1982,7 @@ static int sony_check_add(struct sony_sc *sc)
1976
1982
int n , ret ;
1977
1983
1978
1984
if ((sc -> quirks & DUALSHOCK4_CONTROLLER_BT ) ||
1985
+ (sc -> quirks & MOTION_CONTROLLER_BT ) ||
1979
1986
(sc -> quirks & SIXAXIS_CONTROLLER_BT )) {
1980
1987
/*
1981
1988
* sony_get_bt_devaddr() attempts to parse the Bluetooth MAC
0 commit comments