diff -urN linux-6.18-orig/drivers/hid/Kconfig linux-6.18/drivers/hid/Kconfig --- linux-6.18-orig/drivers/hid/Kconfig 2025-12-01 07:42:10 +0900 +++ linux-6.18/drivers/hid/Kconfig 2026-06-16 14:45:45 +0900 @@ -1005,6 +1005,20 @@ Say Y here if you would like to enable force feedback support for PlayStation game controllers. +config PLAYSTATION_TOUCHPAD + bool "Support touchpad on Sony PS4 gamepad" + depends on HID_PLAYSTATION + default y + help + Say N to disable support for the touchpad on the DualShock 4 + controller. This prevents the touchpad as being recognized as a + pointing device and interfering with normal mouse input. In this + case, the touchpad button (pressing down on the touchpad) is + reported as an extra controller button, specifically BTN_Z, + instead of the left button of the pointing device. + + If unsure, say Y. + config HID_PXRC tristate "PhoenixRC HID Flight Controller" depends on HID diff -urN linux-6.18-orig/drivers/hid/hid-playstation.c linux-6.18/drivers/hid/hid-playstation.c --- linux-6.18-orig/drivers/hid/hid-playstation.c 2025-12-01 07:42:10 +0900 +++ linux-6.18/drivers/hid/hid-playstation.c 2026-06-16 14:46:34 +0900 @@ -402,7 +402,9 @@ struct ps_device base; struct input_dev *gamepad; struct input_dev *sensors; +#ifdef CONFIG_PLAYSTATION_TOUCHPAD struct input_dev *touchpad; +#endif /* Calibration data for accelerometer and gyroscope. */ struct ps_calibration_data accel_calib_data[3]; @@ -549,7 +551,7 @@ /* * Common gamepad buttons across DualShock 3 / 4 and DualSense. * Note: for device with a touchpad, touchpad button is not included - * as it will be part of the touchpad device. + * when it will be part of the touchpad device. */ static const int ps_gamepad_buttons[] = { BTN_WEST, /* Square */ @@ -928,6 +930,7 @@ return sensors; } +#ifdef CONFIG_PLAYSTATION_TOUCHPAD static struct input_dev *ps_touchpad_create(struct hid_device *hdev, int width, int height, unsigned int num_contacts) { @@ -955,6 +958,7 @@ return touchpad; } +#endif static struct input_dev *ps_headset_jack_create(struct hid_device *hdev) { @@ -1561,6 +1565,7 @@ input_event(ds->sensors, EV_MSC, MSC_TIMESTAMP, ds->sensor_timestamp_us); input_sync(ds->sensors); +#ifdef CONFIG_PLAYSTATION_TOUCHPAD for (i = 0; i < ARRAY_SIZE(ds_report->points); i++) { struct dualsense_touch_point *point = &ds_report->points[i]; bool active = (point->contact & DS_TOUCH_POINT_INACTIVE) ? false : true; @@ -1578,6 +1583,9 @@ input_mt_sync_frame(ds->touchpad); input_report_key(ds->touchpad, BTN_LEFT, ds_report->buttons[2] & DS_BUTTONS2_TOUCHPAD); input_sync(ds->touchpad); +#else + input_report_key(ds->gamepad, BTN_Z, ds_report->buttons[2] & DS_BUTTONS2_TOUCHPAD); +#endif battery_data = FIELD_GET(DS_STATUS0_BATTERY_CAPACITY, ds_report->status[0]); charging_status = FIELD_GET(DS_STATUS0_CHARGING, ds_report->status[0]); @@ -1805,11 +1813,15 @@ goto err; } +#ifdef CONFIG_PLAYSTATION_TOUCHPAD ds->touchpad = ps_touchpad_create(hdev, DS_TOUCHPAD_WIDTH, DS_TOUCHPAD_HEIGHT, 2); if (IS_ERR(ds->touchpad)) { ret = PTR_ERR(ds->touchpad); goto err; } +#else + input_set_capability(ds->gamepad, EV_KEY, BTN_Z); +#endif /* Bluetooth audio is currently not supported. */ if (hdev->bus == BUS_USB) { @@ -2356,7 +2368,10 @@ struct dualshock4_input_report_common *ds4_report; struct dualshock4_touch_report *touch_reports; u8 battery_capacity, num_touch_reports, value; - int battery_status, i, j; + int battery_status, i; +#ifdef CONFIG_PLAYSTATION_TOUCHPAD + int j; +#endif u16 sensor_timestamp; bool is_minimal = false; @@ -2472,6 +2487,7 @@ input_event(ds4->sensors, EV_MSC, MSC_TIMESTAMP, ds4->sensor_timestamp_us); input_sync(ds4->sensors); +#ifdef CONFIG_PLAYSTATION_TOUCHPAD for (i = 0; i < num_touch_reports; i++) { struct dualshock4_touch_report *touch_report = &touch_reports[i]; @@ -2493,6 +2509,9 @@ input_sync(ds4->touchpad); } input_report_key(ds4->touchpad, BTN_LEFT, ds4_report->buttons[2] & DS_BUTTONS2_TOUCHPAD); +#else + input_report_key(ds4->gamepad, BTN_Z, ds4_report->buttons[2] & DS_BUTTONS2_TOUCHPAD); +#endif /* * Interpretation of the battery_capacity data depends on the cable state. @@ -2768,11 +2787,15 @@ goto err; } +#ifdef CONFIG_PLAYSTATION_TOUCHPAD ds4->touchpad = ps_touchpad_create(hdev, DS4_TOUCHPAD_WIDTH, DS4_TOUCHPAD_HEIGHT, 2); if (IS_ERR(ds4->touchpad)) { ret = PTR_ERR(ds4->touchpad); goto err; } +#else + input_set_capability(ds4->gamepad, EV_KEY, BTN_Z); +#endif ret = ps_device_register_battery(ps_dev); if (ret)