diff mbox

[3/3] Input: joydev - ignore accelerometer devices

Message ID 20170818020156.23390-4-roderick@gaikai.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roderick Colenbrander Aug. 18, 2017, 2:01 a.m. UTC
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.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
---
 drivers/input/joydev.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bastien Nocera Aug. 23, 2017, 8:45 a.m. UTC | #1
On Thu, 2017-08-17 at 19:01 -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.
> 
> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
> ---
>  drivers/input/joydev.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
> index 29d677c..9b70fe0 100644
> --- a/drivers/input/joydev.c
> +++ b/drivers/input/joydev.c
> @@ -819,6 +819,11 @@ static bool joydev_match(struct input_handler
> *handler, struct input_dev *dev)
>  	if (joydev_dev_is_absolute_mouse(dev))
>  		return false;
>  
> +	/* Avoid accelerometers on composite devices. */
> +	if (test_bit(INPUT_PROP_ACCELEROMETER, dev->propbit) &&
> +	    test_bit(INPUT_PROP_COMPOSITE, dev->propbit))
> +		return false;

I don't understand how making a laptop's builtin hard-drive drop sensor
into a joystick device is acceptable, but the same device inside an
external joypad isn't.

Either all accelerometers are blocked through this interface, or none
are.
--
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
Roderick Colenbrander Aug. 24, 2017, 12:01 a.m. UTC | #2
On Wed, Aug 23, 2017 at 1:45 AM, Bastien Nocera <hadess@hadess.net> wrote:
> On Thu, 2017-08-17 at 19:01 -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.
>>
>> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
>> ---
>>  drivers/input/joydev.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
>> index 29d677c..9b70fe0 100644
>> --- a/drivers/input/joydev.c
>> +++ b/drivers/input/joydev.c
>> @@ -819,6 +819,11 @@ static bool joydev_match(struct input_handler
>> *handler, struct input_dev *dev)
>>       if (joydev_dev_is_absolute_mouse(dev))
>>               return false;
>>
>> +     /* Avoid accelerometers on composite devices. */
>> +     if (test_bit(INPUT_PROP_ACCELEROMETER, dev->propbit) &&
>> +         test_bit(INPUT_PROP_COMPOSITE, dev->propbit))
>> +             return false;
>
> I don't understand how making a laptop's builtin hard-drive drop sensor
> into a joystick device is acceptable, but the same device inside an
> external joypad isn't.
>
> Either all accelerometers are blocked through this interface, or none
> are.

I agree. The main question is probably what devices do we really want
to support through this legacy interface? It should mostly be used by
old applications by now, which probably can't handle motion anyway, so
why not drop it in any case. Also only 3 drivers are setting this flag
right now.
--
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
diff mbox

Patch

diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 29d677c..9b70fe0 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -819,6 +819,11 @@  static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
 	if (joydev_dev_is_absolute_mouse(dev))
 		return false;
 
+	/* Avoid accelerometers on composite devices. */
+	if (test_bit(INPUT_PROP_ACCELEROMETER, dev->propbit) &&
+	    test_bit(INPUT_PROP_COMPOSITE, dev->propbit))
+		return false;
+
 	return true;
 }