diff mbox series

[v3] input/iforce: Assign BTN_DEAD only for specific devices

Message ID 20180726151519.6206-1-timschumi@gmx.de (mailing list archive)
State Accepted
Headers show
Series [v3] input/iforce: Assign BTN_DEAD only for specific devices | expand

Commit Message

Tim Schumacher July 26, 2018, 3:15 p.m. UTC
Move BTN_DEAD into the arrays with the specific button sets
instead of assigning it for every iforce device.

BTN_DEAD represents an optical sensor which detects if the
user is interacting with the device. On devices without that
optical sensor BTN_DEAD is repeatedly causing false inputs
on every status update of the joystick.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
---

This patch is currently a no-op for the WingMan Formula Force
(which this issue is affecting) since it has the btn_wheel
button set assigned (which contains joystick buttons) instead
of btn_avb_wheel (which contains wheel-like buttons).

A patch to move the WMFF from btn_wheel to btn_avb_wheel is
pending, but it may be a better solution to rebuild the button
lists to better reflect the targeted devices.

 drivers/input/joystick/iforce/iforce-main.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Dmitry Torokhov July 27, 2018, 6:58 p.m. UTC | #1
On Thu, Jul 26, 2018 at 05:15:19PM +0200, Tim Schumacher wrote:
> Move BTN_DEAD into the arrays with the specific button sets
> instead of assigning it for every iforce device.
> 
> BTN_DEAD represents an optical sensor which detects if the
> user is interacting with the device. On devices without that
> optical sensor BTN_DEAD is repeatedly causing false inputs
> on every status update of the joystick.
> 
> Signed-off-by: Tim Schumacher <timschumi@gmx.de>

Applied, thank you.

> ---
> 
> This patch is currently a no-op for the WingMan Formula Force
> (which this issue is affecting) since it has the btn_wheel
> button set assigned (which contains joystick buttons) instead
> of btn_avb_wheel (which contains wheel-like buttons).
> 
> A patch to move the WMFF from btn_wheel to btn_avb_wheel is
> pending, but it may be a better solution to rebuild the button
> lists to better reflect the targeted devices.
> 
>  drivers/input/joystick/iforce/iforce-main.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
> index daeeb4c7e3b0..94b839399e08 100644
> --- a/drivers/input/joystick/iforce/iforce-main.c
> +++ b/drivers/input/joystick/iforce/iforce-main.c
> @@ -33,19 +33,21 @@ MODULE_LICENSE("GPL");
>  
>  static signed short btn_joystick[] =
>  { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
> -  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 };
> +  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A,
> +  BTN_B, BTN_C, BTN_DEAD, -1 };
>  
>  static signed short btn_avb_pegasus[] =
>  { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
> -  BTN_BASE2, BTN_BASE3, BTN_BASE4, -1 };
> +  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_DEAD, -1 };
>  
>  static signed short btn_wheel[] =
>  { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
> -  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 };
> +  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A,
> +  BTN_B, BTN_C, BTN_DEAD, -1 };
>  
>  static signed short btn_avb_tw[] =
>  { BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE,
> -  BTN_BASE2, BTN_BASE3, BTN_BASE4, -1 };
> +  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_DEAD, -1 };
>  
>  static signed short btn_avb_wheel[] =
>  { BTN_GEAR_DOWN, BTN_GEAR_UP, BTN_BASE, BTN_BASE2, BTN_BASE3,
> @@ -388,7 +390,6 @@ int iforce_init_device(struct iforce *iforce)
>  
>  	for (i = 0; iforce->type->btn[i] >= 0; i++)
>  		set_bit(iforce->type->btn[i], input_dev->keybit);
> -	set_bit(BTN_DEAD, input_dev->keybit);
>  
>  	for (i = 0; iforce->type->abs[i] >= 0; i++) {
>  
> -- 
> 2.18.0
>
diff mbox series

Patch

diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index daeeb4c7e3b0..94b839399e08 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -33,19 +33,21 @@  MODULE_LICENSE("GPL");
 
 static signed short btn_joystick[] =
 { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
-  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 };
+  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A,
+  BTN_B, BTN_C, BTN_DEAD, -1 };
 
 static signed short btn_avb_pegasus[] =
 { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
-  BTN_BASE2, BTN_BASE3, BTN_BASE4, -1 };
+  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_DEAD, -1 };
 
 static signed short btn_wheel[] =
 { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
-  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 };
+  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A,
+  BTN_B, BTN_C, BTN_DEAD, -1 };
 
 static signed short btn_avb_tw[] =
 { BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE,
-  BTN_BASE2, BTN_BASE3, BTN_BASE4, -1 };
+  BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_DEAD, -1 };
 
 static signed short btn_avb_wheel[] =
 { BTN_GEAR_DOWN, BTN_GEAR_UP, BTN_BASE, BTN_BASE2, BTN_BASE3,
@@ -388,7 +390,6 @@  int iforce_init_device(struct iforce *iforce)
 
 	for (i = 0; iforce->type->btn[i] >= 0; i++)
 		set_bit(iforce->type->btn[i], input_dev->keybit);
-	set_bit(BTN_DEAD, input_dev->keybit);
 
 	for (i = 0; iforce->type->abs[i] >= 0; i++) {