From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2611377A9C for ; Sat, 1 Aug 2026 09:01:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785574870; cv=none; b=R4a40rP1V2p+s5kzUmwvejxcydEllIFlcN+3hgYapSaLcganygzPDHycc5+BHlgGKnMGryflhHMLitLD0UiWzthlPmFaFbdyJ7KdN+exX5PWWop7bSXjnwZFgKHnI9wRImw8Oea1RUD8JTn/gICgIG5qJUBIrTEXrKydR4I+VW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785574870; c=relaxed/simple; bh=ASCMJWrFpviMulxYbxqhz2oAsml9SOnD/nYqETHec3g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rvqxu5tpQnMc99rACBH/q+Ntoa+ZfwRN1ErVWVZ7RsBwnvk5+J4w24HFTDNqGWBVRh88ar6ez17SppUURUEFZt7o88FcwLAyx9nPac2uz3eeGG30w49x9dceOmG4wyk2C0j4wHRj/aYuBlgaYIIYonkYStc/FlAXVfDxOOnDscs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FBrXwqbK; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FBrXwqbK" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-49557167508so4766225e9.1 for ; Sat, 01 Aug 2026 02:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785574864; x=1786179664; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=RLebyPNAQYMs2atXyqoEwp6i5xpU6rXMBJl7j5uTfe8=; b=FBrXwqbKuvYi9r3/bmlBMr9WWwG2lN8CxSRyB0NPYo76UUVUSJ2qzUKcLtLWvqhnz3 di6Drwt4HTXeAnQKhGB3LtD8LNd8zq9sClh4vyedUzo5X2Wazo7KMT7BHIV2GyfHoeIH kOZf48LFv62Y9/Rph4qoVV2GQLXMlxgsedmpc1g+7TQeHhiBGHBPuybHuB/u6n3ikm1V EtPqata3jXg8daHDXbncF+OHCJfvPIHB9H7gzksiDdqcPD9V9dE7F4s2o+2rTS35aEfA JyKFjJETx9O2usxkd1208OgmjYLtLrRMIyKvZFdIbS7krJSQnTrtFfB0lwj7Y5U7IsvB nwZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785574864; x=1786179664; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RLebyPNAQYMs2atXyqoEwp6i5xpU6rXMBJl7j5uTfe8=; b=bI56+bdZainKGui6V9Xdaol3qWYlWf8iocNvqvspVlTioJUDw/zUN2M8PTungPZify 0tdRQoS4BRjAIw6o7temTIkyT54udx10RjBPPhAT+XO0g4XBZa4BReNBS9s8gcVGQA3U VfRi8YXsyMupE2MGIrp+JAmQ67s9Kg756NIbYRVAg1Ezbyjfb2Kjl3BBGbjUd8fTCPAP leIMhdIU64cowNTB3ZSiPAUtdyOo5/877SuK1c1UBttnUwRNk9S6tUUidjjXhLTnPaaj 5wGxs3qGabjexT8c45PJU03iBo/6e+pAbOvduGUL8/zSTvwBlHxuPOaQSvZYojwnt6f4 wWng== X-Forwarded-Encrypted: i=1; AHgh+RqJKBmVtiHrOHzOwOtAc3oY289vom54OEcqjkoAmDpQ+qQ0cBB9k3Hkqd9vapfwuI1b8+j0lmazIkJhFJk=@vger.kernel.org X-Gm-Message-State: AOJu0YwFpcIClN+5X9ytX0QE+Yd/3tS7n8nP+vpwxfrd6Y6R7SLoKvYq EApUtBTyO2+pgh3Tpvb/Ml4w3XoVB39dRJlYjlVVxuoRqxY3isoYs4W3 X-Gm-Gg: AR+sD11KoJwGYwf1iWnes2cFezdsNHCuM4VkA1GjpRCpada1mmUMbbWe0hJRmPSlVop vFDtYOHAbt68Y2EmTGBpbwtu6mbPE8/WBaRpzwrZluu5v93YwSLGQYr++5PGs8+UMqmDetcLzUo pcJiLRPhhj7qpHDIGkVJlgh9YB/1CTtVCYQzv5TMAJBSfhic+IxRHlXI9k9PYpNmpPHQFpjaPvF P/fRz2CrV2xb/+sWUB49xvTjTG+uDlP8g9uoPNXIdnnAwqRdp+YBJuLlcL6BxWaQIzRGunC2aH4 0XIjZArXoazaD7TtM1dRy8VV6SS66UYgG89Bpl7GnrCg5Rf864Vw18RqoCn+7zL67k/N270wXh1 ajTisKnlkgLcAHx0te7e6DQCbLQhwxDwM00KPrnfHObkiibgIUg2Gz4mXxwvVbUcxWfrHpHIFnT TrBHuQWAgAQAXC7+CjYynibv1tscsYvaTUL2VCjbu4BG+gkx6hnW0pVi+XXi6Z449/GaI+pytso 3tpARBU8OIc/yvz8TwvAdw5wA7He3IX X-Received: by 2002:a05:600c:4e52:b0:496:bbce:fc with SMTP id 5b1f17b1804b1-4980c658ff3mr34073065e9.12.1785574864411; Sat, 01 Aug 2026 02:01:04 -0700 (PDT) Received: from cyln000394.fritz.box ([79.132.233.190]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49807b86d66sm17257775e9.1.2026.08.01.02.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2026 02:01:03 -0700 (PDT) From: Alexandre Derumier To: "Daniel J . Ogorchock" Cc: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Derumier Subject: [PATCH] HID: nintendo: fix rumble starved by the input report cadence gate Date: Sat, 1 Aug 2026 11:00:59 +0200 Message-ID: <20260801090059.1349535-1-aderumier@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Rumble on third-party controllers speaking the Switch protocol is weak and intermittent over bluetooth, and absent on some units. Since commit d750d1480362 ("HID: nintendo: fix rumble rate limiter"), joycon_enforce_subcmd_rate() requires JC_SUBCMD_VALID_DELTA_REQ (3) consecutive input reports spaced 8-17ms apart before releasing a subcommand. That window is the official Pro Controller's bluetooth cadence, and controllers that do not report on it cannot pass the gate, so their rumble is starved. Measured over bluetooth on one host, reading the controller directly, fraction of reports at which the requirement is met: official Pro Controller 95% Datafrog clone 46-52% 8BitDo Pro 2 2.5-4% The Pro 2 delivers reports in pairs, so 11-19% of its deltas are 0ms and reset the counter. Affected controllers report Nintendo's USB IDs, and the MAC is no better: the Datafrog clone reports an OUI registered to Nintendo, so identifying them by vendor would misclassify it. Instead, notice when the requirement cannot be met: after JC_SUBCMD_RATE_MAX_FAILURES exhaustions of the limiter, fall back to the pre-d750d1480362 throttle, which keeps the 25ms spacing and the transmit-after-receive synchronisation from commit e93363f716a2 ("HID: nintendo: ratelimit subcommands and rumble") and drops only the cadence requirement. Exhaustions are counted cumulatively, as an affected controller meets the requirement occasionally and a consecutive count would never be reached. Signed-off-by: Alexandre Derumier --- drivers/hid/hid-nintendo.c | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index 0000000..0000000 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -609,6 +609,8 @@ struct joycon_ctlr { unsigned int last_input_report_msecs; unsigned int last_subcmd_sent_msecs; unsigned int consecutive_valid_report_deltas; + unsigned int subcmd_rate_exhaustions; + bool subcmd_rate_relaxed; /* factory calibration data */ struct joycon_stick_cal left_stick_cal_x; @@ -841,10 +843,11 @@ static void joycon_wait_for_input_report(struct joycon_ctlr *ctlr) #define JC_SUBCMD_TX_OFFSET_MS 4 #define JC_SUBCMD_VALID_DELTA_REQ 3 #define JC_SUBCMD_RATE_MAX_ATTEMPTS 25 +#define JC_SUBCMD_RATE_MAX_FAILURES 4 #define JC_SUBCMD_RATE_LIMITER_USB_MS 20 #define JC_SUBCMD_RATE_LIMITER_BT_MS 60 #define JC_SUBCMD_RATE_LIMITER_MS(ctlr) ((ctlr)->hdev->bus == BUS_USB ? JC_SUBCMD_RATE_LIMITER_USB_MS : JC_SUBCMD_RATE_LIMITER_BT_MS) -static void joycon_enforce_subcmd_rate(struct joycon_ctlr *ctlr) +static void joycon_enforce_subcmd_rate_strict(struct joycon_ctlr *ctlr) { unsigned int current_ms; unsigned long subcmd_delta; @@ -872,6 +875,14 @@ static void joycon_enforce_subcmd_rate(struct joycon_ctlr *ctlr) if (attempts >= JC_SUBCMD_RATE_MAX_ATTEMPTS) { hid_warn(ctlr->hdev, "%s: exceeded max attempts", __func__); + + if (++ctlr->subcmd_rate_exhaustions == JC_SUBCMD_RATE_MAX_FAILURES) { + ctlr->subcmd_rate_relaxed = true; + hid_info(ctlr->hdev, + "input report cadence does not fit the %d-%dms window; using the legacy subcommand throttle\n", + JC_INPUT_REPORT_MIN_DELTA, + JC_INPUT_REPORT_MAX_DELTA); + } return; } @@ -886,6 +897,32 @@ static void joycon_enforce_subcmd_rate(struct joycon_ctlr *ctlr) msleep(JC_SUBCMD_TX_OFFSET_MS); } +/* The rate limiter as it was before commit d750d1480362, without the report + * cadence requirement. + */ +static void joycon_enforce_subcmd_rate_legacy(struct joycon_ctlr *ctlr) +{ + static const unsigned int max_subcmd_rate_ms = 25; + unsigned int current_ms = jiffies_to_msecs(jiffies); + unsigned int delta_ms = current_ms - ctlr->last_subcmd_sent_msecs; + + while (delta_ms < max_subcmd_rate_ms && + ctlr->ctlr_state == JOYCON_CTLR_STATE_READ) { + joycon_wait_for_input_report(ctlr); + current_ms = jiffies_to_msecs(jiffies); + delta_ms = current_ms - ctlr->last_subcmd_sent_msecs; + } + ctlr->last_subcmd_sent_msecs = current_ms; +} + +static void joycon_enforce_subcmd_rate(struct joycon_ctlr *ctlr) +{ + if (ctlr->subcmd_rate_relaxed) + joycon_enforce_subcmd_rate_legacy(ctlr); + else + joycon_enforce_subcmd_rate_strict(ctlr); +} + static int joycon_hid_send_sync(struct joycon_ctlr *ctlr, u8 *data, size_t len, u32 timeout) { base-commit: 0131b508c0e2489eac6e121135988f6eeb716f19 -- 2.51.0