stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	"Peter Hutterer" <peter.hutterer@who-t.net>,
	"Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
	"Jiri Kosina" <jkosina@suse.cz>,
	"José Expósito" <jose.exposito89@gmail.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 5.10 007/105] Input: clear BTN_RIGHT/MIDDLE on buttonpads
Date: Mon,  7 Mar 2022 10:18:10 +0100	[thread overview]
Message-ID: <20220307091644.391979531@linuxfoundation.org> (raw)
In-Reply-To: <20220307091644.179885033@linuxfoundation.org>

From: José Expósito <jose.exposito89@gmail.com>

[ Upstream commit 37ef4c19b4c659926ce65a7ac709ceaefb211c40 ]

Buttonpads are expected to map the INPUT_PROP_BUTTONPAD property bit
and the BTN_LEFT key bit.

As explained in the specification, where a device has a button type
value of 0 (click-pad) or 1 (pressure-pad) there should not be
discrete buttons:
https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/touchpad-windows-precision-touchpad-collection#device-capabilities-feature-report

However, some drivers map the BTN_RIGHT and/or BTN_MIDDLE key bits even
though the device is a buttonpad and therefore does not have those
buttons.

This behavior has forced userspace applications like libinput to
implement different workarounds and quirks to detect buttonpads and
offer to the user the right set of features and configuration options.
For more information:
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/726

In order to avoid this issue clear the BTN_RIGHT and BTN_MIDDLE key
bits when the input device is register if the INPUT_PROP_BUTTONPAD
property bit is set.

Notice that this change will not affect udev because it does not check
for buttons. See systemd/src/udev/udev-builtin-input_id.c.

List of known affected hardware:

 - Chuwi AeroBook Plus
 - Chuwi Gemibook
 - Framework Laptop
 - GPD Win Max
 - Huawei MateBook 2020
 - Prestigio Smartbook 141 C2
 - Purism Librem 14v1
 - StarLite Mk II   - AMI firmware
 - StarLite Mk II   - Coreboot firmware
 - StarLite Mk III  - AMI firmware
 - StarLite Mk III  - Coreboot firmware
 - StarLabTop Mk IV - AMI firmware
 - StarLabTop Mk IV - Coreboot firmware
 - StarBook Mk V

Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://lore.kernel.org/r/20220208174806.17183-1-jose.exposito89@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/input.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 3cfd2c18eebd9..ff9dc37eff345 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2179,6 +2179,12 @@ int input_register_device(struct input_dev *dev)
 	/* KEY_RESERVED is not supposed to be transmitted to userspace. */
 	__clear_bit(KEY_RESERVED, dev->keybit);
 
+	/* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */
+	if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) {
+		__clear_bit(BTN_RIGHT, dev->keybit);
+		__clear_bit(BTN_MIDDLE, dev->keybit);
+	}
+
 	/* Make sure that bitmasks not mentioned in dev->evbit are clean. */
 	input_cleanse_bitmasks(dev);
 
-- 
2.34.1




  parent reply	other threads:[~2022-03-07  9:32 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07  9:18 [PATCH 5.10 000/105] 5.10.104-rc1 review Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 001/105] mac80211_hwsim: report NOACK frames in tx_status Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 002/105] mac80211_hwsim: initialize ieee80211_tx_info at hw_scan_work Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 003/105] i2c: bcm2835: Avoid clock stretching timeouts Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 004/105] ASoC: rt5668: do not block workqueue if card is unbound Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 005/105] ASoC: rt5682: " Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 006/105] regulator: core: fix false positive in regulator_late_cleanup() Greg Kroah-Hartman
2022-03-07  9:18 ` Greg Kroah-Hartman [this message]
2022-03-07  9:18 ` [PATCH 5.10 008/105] KVM: arm64: vgic: Read HW interrupt pending state from the HW Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 009/105] tipc: fix a bit overflow in tipc_crypto_key_rcv() Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 010/105] cifs: fix double free race when mount fails in cifs_get_root() Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 011/105] selftests/seccomp: Fix seccomp failure by adding missing headers Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 012/105] dmaengine: shdma: Fix runtime PM imbalance on error Greg Kroah-Hartman
2022-03-09 10:54   ` Pavel Machek
2022-03-09 11:58     ` Greg Kroah-Hartman
2022-03-09 12:35       ` Pavel Machek
2022-03-09 13:40         ` Greg Kroah-Hartman
2022-03-09 13:57           ` Pavel Machek
2022-03-09 14:48             ` Greg Kroah-Hartman
2022-03-10  4:35               ` Vinod Koul
2022-04-11 13:09                 ` Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 013/105] i2c: cadence: allow COMPILE_TEST Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 014/105] i2c: qup: " Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 015/105] net: usb: cdc_mbim: avoid altsetting toggling for Telit FN990 Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 016/105] usb: gadget: dont release an existing dev->buf Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 017/105] usb: gadget: clear related members when goto fail Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 018/105] exfat: reuse exfat_inode_info variable instead of calling EXFAT_I() Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 019/105] exfat: fix i_blocks for files truncated over 4 GiB Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 020/105] tracing: Add test for user space strings when filtering on string pointers Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 021/105] serial: stm32: prevent TDR register overwrite when sending x_char Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 022/105] ata: pata_hpt37x: fix PCI clock detection Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 023/105] drm/amdgpu: check vm ready by amdgpu_vm->evicting flag Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 024/105] tracing: Add ustring operation to filtering string pointers Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 025/105] ALSA: intel_hdmi: Fix reference to PCM buffer address Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 026/105] riscv/efi_stub: Fix get_boot_hartid_from_fdt() return value Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 027/105] riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 028/105] riscv: Fix config KASAN && DEBUG_VIRTUAL Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 029/105] ASoC: ops: Shift tested values in snd_soc_put_volsw() by +min Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 030/105] iommu/amd: Recover from event log overflow Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 031/105] drm/i915: s/JSP2/ICP2/ PCH Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 032/105] xen/netfront: destroy queues before real_num_tx_queues is zeroed Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 033/105] thermal: core: Fix TZ_GET_TRIP NULL pointer dereference Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 034/105] ntb: intel: fix port config status offset for SPR Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 035/105] mm: Consider __GFP_NOWARN flag for oversized kvmalloc() calls Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 036/105] xfrm: fix MTU regression Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 037/105] netfilter: fix use-after-free in __nf_register_net_hook() Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 038/105] bpf, sockmap: Do not ignore orig_len parameter Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 039/105] xfrm: fix the if_id check in changelink Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 040/105] xfrm: enforce validity of offload input flags Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 041/105] e1000e: Correct NVM checksum verification flow Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 042/105] net: fix up skbs delta_truesize in UDP GRO frag_list Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 043/105] netfilter: nf_queue: dont assume sk is full socket Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 044/105] netfilter: nf_queue: fix possible use-after-free Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 045/105] netfilter: nf_queue: handle socket prefetch Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 046/105] batman-adv: Request iflink once in batadv-on-batadv check Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 047/105] batman-adv: Request iflink once in batadv_get_real_netdevice Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 048/105] batman-adv: Dont expect inter-netns unique iflink indices Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 049/105] net: ipv6: ensure we call ipv6_mc_down() at most once Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 050/105] net: dcb: flush lingering app table entries for unregistered devices Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 051/105] net/smc: fix connection leak Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 052/105] net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 053/105] net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error cause by server Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 054/105] rcu/nocb: Fix missed nocb_timer requeue Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 055/105] ice: Fix race conditions between virtchnl handling and VF ndo ops Greg Kroah-Hartman
2022-03-07  9:18 ` [PATCH 5.10 056/105] ice: fix concurrent reset and removal of VFs Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 057/105] sched/topology: Make sched_init_numa() use a set for the deduplicating sort Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 058/105] sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 059/105] ia64: ensure proper NUMA distance and possible map initialization Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 060/105] mac80211: fix forwarded mesh frames AC & queue selection Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 061/105] net: stmmac: fix return value of __setup handler Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 062/105] mac80211: treat some SAE auth steps as final Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 063/105] iavf: Fix missing check for running netdev Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 064/105] net: sxgbe: fix return value of __setup handler Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 065/105] ibmvnic: register netdev after init of adapter Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 066/105] net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 067/105] ixgbe: xsk: change !netif_carrier_ok() handling in ixgbe_xmit_zc() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 068/105] efivars: Respect "block" flag in efivar_entry_set_safe() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 069/105] firmware: arm_scmi: Remove space in MODULE_ALIAS name Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 070/105] ASoC: cs4265: Fix the duplicated control name Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 071/105] can: gs_usb: change active_channelss type from atomic_t to u8 Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 072/105] arm64: dts: rockchip: Switch RK3399-Gru DP to SPDIF output Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 073/105] igc: igc_read_phy_reg_gpy: drop premature return Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 074/105] ARM: Fix kgdb breakpoint for Thumb2 Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 075/105] ARM: 9182/1: mmu: fix returns from early_param() and __setup() functions Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 076/105] selftests: mlxsw: tc_police_scale: Make test more robust Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 077/105] pinctrl: sunxi: Use unique lockdep classes for IRQs Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 078/105] igc: igc_write_phy_reg_gpy: drop premature return Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 079/105] ibmvnic: free reset-work-item when flushing Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 080/105] memfd: fix F_SEAL_WRITE after shmem huge page allocated Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 081/105] s390/extable: fix exception table sorting Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 082/105] ARM: dts: switch timer config to common devkit8000 devicetree Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 083/105] ARM: dts: Use 32KiHz oscillator on devkit8000 Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 084/105] soc: fsl: guts: Revert commit 3c0d64e867ed Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 085/105] soc: fsl: guts: Add a missing memory allocation failure check Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 086/105] soc: fsl: qe: Check of ioremap return value Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 087/105] ARM: tegra: Move panels to AUX bus Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 088/105] ibmvnic: define flush_reset_queue helper Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 089/105] ibmvnic: complete init_done on transport events Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 090/105] net: chelsio: cxgb3: check the return value of pci_find_capability() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 091/105] iavf: Refactor iavf state machine tracking Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 092/105] nl80211: Handle nla_memdup failures in handle_nan_filter Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 093/105] drm/amdgpu: fix suspend/resume hang regression Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 094/105] net: dcb: disable softirqs in dcbnl_flush_dev() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 095/105] Input: elan_i2c - move regulator_[en|dis]able() out of elan_[en|dis]able_power() Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 096/105] Input: elan_i2c - fix regulator enable count imbalance after suspend/resume Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 097/105] Input: samsung-keypad - properly state IOMEM dependency Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 098/105] HID: add mapping for KEY_DICTATE Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 099/105] HID: add mapping for KEY_ALL_APPLICATIONS Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 100/105] tracing/histogram: Fix sorting on old "cpu" value Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 101/105] tracing: Fix return value of __setup handlers Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 102/105] btrfs: fix lost prealloc extents beyond eof after full fsync Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 103/105] btrfs: qgroup: fix deadlock between rescan worker and remove qgroup Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 104/105] btrfs: add missing run of delayed items after unlink during log replay Greg Kroah-Hartman
2022-03-07  9:19 ` [PATCH 5.10 105/105] Revert "xfrm: xfrm_state_mtu should return at least 1280 for ipv6" Greg Kroah-Hartman
2022-03-07 12:19 ` [PATCH 5.10 000/105] 5.10.104-rc1 review Fox Chen
2022-03-07 14:15 ` Guenter Roeck
2022-03-07 15:17   ` Greg Kroah-Hartman
2022-03-07 14:59 ` Pavel Machek
2022-03-07 19:08 ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307091644.391979531@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=jose.exposito89@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).