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 2/4] input: ff-memless: Handle FF_TRIGGER_RUMBLE
Date: Fri, 31 Jul 2026 07:41:57 +0200 [thread overview]
Message-ID: <20260731054159.1982164-3-guillaume.casal.42@gmail.com> (raw)
In-Reply-To: <20260731054159.1982164-1-guillaume.casal.42@gmail.com>
Combine trigger rumble effects the way the other types are combined, so
that drivers using input_ff_create_memless() receive them.
Because ml_get_combo_effect() groups playing effects by type, a trigger
rumble effect forms its own combo and reaches the driver in its own
play_effect() call, leaving FF_RUMBLE untouched. An effect that has
finished still contributes its type to the combo with zero magnitudes,
so the existing stop path works unchanged.
Signed-off-by: Guillaume Casal <guillaume.casal.42@gmail.com>
---
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -289,6 +289,15 @@
min(weak + effect->u.rumble.weak_magnitude, 0xffffU);
break;
+ case FF_TRIGGER_RUMBLE:
+ effect->u.trigger_rumble.left_magnitude =
+ min((u32)new->u.trigger_rumble.left_magnitude * gain / 0xffff +
+ effect->u.trigger_rumble.left_magnitude, 0xffffU);
+ effect->u.trigger_rumble.right_magnitude =
+ min((u32)new->u.trigger_rumble.right_magnitude * gain / 0xffff +
+ effect->u.trigger_rumble.right_magnitude, 0xffffU);
+ break;
+
case FF_PERIODIC:
i = apply_envelope(state, abs(new->u.periodic.magnitude),
&new->u.periodic.envelope);
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 ` [PATCH v3 1/4] input: Add FF_TRIGGER_RUMBLE effect type Guillaume Casal
2026-07-31 7:57 ` sashiko-bot
2026-07-31 5:41 ` Guillaume Casal [this message]
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-3-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