@@ -287,6 +287,8 @@ struct dualsense_output_report {
287
287
288
288
#define DS4_INPUT_REPORT_USB 0x01
289
289
#define DS4_INPUT_REPORT_USB_SIZE 64
290
+ #define DS4_INPUT_REPORT_BT_MINIMAL 0x01
291
+ #define DS4_INPUT_REPORT_BT_MINIMAL_SIZE 10
290
292
#define DS4_INPUT_REPORT_BT 0x11
291
293
#define DS4_INPUT_REPORT_BT_SIZE 78
292
294
#define DS4_OUTPUT_REPORT_USB 0x05
@@ -2196,6 +2198,7 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
2196
2198
int battery_status , i , j ;
2197
2199
uint16_t sensor_timestamp ;
2198
2200
unsigned long flags ;
2201
+ bool is_minimal = false;
2199
2202
2200
2203
/*
2201
2204
* DualShock4 in USB uses the full HID report for reportID 1, but
@@ -2223,6 +2226,18 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
2223
2226
ds4_report = & bt -> common ;
2224
2227
num_touch_reports = bt -> num_touch_reports ;
2225
2228
touch_reports = bt -> touch_reports ;
2229
+ } else if (hdev -> bus == BUS_BLUETOOTH &&
2230
+ report -> id == DS4_INPUT_REPORT_BT_MINIMAL &&
2231
+ size == DS4_INPUT_REPORT_BT_MINIMAL_SIZE ) {
2232
+ /* Some third-party pads never switch to the full 0x11 report.
2233
+ * The short 0x01 report is 10 bytes long:
2234
+ * u8 report_id == 0x01
2235
+ * u8 first_bytes_of_full_report[9]
2236
+ * So let's reuse the full report parser, and stop it after
2237
+ * parsing the buttons.
2238
+ */
2239
+ ds4_report = (struct dualshock4_input_report_common * )& data [1 ];
2240
+ is_minimal = true;
2226
2241
} else {
2227
2242
hid_err (hdev , "Unhandled reportID=%d\n" , report -> id );
2228
2243
return -1 ;
@@ -2256,6 +2271,9 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
2256
2271
input_report_key (ds4 -> gamepad , BTN_MODE , ds4_report -> buttons [2 ] & DS_BUTTONS2_PS_HOME );
2257
2272
input_sync (ds4 -> gamepad );
2258
2273
2274
+ if (is_minimal )
2275
+ return 0 ;
2276
+
2259
2277
/* Parse and calibrate gyroscope data. */
2260
2278
for (i = 0 ; i < ARRAY_SIZE (ds4_report -> gyro ); i ++ ) {
2261
2279
int raw_data = (short )le16_to_cpu (ds4_report -> gyro [i ]);
0 commit comments