public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Webster <awebster@gmail.com>
To: Roderick Colenbrander <roderick.colenbrander@sony.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Aaron Webster <awebster@gmail.com>
Subject: [PATCH] HID: playstation: Add DualSense Edge extra button support
Date: Mon,  6 Apr 2026 21:40:08 -0700	[thread overview]
Message-ID: <20260407044008.40222-1-awebster@gmail.com> (raw)

The DualSense Edge controller (product ID 0x0df2) has four additional
buttons compared to the standard DualSense: two front function buttons
(Fn1 and Fn2) and two rear paddles (left and right). These are reported
in bits 4-7 of buttons[2] in the input report.

Map them to BTN_TRIGGER_HAPPY1 through BTN_TRIGGER_HAPPY4 so that
userspace applications can use these extra inputs. An is_edge flag
gates the extra button handling based on the product ID.

Signed-off-by: Aaron Webster <awebster@gmail.com>
---
Tested with a DualSense Edge controller (Hardware: 1000208, Firmware:
1000087 type 3, Fw version: 20 131082 6, Sw series: 68, Update version:
0213, build date Jul 4 2025) on Debian 13 (trixie) with kernel
6.12.74+deb13+1-amd64 (x86_64) via Bluetooth.

 drivers/hid/hid-playstation.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 3c0db8f93..962159239 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -112,6 +112,12 @@ struct ps_led_info {
 #define DS_BUTTONS2_TOUCHPAD	BIT(1)
 #define DS_BUTTONS2_MIC_MUTE	BIT(2)
 
+/* DualSense Edge extra buttons in buttons[2], bits 4-7. */
+#define DS_EDGE_BUTTONS_FN1		BIT(4)
+#define DS_EDGE_BUTTONS_FN2		BIT(5)
+#define DS_EDGE_BUTTONS_LEFT_PADDLE	BIT(6)
+#define DS_EDGE_BUTTONS_RIGHT_PADDLE	BIT(7)
+
 /* Status fields of DualSense input report. */
 #define DS_STATUS0_BATTERY_CAPACITY		GENMASK(3, 0)
 #define DS_STATUS0_CHARGING			GENMASK(7, 4)
@@ -178,6 +184,9 @@ struct dualsense {
 	struct input_dev *touchpad;
 	struct input_dev *jack;
 
+	/* True if this is a DualSense Edge (product 0x0df2). */
+	bool is_edge;
+
 	/* Update version is used as a feature/capability version. */
 	u16 update_version;
 
@@ -1486,6 +1495,18 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r
 	input_report_key(ds->gamepad, BTN_THUMBL, ds_report->buttons[1] & DS_BUTTONS1_L3);
 	input_report_key(ds->gamepad, BTN_THUMBR, ds_report->buttons[1] & DS_BUTTONS1_R3);
 	input_report_key(ds->gamepad, BTN_MODE,   ds_report->buttons[2] & DS_BUTTONS2_PS_HOME);
+
+	if (ds->is_edge) {
+		input_report_key(ds->gamepad, BTN_TRIGGER_HAPPY1,
+				 ds_report->buttons[2] & DS_EDGE_BUTTONS_FN1);
+		input_report_key(ds->gamepad, BTN_TRIGGER_HAPPY2,
+				 ds_report->buttons[2] & DS_EDGE_BUTTONS_FN2);
+		input_report_key(ds->gamepad, BTN_TRIGGER_HAPPY3,
+				 ds_report->buttons[2] & DS_EDGE_BUTTONS_LEFT_PADDLE);
+		input_report_key(ds->gamepad, BTN_TRIGGER_HAPPY4,
+				 ds_report->buttons[2] & DS_EDGE_BUTTONS_RIGHT_PADDLE);
+	}
+
 	input_sync(ds->gamepad);
 
 	/*
@@ -1785,6 +1806,7 @@ static struct ps_device *dualsense_create(struct hid_device *hdev)
 		ds->use_vibration_v2 = ds->update_version >= DS_FEATURE_VERSION(2, 21);
 	} else if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) {
 		ds->use_vibration_v2 = true;
+		ds->is_edge = true;
 	}
 
 	ret = ps_devices_list_add(ps_dev);
@@ -1802,6 +1824,15 @@ static struct ps_device *dualsense_create(struct hid_device *hdev)
 		ret = PTR_ERR(ds->gamepad);
 		goto err;
 	}
+
+	/* Register DualSense Edge back paddle and Fn buttons. */
+	if (ds->is_edge) {
+		input_set_capability(ds->gamepad, EV_KEY, BTN_TRIGGER_HAPPY1);
+		input_set_capability(ds->gamepad, EV_KEY, BTN_TRIGGER_HAPPY2);
+		input_set_capability(ds->gamepad, EV_KEY, BTN_TRIGGER_HAPPY3);
+		input_set_capability(ds->gamepad, EV_KEY, BTN_TRIGGER_HAPPY4);
+	}
+
 	/* Use gamepad input device name as primary device name for e.g. LEDs */
 	ps_dev->input_dev_name = dev_name(&ds->gamepad->dev);
 
-- 
2.47.3


                 reply	other threads:[~2026-04-07  4:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260407044008.40222-1-awebster@gmail.com \
    --to=awebster@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roderick.colenbrander@sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox