linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Do not map BTN_RIGHT/MIDDLE on buttonpads
@ 2021-11-23 19:12 José Expósito
  2021-11-23 19:12 ` [PATCH 1/1] HID: multitouch: only map BTN_LEFT " José Expósito
  2021-11-24  9:39 ` [PATCH 0/1] Do not map BTN_RIGHT/MIDDLE " Benjamin Tissoires
  0 siblings, 2 replies; 6+ messages in thread
From: José Expósito @ 2021-11-23 19:12 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, peter.hutterer, linux-input, linux-kernel,
	José Expósito

Hi all,

Historically, libinput has relayed on the INPUT_PROP_BUTTONPAD property
to detect buttonpads.

Since buttonpads are expected to have only one button (BTN_LEFT),
recently we added a new rule to detect buttonpads: Where a touchpad
maps the BTN_RIGHT bit, libinput assumes it is NOT a buttonpad.

However, this change leaded to several false possitives, so we ended up
reverting it. For more context:
https://gitlab.freedesktop.org/libinput/libinput/-/issues/704

And for a full list of affected hardware, HID reports and bug reports
please see:
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/726

My understanding is that buttonpads should not map BTN_RIGHT and/or
BTN_MIDDLE and to avoid it I would like to fix the required drivers.

One option to fix it (this patch) is to clear the bits that might have
been added because of the HID descriptor on every driver.
However, since this code will be common to all drivers, I would like to
ask if you consider it worth it to add a function to handle adding
properties.

A function similar to input_set_capability but for props could be added
in input.h/c:

    /**
     * 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);
                    break;

            default:
                    pr_err("%s: unknown property %u\n", __func__, property);
                    dump_stack();
                    return;
            }

            __set_bit(property, dev->propbit);
    }
    EXPORT_SYMBOL(input_set_property);


Which approach do you think is the best?

Thank you very much in advance,
Jose


José Expósito (1):
  HID: multitouch: only map BTN_LEFT on buttonpads

 drivers/hid/hid-multitouch.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-01  5:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-23 19:12 [PATCH 0/1] Do not map BTN_RIGHT/MIDDLE on buttonpads José Expósito
2021-11-23 19:12 ` [PATCH 1/1] HID: multitouch: only map BTN_LEFT " José Expósito
2021-11-24  8:43   ` kernel test robot
2021-11-24  9:39 ` [PATCH 0/1] Do not map BTN_RIGHT/MIDDLE " Benjamin Tissoires
2021-11-24 19:53   ` José Expósito
2021-12-01  5:56   ` Peter Hutterer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).