All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Martin <consume.noise@gmail.com>
To: linux-input@vger.kernel.org
Subject: [PATCH] HID: rmi: Lenovo X1 Cover touchpad is a buttonpad
Date: Thu, 19 Oct 2017 10:23:10 +0200	[thread overview]
Message-ID: <20171019082310.8778-1-consume.noise@gmail.com> (raw)

Atm. the touchpad is not tagged as buttonpad. Due to the lack of it,
RMI F30 adds 3 buttons (BTN_LEFT, BTN_RIGHT and BTN_MIDDLE).

On the very first click after a boot one can see with evemu-record:
...
E: 0.084899 0001 0110 0001  # EV_KEY / BTN_LEFT             1
E: 0.084899 0001 0111 0001  # EV_KEY / BTN_RIGHT            1
...
Then BTN_LEFT gets released, but there's no release of BTN_RIGHT. With
this stuck button further clicks don't work until you switch the VT and
back (X-Server, xf86-input-synaptics). There're no occurences of
BTN_RIGHT after a VT switch.

Fix this by tagging the device as buttonpad. The changed report looks
like:
--- evemu-record-tm3203-003-wrong.log
+++ evemu-record-tm3203-003-fixed.log
@@ -22,8 +22,6 @@
 #     Event code 14 ((null))
 #   Event type 1 (EV_KEY)
 #     Event code 272 (BTN_LEFT)
-#     Event code 273 (BTN_RIGHT)
-#     Event code 274 (BTN_MIDDLE)
 #     Event code 325 (BTN_TOOL_FINGER)
 #     Event code 330 (BTN_TOUCH)
 #     Event code 333 (BTN_TOOL_DOUBLETAP)
@@ -116,15 +114,16 @@
 #       Resolution 0
 # Properties:
 #   Property  type 0 (INPUT_PROP_POINTER)
+#   Property  type 2 (INPUT_PROP_BUTTONPAD)
 N: Synaptics TM3203-003
 I: 0003 17ef 6085 0111
-P: 01 00 00 00 00 00 00 00
+P: 05 00 00 00 00 00 00 00
 B: 00 0b 00 00 00 00 00 00 00
 B: 01 00 00 00 00 00 00 00 00
 B: 01 00 00 00 00 00 00 00 00
 B: 01 00 00 00 00 00 00 00 00
 B: 01 00 00 00 00 00 00 00 00
-B: 01 00 00 07 00 00 00 00 00
+B: 01 00 00 01 00 00 00 00 00
 B: 01 20 e4 00 00 00 00 00 00
 B: 01 00 00 00 00 00 00 00 00
 B: 01 00 00 00 00 00 00 00 00

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
---
 drivers/hid/hid-rmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index ef241d66562e..e4937deef723 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -39,6 +39,7 @@
 /* device flags */
 #define RMI_DEVICE			BIT(0)
 #define RMI_DEVICE_HAS_PHYS_BUTTONS	BIT(1)
+#define RMI_DEVICE_IS_BUTTONPAD		BIT(2)
 
 /*
  * retrieve the ctrl registers
@@ -692,6 +693,9 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
 	if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)
 		rmi_hid_pdata.f30_data.disable = true;
+	else
+	if (data->device_flags & RMI_DEVICE_IS_BUTTONPAD)
+		rmi_hid_pdata.f30_data.buttonpad = true;
 
 	data->xport.dev = hdev->dev.parent;
 	data->xport.pdata = rmi_hid_pdata;
@@ -723,7 +727,8 @@ static void rmi_remove(struct hid_device *hdev)
 static const struct hid_device_id rmi_id[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14),
 		.driver_data = RMI_DEVICE_HAS_PHYS_BUTTONS },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER),
+		.driver_data = RMI_DEVICE_IS_BUTTONPAD },
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_RMI, HID_ANY_ID, HID_ANY_ID) },
 	{ }
 };
-- 
2.13.6


             reply	other threads:[~2017-10-19  8:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19  8:23 Daniel Martin [this message]
2017-10-23 23:37 ` [PATCH] HID: rmi: Lenovo X1 Cover touchpad is a buttonpad Andrew Duggan
     [not found] ` <CADscph1Cc1dZdBrWi--cgo+MgJvqcXJ=otsHvAfkdUOPOfJtCA@mail.gmail.com>
2017-10-24 15:13   ` Hendrik Langer

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=20171019082310.8778-1-consume.noise@gmail.com \
    --to=consume.noise@gmail.com \
    --cc=linux-input@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.