From: Guillaume Casal <guillaume.casal.42@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
dbdaniel42@gmail.com
Subject: [PATCH v3 1/4] input: Add FF_TRIGGER_RUMBLE effect type
Date: Fri, 31 Jul 2026 07:41:56 +0200 [thread overview]
Message-ID: <20260731054159.1982164-2-guillaume.casal.42@gmail.com> (raw)
In-Reply-To: <20260731054159.1982164-1-guillaume.casal.42@gmail.com>
Some gamepads carry rumble motors behind their triggers, in addition to
the ones in the grips that FF_RUMBLE drives: Xbox controllers call them
impulse triggers, and handhelds such as the ASUS ROG Xbox Ally X have
them too. The force feedback API cannot reach those motors.
Add FF_TRIGGER_RUMBLE as a new effect type carrying its own
struct ff_trigger_rumble_effect, and move FF_EFFECT_MIN down to it, in
the same way FF_HAPTIC was added.
v1 took the approach of the 2022 series and added two members to
struct ff_rumble_effect instead:
https://lore.kernel.org/linux-input/20260730095317.767418-1-guillaume.casal.42@gmail.com/
That is not safe. EVIOCSFF copies the whole struct ff_effect from
userspace, and an application that leaves the tail of the union
uninitialised, which is common when only strong_magnitude and
weak_magnitude are set, would have had that stack content interpreted as
trigger magnitudes. Working programs would start buzzing their triggers
at random. Keeping the size of the union unchanged makes the ABI
compatible in layout, not in meaning.
A distinct effect type has no such problem: no existing application ever
emits it, so no uninitialised byte can be mistaken for a magnitude. It
also removes the need for a separate capability bit, since userspace
discovers the type in the EVIOCGBIT(EV_FF) bitmap exactly as it does for
FF_RUMBLE.
Based on an earlier attempt by Daniel Bomar:
https://lore.kernel.org/lkml/20220410220449.5071-1-dbdaniel42@gmail.com/
Signed-off-by: Guillaume Casal <guillaume.casal.42@gmail.com>
---
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -448,9 +448,27 @@
};
/**
+ * struct ff_trigger_rumble_effect - parameters of a trigger rumble effect
+ * @left_magnitude: magnitude of the motor behind the left trigger
+ * @right_magnitude: magnitude of the motor behind the right trigger
+ *
+ * Some gamepads carry rumble motors behind their triggers, in addition to
+ * the ones in the grips that FF_RUMBLE drives. Xbox controllers call them
+ * impulse triggers.
+ *
+ * Magnitudes span 0 to 0xffff, as for struct ff_rumble_effect. The effect
+ * has no direction: each magnitude addresses one fixed actuator.
+ */
+struct ff_trigger_rumble_effect {
+ __u16 left_magnitude;
+ __u16 right_magnitude;
+};
+
+/**
* struct ff_effect - defines force feedback effect
* @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
- * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
+ * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_TRIGGER_RUMBLE, FF_INERTIA, or
+ * FF_CUSTOM)
* @id: an unique id assigned to an effect
* @direction: direction of the effect
* @trigger: trigger conditions (struct ff_trigger)
@@ -483,6 +501,7 @@
struct ff_periodic_effect periodic;
struct ff_condition_effect condition[2]; /* One for each axis */
struct ff_rumble_effect rumble;
+ struct ff_trigger_rumble_effect trigger_rumble;
struct ff_haptic_effect haptic;
} u;
};
@@ -491,6 +510,7 @@
* Force feedback effect types
*/
+#define FF_TRIGGER_RUMBLE 0x4e
#define FF_HAPTIC 0x4f
#define FF_RUMBLE 0x50
#define FF_PERIODIC 0x51
@@ -501,7 +521,7 @@
#define FF_INERTIA 0x56
#define FF_RAMP 0x57
-#define FF_EFFECT_MIN FF_HAPTIC
+#define FF_EFFECT_MIN FF_TRIGGER_RUMBLE
#define FF_EFFECT_MAX FF_RAMP
/*
next prev parent reply other threads:[~2026-07-31 5:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 9:53 [PATCH 0/3] input: force feedback for trigger rumble motors Guillaume Casal
2026-07-30 9:53 ` [PATCH 1/3] input: uapi: Add trigger_left and trigger_right to ff_rumble_effect struct Guillaume Casal
2026-07-30 10:04 ` sashiko-bot
2026-07-30 9:53 ` [PATCH 2/3] input: ff-memless: Add trigger left/right in ml_combine_effects Guillaume Casal
2026-07-30 10:24 ` sashiko-bot
2026-07-30 9:53 ` [PATCH 3/3] input: Add FF_TRIGGER_RUMBLE capability bit Guillaume Casal
2026-07-30 10:39 ` sashiko-bot
2026-07-30 13:40 ` [PATCH v2 0/4] input: force feedback for trigger rumble motors Guillaume Casal
2026-07-30 13:40 ` [PATCH v2 1/4] input: Add FF_TRIGGER_RUMBLE effect type Guillaume Casal
2026-07-30 13:53 ` sashiko-bot
2026-07-30 13:40 ` [PATCH v2 2/4] input: ff-memless: Handle FF_TRIGGER_RUMBLE Guillaume Casal
2026-07-30 13:40 ` [PATCH v2 3/4] HID: debug: Add FF_TRIGGER_RUMBLE name Guillaume Casal
2026-07-30 13:40 ` [PATCH v2 4/4] Documentation: input: Document FF_TRIGGER_RUMBLE Guillaume Casal
2026-07-31 5:41 ` [PATCH v3 0/4] input: force feedback for trigger rumble motors Guillaume Casal
2026-07-31 5:41 ` Guillaume Casal [this message]
2026-07-31 7:57 ` [PATCH v3 1/4] input: Add FF_TRIGGER_RUMBLE effect type sashiko-bot
2026-07-31 5:41 ` [PATCH v3 2/4] input: ff-memless: Handle FF_TRIGGER_RUMBLE Guillaume Casal
2026-07-31 5:41 ` [PATCH v3 3/4] HID: debug: Add FF_TRIGGER_RUMBLE name Guillaume Casal
2026-07-31 5:41 ` [PATCH v3 4/4] Documentation: input: Document FF_TRIGGER_RUMBLE Guillaume Casal
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=20260731054159.1982164-2-guillaume.casal.42@gmail.com \
--to=guillaume.casal.42@gmail.com \
--cc=dbdaniel42@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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