Re: [PATCH v2 1/2] Input: add input_set_property()

From: José Expósito
Date: Sat Jan 08 2022 - 14:51:27 EST


Hi Dmitry,

On Mon, Jan 03, 2022 at 10:22:42PM -0800, Dmitry Torokhov wrote:
> > +/**
> > + * input_set_property - add a property to the device
> > + * @dev: device to add the property to
> > + * @property: type of the property (INPUT_PROP_POINTER, INPUT_PROP_DIRECT...)
> > + *
> > + * In addition to setting up corresponding bit in dev->propbit the function
> > + * might add or remove related capabilities.
> > + */
> > +void input_set_property(struct input_dev *dev, unsigned int property)
> > +{
> > + switch (property) {
> > + case INPUT_PROP_POINTER:
> > + case INPUT_PROP_DIRECT:
> > + case INPUT_PROP_SEMI_MT:
> > + case INPUT_PROP_TOPBUTTONPAD:
> > + case INPUT_PROP_POINTING_STICK:
> > + case INPUT_PROP_ACCELEROMETER:
> > + break;
> > +
> > + case INPUT_PROP_BUTTONPAD:
> > + input_set_capability(dev, EV_KEY, BTN_LEFT);
> > + __clear_bit(BTN_RIGHT, dev->keybit);
> > + __clear_bit(BTN_MIDDLE, dev->keybit);
>
> I would prefer if we did this when registering input device, not when
> setting this property.

Thanks a lot for pointing me in this direction.

I emailed you v3 [1] implementing the change you suggested and also
including the "Acked-by" tags present in this conversation.

Thanks to everyone for looking into this, appreciate it.

José Expósito

[1] https://lore.kernel.org/linux-input/20220108194235.14401-1-jose.exposito89@xxxxxxxxx/T/#u