Patchwork [4/4] Input: joydev - ignore devices which don't want joydev

login
register
mail settings
Submitter roderick@gaikai.com
Date Aug. 24, 2017, 11:11 p.m.
Message ID <20170824231153.8809-5-roderick@gaikai.com>
Download mbox | patch
Permalink /patch/9921091/
State New
Headers show

Comments

roderick@gaikai.com - Aug. 24, 2017, 11:11 p.m.
From: Roderick Colenbrander <roderick.colenbrander@sony.com>

Gamepads like DualShock 3 / 4 as of 4.12 started reporting motion
sensors on a separate evdev node. Joydev is picking these devices
up as well, but they don't make sense for the joydev interface.
This patch leverages INPUT_PROP_JOYDEV_IGNORE to not create joydev
devices for devices, which don't want them.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
---
 drivers/input/joydev.c | 4 ++++
 1 file changed, 4 insertions(+)
Bastien Nocera - Aug. 25, 2017, 8:48 a.m.
On Thu, 2017-08-24 at 16:11 -0700, Roderick Colenbrander wrote:
> From: Roderick Colenbrander <roderick.colenbrander@sony.com>
> 
> Gamepads like DualShock 3 / 4 as of 4.12 started reporting motion
> sensors on a separate evdev node. Joydev is picking these devices
> up as well, but they don't make sense for the joydev interface.

Again, they do make sense, but programs using joydev are unlikely to
see updates any time soon. See the comment for patch 1, this needs to
be reworded.

> This patch leverages INPUT_PROP_JOYDEV_IGNORE to not create joydev
> devices for devices, which don't want them.

"to not create joydev device nodes for devices which don't want it".

> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
> ---
>  drivers/input/joydev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
> index 29d677c..a60cfb3 100644
> --- a/drivers/input/joydev.c
> +++ b/drivers/input/joydev.c
> @@ -819,6 +819,10 @@ static bool joydev_match(struct input_handler
> *handler, struct input_dev *dev)
>  	if (joydev_dev_is_absolute_mouse(dev))
>  		return false;
>  
> +	/* Avoid devices, which don't want to be reported by joydev.
> */
> +	if (test_bit(INPUT_PROP_JOYDEV_IGNORE, dev->propbit))
> +		return false;
> +
>  	return true;
>  }
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 29d677c..a60cfb3 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -819,6 +819,10 @@  static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
 	if (joydev_dev_is_absolute_mouse(dev))
 		return false;
 
+	/* Avoid devices, which don't want to be reported by joydev. */
+	if (test_bit(INPUT_PROP_JOYDEV_IGNORE, dev->propbit))
+		return false;
+
 	return true;
 }