All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] input: xpad: Implement trigger rumble for Xbox One controllers
@ 2022-04-10 22:07 Daniel Bomar
  0 siblings, 0 replies; only message in thread
From: Daniel Bomar @ 2022-04-10 22:07 UTC (permalink / raw)
  To: Dmitry Torokhov, Jiri Kosina, Benjamin Tissoires
  Cc: linux-input, linux-kernel, Daniel Bomar

Signed-off-by: Daniel Bomar <dbdaniel42@gmail.com>
---
 drivers/input/joystick/xpad.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 18190b529bca..0ac59ce03e58 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1251,6 +1251,8 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
 	struct xpad_output_packet *packet = &xpad->out_packets[XPAD_OUT_FF_IDX];
 	__u16 strong;
 	__u16 weak;
+	__u16 trigger_left;
+	__u16 trigger_right;
 	int retval;
 	unsigned long flags;
 
@@ -1259,6 +1261,8 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
 
 	strong = effect->u.rumble.strong_magnitude;
 	weak = effect->u.rumble.weak_magnitude;
+	trigger_left = effect->u.rumble.trigger_left;
+	trigger_right = effect->u.rumble.trigger_right;
 
 	spin_lock_irqsave(&xpad->odata_lock, flags);
 
@@ -1311,8 +1315,8 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
 		packet->data[3] = 0x09;
 		packet->data[4] = 0x00;
 		packet->data[5] = 0x0F;
-		packet->data[6] = 0x00;
-		packet->data[7] = 0x00;
+		packet->data[6] = trigger_left / 512;
+		packet->data[7] = trigger_right / 512;
 		packet->data[8] = strong / 512;	/* left actuator */
 		packet->data[9] = weak / 512;	/* right actuator */
 		packet->data[10] = 0xFF; /* on period */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-10 22:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-10 22:07 [PATCH 3/4] input: xpad: Implement trigger rumble for Xbox One controllers Daniel Bomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.