Linux bluetooth development
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] profiles/input: disable force-active for Nintendo Switch Pro v1
Date: Wed, 26 Aug 2026 18:41:06 +0200	[thread overview]
Message-ID: <20260826164106.293951-3-frederic.danis@collabora.com> (raw)
In-Reply-To: <20260826164106.293951-1-frederic.danis@collabora.com>

For Nintendo Switch Pro v1 controllers (VID:PID 057e:2009), set
BT_IO_OPT_FORCE_ACTIVE to BT_POWER_FORCE_ACTIVE_OFF on the HID interrupt
channel during connection setup.

This avoids repeated host-triggered Exit Sniff requests and reduces
Sniff/Exit Sniff churn linked to unexpected disconnects.
---
 profiles/input/device.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 5b1be2b16..c2abe2451 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -1065,6 +1065,9 @@ static gboolean encrypt_notify(GIOChannel *io, GIOCondition condition,
 	return FALSE;
 }
 
+#define NINTENDO_VENDOR_ID 0x057e
+#define NINTENDO_PRO_CONTROLLER_PID 0x2009
+
 static int hidp_add_connection(struct input_device *idev)
 {
 	struct hidp_connadd_req *req;
@@ -1101,6 +1104,19 @@ static int hidp_add_connection(struct input_device *idev)
 		goto cleanup;
 	}
 
+	if ((req->vendor == NINTENDO_VENDOR_ID) &&
+		(req->product == NINTENDO_PRO_CONTROLLER_PID)) {
+		if (!bt_io_set(idev->intr_io, &gerr,
+					BT_IO_OPT_FORCE_ACTIVE,
+					BT_POWER_FORCE_ACTIVE_OFF,
+					BT_IO_OPT_INVALID)) {
+			error("btio: %s", gerr->message);
+			g_error_free(gerr);
+			err = -EFAULT;
+			goto cleanup;
+		}
+	}
+
 	/* Encryption is mandatory for keyboards */
 	/* Some platforms may choose to require encryption for all devices */
 	/* Note that this only matters for pre 2.1 devices as otherwise the */
-- 
2.43.0


  parent reply	other threads:[~2026-08-26 16:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 16:41 [PATCH BlueZ 0/2] input: avoid NSP1 disconnects caused by Sniff/Exit Sniff churn Frédéric Danis
2026-08-26 16:41 ` [PATCH BlueZ 1/2] btio: add BT_IO_OPT_FORCE_ACTIVE support for L2CAP sockets Frédéric Danis
2026-08-26 19:13   ` input: avoid NSP1 disconnects caused by Sniff/Exit Sniff churn bluez.test.bot
2026-08-26 16:41 ` Frédéric Danis [this message]
2026-08-26 16:58 ` [PATCH BlueZ 0/2] " Luiz Augusto von Dentz

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=20260826164106.293951-3-frederic.danis@collabora.com \
    --to=frederic.danis@collabora.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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