lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220410220701.5279-1-dbdaniel42@gmail.com>
Date:   Sun, 10 Apr 2022 17:07:01 -0500
From:   Daniel Bomar <dbdaniel42@...il.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Jiri Kosina <jikos@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>
Cc:     linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        Daniel Bomar <dbdaniel42@...il.com>
Subject: [PATCH 3/4] input: xpad: Implement trigger rumble for Xbox One controllers

Signed-off-by: Daniel Bomar <dbdaniel42@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ