All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
@ 2021-12-16 22:46 ValdikSS
  2021-12-16 22:46 ` [PATCH v2 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II ValdikSS
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: ValdikSS @ 2021-12-16 22:46 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input

This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
in both USB and Bluetooth modes.

It brings additional functional keys mapping, native vertical and horizontal
scrolling, trackpoint sensitivity configuration and Fn-Lock sync.

There is no code difference between the previous patchset, only minor
patch subject changes and code/comments split.

ValdikSS (3):
  HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
  HID: lenovo: Sync Fn-lock state on button press for Compact and
    TrackPoint II keyboards
  HID: lenovo: Add note about different report numbers

 drivers/hid/hid-ids.h    |   2 +
 drivers/hid/hid-lenovo.c | 174 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 170 insertions(+), 6 deletions(-)

-- 
2.31.1


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

* [PATCH v2 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
  2021-12-16 22:46 [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support ValdikSS
@ 2021-12-16 22:46 ` ValdikSS
  2021-12-16 22:46 ` [PATCH v2 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards ValdikSS
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: ValdikSS @ 2021-12-16 22:46 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input

This keyboard has two modes: regular HID and a native mode, which is used
in Windows driver. Native mode disables (poor) middle mouse button
scrolling emulation and reports middle button and scrolling events with a
custom report ID, which could be better handled in the driver.

This commit adds functional button mapping and native scrolling support.

HID collection in Bluetooth mode for custom report ID=5 is broken and
is patched upon connection. The collection initially contains incorrect
Usage Minimum/Usage Maximum numbers and, more importantly, marks Input
as Variable, not Array, while reporting values as in Array.

The keyboard is very similar to Compact USB/Bluetooth Keyboard with
TrackPoint, that's why this patch reuses all of cptkbd functions, except
for input mapping.

Signed-off-by: ValdikSS <iam@valdikss.org.ru>
---
 drivers/hid/hid-ids.h    |   2 +
 drivers/hid/hid-lenovo.c | 160 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 156 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 29564b370..0c1583a3b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -743,7 +743,9 @@
 #define USB_VENDOR_ID_LENOVO		0x17ef
 #define USB_DEVICE_ID_LENOVO_TPKBD	0x6009
 #define USB_DEVICE_ID_LENOVO_CUSBKBD	0x6047
+#define USB_DEVICE_ID_LENOVO_TPIIUSBKBD	0x60ee
 #define USB_DEVICE_ID_LENOVO_CBTKBD	0x6048
+#define USB_DEVICE_ID_LENOVO_TPIIBTKBD	0x60e1
 #define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL	0x6049
 #define USB_DEVICE_ID_LENOVO_TP10UBKBD	0x6062
 #define USB_DEVICE_ID_LENOVO_TPPRODOCK	0x6067
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 93b1f935e..a612ae7df 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -4,6 +4,7 @@
  *  - ThinkPad USB Keyboard with TrackPoint (tpkbd)
  *  - ThinkPad Compact Bluetooth Keyboard with TrackPoint (cptkbd)
  *  - ThinkPad Compact USB Keyboard with TrackPoint (cptkbd)
+ *  - ThinkPad TrackPoint Keyboard II USB/Bluetooth (cptkbd/tpIIkbd)
  *
  *  Copyright (c) 2012 Bernhard Seibold
  *  Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk>
@@ -110,6 +111,23 @@ static const __u8 lenovo_pro_dock_need_fixup_collection[] = {
 	0x2a, 0xff, 0xff,	/*  Usage Maximum (65535)		*/
 };
 
+/* Broken ThinkPad TrackPoint II collection (Bluetooth mode) */
+static const __u8 lenovo_tpIIbtkbd_need_fixup_collection[] = {
+	0x06, 0x00, 0xFF,	/* Usage Page (Vendor Defined 0xFF00) */
+	0x09, 0x01,		/* Usage (0x01) */
+	0xA1, 0x01,		/* Collection (Application) */
+	0x85, 0x05,		/*   Report ID (5) */
+	0x1A, 0xF1, 0x00,	/*   Usage Minimum (0xF1) */
+	0x2A, 0xFC, 0x00,	/*   Usage Maximum (0xFC) */
+	0x15, 0x00,		/*   Logical Minimum (0) */
+	0x25, 0x01,		/*   Logical Maximum (1) */
+	0x75, 0x01,		/*   Report Size (1) */
+	0x95, 0x0D,		/*   Report Count (13) */
+	0x81, 0x02,		/*   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) */
+	0x95, 0x03,		/*   Report Count (3) */
+	0x81, 0x01,		/*   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
+};
+
 static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 		unsigned int *rsize)
 {
@@ -126,6 +144,19 @@ static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 			rdesc[152] = 0x00;
 		}
 		break;
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
+		if (*rsize >= 263 &&
+		    memcmp(&rdesc[234], lenovo_tpIIbtkbd_need_fixup_collection,
+			  sizeof(lenovo_tpIIbtkbd_need_fixup_collection)) == 0) {
+			rdesc[244] = 0x00; /* usage minimum = 0x00 */
+			rdesc[247] = 0xff; /* usage maximum = 0xff */
+			rdesc[252] = 0xff; /* logical maximum = 0xff */
+			rdesc[254] = 0x08; /* report size = 0x08 */
+			rdesc[256] = 0x01; /* report count = 0x01 */
+			rdesc[258] = 0x00; /* input = 0x00 */
+			rdesc[260] = 0x01; /* report count (2) = 0x01 */
+		}
+		break;
 	}
 	return rdesc;
 }
@@ -217,6 +248,101 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
 	return 0;
 }
 
+static int lenovo_input_mapping_tpIIkbd(struct hid_device *hdev,
+		struct hid_input *hi, struct hid_field *field,
+		struct hid_usage *usage, unsigned long **bit, int *max)
+{
+	/*
+	 * 0xff0a0000 = USB, HID_UP_MSVENDOR = BT.
+	 *
+	 * In BT mode, there are two HID_UP_MSVENDOR pages.
+	 * Use only the page that contains report ID == 5.
+	 */
+	if (((usage->hid & HID_USAGE_PAGE) == 0xff0a0000 ||
+	    (usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) &&
+	    field->report->id == 5) {
+		switch (usage->hid & HID_USAGE) {
+		case 0x00bb: /* Fn-F4: Mic mute */
+			map_key_clear(LENOVO_KEY_MICMUTE);
+			return 1;
+		case 0x00c3: /* Fn-F5: Brightness down */
+			map_key_clear(KEY_BRIGHTNESSDOWN);
+			return 1;
+		case 0x00c4: /* Fn-F6: Brightness up */
+			map_key_clear(KEY_BRIGHTNESSUP);
+			return 1;
+		case 0x00c1: /* Fn-F8: Notification center */
+			map_key_clear(KEY_NOTIFICATION_CENTER);
+			return 1;
+		case 0x00bc: /* Fn-F9: Control panel */
+			map_key_clear(KEY_CONFIG);
+			return 1;
+		case 0x00b6: /* Fn-F10: Bluetooth */
+			map_key_clear(KEY_BLUETOOTH);
+			return 1;
+		case 0x00b7: /* Fn-F11: Keyboard config */
+			map_key_clear(KEY_KEYBOARD);
+			return 1;
+		case 0x00b8: /* Fn-F12: User function */
+			map_key_clear(KEY_PROG1);
+			return 1;
+		case 0x00b9: /* Fn-PrtSc: Snipping tool */
+			map_key_clear(KEY_SELECTIVE_SCREENSHOT);
+			return 1;
+		case 0x00b5: /* Fn-Esc: Fn-lock toggle */
+			map_key_clear(KEY_FN_ESC);
+			return 1;
+		}
+	}
+
+	if ((usage->hid & HID_USAGE_PAGE) == 0xffa00000) {
+		switch (usage->hid & HID_USAGE) {
+		case 0x00fb: /* Middle mouse (in native USB mode) */
+			map_key_clear(BTN_MIDDLE);
+			return 1;
+		}
+	}
+
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR &&
+	    field->report->id == 21) {
+		switch (usage->hid & HID_USAGE) {
+		case 0x0004: /* Middle mouse (in native Bluetooth mode) */
+			map_key_clear(BTN_MIDDLE);
+			return 1;
+		}
+	}
+
+	/* Compatibility middle/wheel mappings should be ignored */
+	if (usage->hid == HID_GD_WHEEL)
+		return -1;
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON &&
+			(usage->hid & HID_USAGE) == 0x003)
+		return -1;
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER &&
+			(usage->hid & HID_USAGE) == 0x238)
+		return -1;
+
+	/* Map wheel emulation reports: 0xff10 */
+	if ((usage->hid & HID_USAGE_PAGE) == 0xff100000) {
+		field->flags |= HID_MAIN_ITEM_RELATIVE | HID_MAIN_ITEM_VARIABLE;
+		field->logical_minimum = -127;
+		field->logical_maximum = 127;
+
+		switch (usage->hid & HID_USAGE) {
+		case 0x0000:
+			hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL);
+			return 1;
+		case 0x0001:
+			hid_map_usage(hi, usage, bit, max, EV_REL, REL_WHEEL);
+			return 1;
+		default:
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
 static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev,
 		struct hid_input *hi, struct hid_field *field,
 		struct hid_usage *usage, unsigned long **bit, int *max)
@@ -326,6 +452,10 @@ static int lenovo_input_mapping(struct hid_device *hdev,
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
 		return lenovo_input_mapping_cptkbd(hdev, hi, field,
 							usage, bit, max);
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
+		return lenovo_input_mapping_tpIIkbd(hdev, hi, field,
+							usage, bit, max);
 	case USB_DEVICE_ID_IBM_SCROLLPOINT_III:
 	case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO:
 	case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL:
@@ -363,10 +493,12 @@ static int lenovo_send_cmd_cptkbd(struct hid_device *hdev,
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
 		ret = hid_hw_raw_request(hdev, 0x13, buf, 3,
 					HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
 		break;
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		ret = hid_hw_output_report(hdev, buf, 3);
 		break;
 	default:
@@ -422,6 +554,8 @@ static ssize_t attr_fn_lock_store(struct device *dev,
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		lenovo_features_set_cptkbd(hdev);
 		break;
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
@@ -568,6 +702,8 @@ static int lenovo_event(struct hid_device *hdev, struct hid_field *field,
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		return lenovo_event_cptkbd(hdev, field, usage, value);
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
 	case USB_DEVICE_ID_LENOVO_X1_TAB:
@@ -960,8 +1096,9 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev)
 	struct lenovo_drvdata *cptkbd_data;
 
 	/* All the custom action happens on the USBMOUSE device for USB */
-	if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD
-			&& hdev->type != HID_TYPE_USBMOUSE) {
+	if (((hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD) ||
+	    (hdev->product == USB_DEVICE_ID_LENOVO_TPIIUSBKBD)) &&
+	    hdev->type != HID_TYPE_USBMOUSE) {
 		hid_dbg(hdev, "Ignoring keyboard half of device\n");
 		return 0;
 	}
@@ -977,11 +1114,14 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev)
 
 	/*
 	 * Tell the keyboard a driver understands it, and turn F7, F9, F11 into
-	 * regular keys
+	 * regular keys (Compact only)
 	 */
-	ret = lenovo_send_cmd_cptkbd(hdev, 0x01, 0x03);
-	if (ret)
-		hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret);
+	if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD ||
+	    hdev->product == USB_DEVICE_ID_LENOVO_CBTKBD) {
+		ret = lenovo_send_cmd_cptkbd(hdev, 0x01, 0x03);
+		if (ret)
+			hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret);
+	}
 
 	/* Switch middle button to native mode */
 	ret = lenovo_send_cmd_cptkbd(hdev, 0x09, 0x01);
@@ -1088,6 +1228,8 @@ static int lenovo_probe(struct hid_device *hdev,
 		break;
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		ret = lenovo_probe_cptkbd(hdev);
 		break;
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
@@ -1154,6 +1296,8 @@ static void lenovo_remove(struct hid_device *hdev)
 		break;
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		lenovo_remove_cptkbd(hdev);
 		break;
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
@@ -1172,6 +1316,8 @@ static int lenovo_input_configured(struct hid_device *hdev,
 		case USB_DEVICE_ID_LENOVO_TPKBD:
 		case USB_DEVICE_ID_LENOVO_CUSBKBD:
 		case USB_DEVICE_ID_LENOVO_CBTKBD:
+		case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+		case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 			if (test_bit(EV_REL, hi->input->evbit)) {
 				/* set only for trackpoint device */
 				__set_bit(INPUT_PROP_POINTER, hi->input->propbit);
@@ -1188,7 +1334,9 @@ static int lenovo_input_configured(struct hid_device *hdev,
 static const struct hid_device_id lenovo_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPIIUSBKBD) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPIIBTKBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) },
-- 
2.31.1


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

* [PATCH v2 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards
  2021-12-16 22:46 [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support ValdikSS
  2021-12-16 22:46 ` [PATCH v2 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II ValdikSS
@ 2021-12-16 22:46 ` ValdikSS
  2021-12-16 22:46 ` [PATCH v2 3/3] HID: lenovo: Add note about different report numbers ValdikSS
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: ValdikSS @ 2021-12-16 22:46 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input

When Fn-Esc is pressed on the keyboard, it emits the scancode which could
be used to sync the fn_lock sysfs state.

Previously fn_lock only allowed to set new Fn-lock state and did not
keep the value in sync upon Fn-Esc press, which is now fixed.

Signed-off-by: ValdikSS <iam@valdikss.org.ru>
---
 drivers/hid/hid-lenovo.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index a612ae7df..e9466ae8a 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -690,6 +690,15 @@ static int lenovo_event_cptkbd(struct hid_device *hdev,
 		return 1;
 	}
 
+	if (usage->type == EV_KEY && usage->code == KEY_FN_ESC && value == 1) {
+		/*
+		 * The user has toggled the Fn-lock state. Toggle our own
+		 * cached value of it and sync our value to the keyboard to
+		 * ensure things are in sync (the syncing should be a no-op).
+		 */
+		cptkbd_data->fn_lock = !cptkbd_data->fn_lock;
+	}
+
 	return 0;
 }
 
-- 
2.31.1


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

* [PATCH v2 3/3] HID: lenovo: Add note about different report numbers
  2021-12-16 22:46 [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support ValdikSS
  2021-12-16 22:46 ` [PATCH v2 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II ValdikSS
  2021-12-16 22:46 ` [PATCH v2 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards ValdikSS
@ 2021-12-16 22:46 ` ValdikSS
  2022-01-06 13:19 ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Jiri Kosina
  2022-01-24 12:24 ` Florian Klink
  4 siblings, 0 replies; 22+ messages in thread
From: ValdikSS @ 2021-12-16 22:46 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input

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

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index e9466ae8a..7076407a6 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -487,6 +487,11 @@ static int lenovo_send_cmd_cptkbd(struct hid_device *hdev,
 	if (!buf)
 		return -ENOMEM;
 
+	/*
+	* Feature report 0x13 is used for USB,
+	* output report 0x18 is used for Bluetooth.
+	* buf[0] is ignored by hid_hw_raw_request.
+	*/
 	buf[0] = 0x18;
 	buf[1] = byte2;
 	buf[2] = byte3;
-- 
2.31.1


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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2021-12-16 22:46 [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support ValdikSS
                   ` (2 preceding siblings ...)
  2021-12-16 22:46 ` [PATCH v2 3/3] HID: lenovo: Add note about different report numbers ValdikSS
@ 2022-01-06 13:19 ` Jiri Kosina
  2022-01-06 15:03   ` ValdikSS
  2022-01-24 12:24 ` Florian Klink
  4 siblings, 1 reply; 22+ messages in thread
From: Jiri Kosina @ 2022-01-06 13:19 UTC (permalink / raw)
  To: ValdikSS; +Cc: Benjamin Tissoires, linux-input

On Fri, 17 Dec 2021, ValdikSS wrote:

> This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
> in both USB and Bluetooth modes.
> 
> It brings additional functional keys mapping, native vertical and horizontal
> scrolling, trackpoint sensitivity configuration and Fn-Lock sync.
> 
> There is no code difference between the previous patchset, only minor
> patch subject changes and code/comments split.
> 
> ValdikSS (3):
>   HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
>   HID: lenovo: Sync Fn-lock state on button press for Compact and
>     TrackPoint II keyboards
>   HID: lenovo: Add note about different report numbers

Thanks for the patches. Could you however, please, resubmit with your real 
name, as outlined in Documentation/process/submitting-patches.rst ?

-- 
Jiri Kosina
SUSE Labs


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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-06 13:19 ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Jiri Kosina
@ 2022-01-06 15:03   ` ValdikSS
  2022-01-21 12:32     ` [PATCH v3 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II Florian Klink
  2022-01-21 12:41     ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Florian Klink
  0 siblings, 2 replies; 22+ messages in thread
From: ValdikSS @ 2022-01-06 15:03 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Benjamin Tissoires, linux-input


[-- Attachment #1.1: Type: text/plain, Size: 1087 bytes --]

On 06.01.2022 16:19, Jiri Kosina wrote:
> On Fri, 17 Dec 2021, ValdikSS wrote:
> 
>> This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
>> in both USB and Bluetooth modes.
>>
>> It brings additional functional keys mapping, native vertical and horizontal
>> scrolling, trackpoint sensitivity configuration and Fn-Lock sync.
>>
>> There is no code difference between the previous patchset, only minor
>> patch subject changes and code/comments split.
>>
>> ValdikSS (3):
>>    HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
>>    HID: lenovo: Sync Fn-lock state on button press for Compact and
>>      TrackPoint II keyboards
>>    HID: lenovo: Add note about different report numbers
> 
> Thanks for the patches. Could you however, please, resubmit with your real
> name, as outlined in Documentation/process/submitting-patches.rst ?
> 

I prefer to use my internet identity on the internet. If this is a 
strict enforcement, I don't mind if you apply the patches from your 
name, as a HID input maintainer, if that's possible.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* [PATCH v3 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
  2022-01-06 15:03   ` ValdikSS
@ 2022-01-21 12:32     ` Florian Klink
  2022-01-21 12:32       ` [PATCH v3 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards Florian Klink
  2022-01-21 12:32       ` [PATCH v3 3/3] HID: lenovo: Add note about different report numbers Florian Klink
  2022-01-21 12:41     ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Florian Klink
  1 sibling, 2 replies; 22+ messages in thread
From: Florian Klink @ 2022-01-21 12:32 UTC (permalink / raw)
  To: linux-input; +Cc: ValdikSS, Florian Klink

From: ValdikSS <iam@valdikss.org.ru>

This keyboard has two modes: regular HID and a native mode, which is used
in Windows driver. Native mode disables (poor) middle mouse button
scrolling emulation and reports middle button and scrolling events with a
custom report ID, which could be better handled in the driver.

This commit adds functional button mapping and native scrolling support.

HID collection in Bluetooth mode for custom report ID=5 is broken and
is patched upon connection. The collection initially contains incorrect
Usage Minimum/Usage Maximum numbers and, more importantly, marks Input
as Variable, not Array, while reporting values as in Array.

The keyboard is very similar to Compact USB/Bluetooth Keyboard with
TrackPoint, that's why this patch reuses all of cptkbd functions, except
for input mapping.

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 drivers/hid/hid-ids.h    |   2 +
 drivers/hid/hid-lenovo.c | 160 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 156 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 26cee452ec44..16c171d3e116 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -752,7 +752,9 @@
 #define USB_VENDOR_ID_LENOVO		0x17ef
 #define USB_DEVICE_ID_LENOVO_TPKBD	0x6009
 #define USB_DEVICE_ID_LENOVO_CUSBKBD	0x6047
+#define USB_DEVICE_ID_LENOVO_TPIIUSBKBD	0x60ee
 #define USB_DEVICE_ID_LENOVO_CBTKBD	0x6048
+#define USB_DEVICE_ID_LENOVO_TPIIBTKBD	0x60e1
 #define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL	0x6049
 #define USB_DEVICE_ID_LENOVO_TP10UBKBD	0x6062
 #define USB_DEVICE_ID_LENOVO_TPPRODOCK	0x6067
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 93b1f935e526..a612ae7dfbfc 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -4,6 +4,7 @@
  *  - ThinkPad USB Keyboard with TrackPoint (tpkbd)
  *  - ThinkPad Compact Bluetooth Keyboard with TrackPoint (cptkbd)
  *  - ThinkPad Compact USB Keyboard with TrackPoint (cptkbd)
+ *  - ThinkPad TrackPoint Keyboard II USB/Bluetooth (cptkbd/tpIIkbd)
  *
  *  Copyright (c) 2012 Bernhard Seibold
  *  Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk>
@@ -110,6 +111,23 @@ static const __u8 lenovo_pro_dock_need_fixup_collection[] = {
 	0x2a, 0xff, 0xff,	/*  Usage Maximum (65535)		*/
 };
 
+/* Broken ThinkPad TrackPoint II collection (Bluetooth mode) */
+static const __u8 lenovo_tpIIbtkbd_need_fixup_collection[] = {
+	0x06, 0x00, 0xFF,	/* Usage Page (Vendor Defined 0xFF00) */
+	0x09, 0x01,		/* Usage (0x01) */
+	0xA1, 0x01,		/* Collection (Application) */
+	0x85, 0x05,		/*   Report ID (5) */
+	0x1A, 0xF1, 0x00,	/*   Usage Minimum (0xF1) */
+	0x2A, 0xFC, 0x00,	/*   Usage Maximum (0xFC) */
+	0x15, 0x00,		/*   Logical Minimum (0) */
+	0x25, 0x01,		/*   Logical Maximum (1) */
+	0x75, 0x01,		/*   Report Size (1) */
+	0x95, 0x0D,		/*   Report Count (13) */
+	0x81, 0x02,		/*   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) */
+	0x95, 0x03,		/*   Report Count (3) */
+	0x81, 0x01,		/*   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
+};
+
 static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 		unsigned int *rsize)
 {
@@ -126,6 +144,19 @@ static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 			rdesc[152] = 0x00;
 		}
 		break;
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
+		if (*rsize >= 263 &&
+		    memcmp(&rdesc[234], lenovo_tpIIbtkbd_need_fixup_collection,
+			  sizeof(lenovo_tpIIbtkbd_need_fixup_collection)) == 0) {
+			rdesc[244] = 0x00; /* usage minimum = 0x00 */
+			rdesc[247] = 0xff; /* usage maximum = 0xff */
+			rdesc[252] = 0xff; /* logical maximum = 0xff */
+			rdesc[254] = 0x08; /* report size = 0x08 */
+			rdesc[256] = 0x01; /* report count = 0x01 */
+			rdesc[258] = 0x00; /* input = 0x00 */
+			rdesc[260] = 0x01; /* report count (2) = 0x01 */
+		}
+		break;
 	}
 	return rdesc;
 }
@@ -217,6 +248,101 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
 	return 0;
 }
 
+static int lenovo_input_mapping_tpIIkbd(struct hid_device *hdev,
+		struct hid_input *hi, struct hid_field *field,
+		struct hid_usage *usage, unsigned long **bit, int *max)
+{
+	/*
+	 * 0xff0a0000 = USB, HID_UP_MSVENDOR = BT.
+	 *
+	 * In BT mode, there are two HID_UP_MSVENDOR pages.
+	 * Use only the page that contains report ID == 5.
+	 */
+	if (((usage->hid & HID_USAGE_PAGE) == 0xff0a0000 ||
+	    (usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) &&
+	    field->report->id == 5) {
+		switch (usage->hid & HID_USAGE) {
+		case 0x00bb: /* Fn-F4: Mic mute */
+			map_key_clear(LENOVO_KEY_MICMUTE);
+			return 1;
+		case 0x00c3: /* Fn-F5: Brightness down */
+			map_key_clear(KEY_BRIGHTNESSDOWN);
+			return 1;
+		case 0x00c4: /* Fn-F6: Brightness up */
+			map_key_clear(KEY_BRIGHTNESSUP);
+			return 1;
+		case 0x00c1: /* Fn-F8: Notification center */
+			map_key_clear(KEY_NOTIFICATION_CENTER);
+			return 1;
+		case 0x00bc: /* Fn-F9: Control panel */
+			map_key_clear(KEY_CONFIG);
+			return 1;
+		case 0x00b6: /* Fn-F10: Bluetooth */
+			map_key_clear(KEY_BLUETOOTH);
+			return 1;
+		case 0x00b7: /* Fn-F11: Keyboard config */
+			map_key_clear(KEY_KEYBOARD);
+			return 1;
+		case 0x00b8: /* Fn-F12: User function */
+			map_key_clear(KEY_PROG1);
+			return 1;
+		case 0x00b9: /* Fn-PrtSc: Snipping tool */
+			map_key_clear(KEY_SELECTIVE_SCREENSHOT);
+			return 1;
+		case 0x00b5: /* Fn-Esc: Fn-lock toggle */
+			map_key_clear(KEY_FN_ESC);
+			return 1;
+		}
+	}
+
+	if ((usage->hid & HID_USAGE_PAGE) == 0xffa00000) {
+		switch (usage->hid & HID_USAGE) {
+		case 0x00fb: /* Middle mouse (in native USB mode) */
+			map_key_clear(BTN_MIDDLE);
+			return 1;
+		}
+	}
+
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR &&
+	    field->report->id == 21) {
+		switch (usage->hid & HID_USAGE) {
+		case 0x0004: /* Middle mouse (in native Bluetooth mode) */
+			map_key_clear(BTN_MIDDLE);
+			return 1;
+		}
+	}
+
+	/* Compatibility middle/wheel mappings should be ignored */
+	if (usage->hid == HID_GD_WHEEL)
+		return -1;
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON &&
+			(usage->hid & HID_USAGE) == 0x003)
+		return -1;
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER &&
+			(usage->hid & HID_USAGE) == 0x238)
+		return -1;
+
+	/* Map wheel emulation reports: 0xff10 */
+	if ((usage->hid & HID_USAGE_PAGE) == 0xff100000) {
+		field->flags |= HID_MAIN_ITEM_RELATIVE | HID_MAIN_ITEM_VARIABLE;
+		field->logical_minimum = -127;
+		field->logical_maximum = 127;
+
+		switch (usage->hid & HID_USAGE) {
+		case 0x0000:
+			hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL);
+			return 1;
+		case 0x0001:
+			hid_map_usage(hi, usage, bit, max, EV_REL, REL_WHEEL);
+			return 1;
+		default:
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
 static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev,
 		struct hid_input *hi, struct hid_field *field,
 		struct hid_usage *usage, unsigned long **bit, int *max)
@@ -326,6 +452,10 @@ static int lenovo_input_mapping(struct hid_device *hdev,
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
 		return lenovo_input_mapping_cptkbd(hdev, hi, field,
 							usage, bit, max);
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
+		return lenovo_input_mapping_tpIIkbd(hdev, hi, field,
+							usage, bit, max);
 	case USB_DEVICE_ID_IBM_SCROLLPOINT_III:
 	case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO:
 	case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL:
@@ -363,10 +493,12 @@ static int lenovo_send_cmd_cptkbd(struct hid_device *hdev,
 
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
 		ret = hid_hw_raw_request(hdev, 0x13, buf, 3,
 					HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
 		break;
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		ret = hid_hw_output_report(hdev, buf, 3);
 		break;
 	default:
@@ -422,6 +554,8 @@ static ssize_t attr_fn_lock_store(struct device *dev,
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		lenovo_features_set_cptkbd(hdev);
 		break;
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
@@ -568,6 +702,8 @@ static int lenovo_event(struct hid_device *hdev, struct hid_field *field,
 	switch (hdev->product) {
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		return lenovo_event_cptkbd(hdev, field, usage, value);
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
 	case USB_DEVICE_ID_LENOVO_X1_TAB:
@@ -960,8 +1096,9 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev)
 	struct lenovo_drvdata *cptkbd_data;
 
 	/* All the custom action happens on the USBMOUSE device for USB */
-	if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD
-			&& hdev->type != HID_TYPE_USBMOUSE) {
+	if (((hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD) ||
+	    (hdev->product == USB_DEVICE_ID_LENOVO_TPIIUSBKBD)) &&
+	    hdev->type != HID_TYPE_USBMOUSE) {
 		hid_dbg(hdev, "Ignoring keyboard half of device\n");
 		return 0;
 	}
@@ -977,11 +1114,14 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev)
 
 	/*
 	 * Tell the keyboard a driver understands it, and turn F7, F9, F11 into
-	 * regular keys
+	 * regular keys (Compact only)
 	 */
-	ret = lenovo_send_cmd_cptkbd(hdev, 0x01, 0x03);
-	if (ret)
-		hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret);
+	if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD ||
+	    hdev->product == USB_DEVICE_ID_LENOVO_CBTKBD) {
+		ret = lenovo_send_cmd_cptkbd(hdev, 0x01, 0x03);
+		if (ret)
+			hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret);
+	}
 
 	/* Switch middle button to native mode */
 	ret = lenovo_send_cmd_cptkbd(hdev, 0x09, 0x01);
@@ -1088,6 +1228,8 @@ static int lenovo_probe(struct hid_device *hdev,
 		break;
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		ret = lenovo_probe_cptkbd(hdev);
 		break;
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
@@ -1154,6 +1296,8 @@ static void lenovo_remove(struct hid_device *hdev)
 		break;
 	case USB_DEVICE_ID_LENOVO_CUSBKBD:
 	case USB_DEVICE_ID_LENOVO_CBTKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+	case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 		lenovo_remove_cptkbd(hdev);
 		break;
 	case USB_DEVICE_ID_LENOVO_TP10UBKBD:
@@ -1172,6 +1316,8 @@ static int lenovo_input_configured(struct hid_device *hdev,
 		case USB_DEVICE_ID_LENOVO_TPKBD:
 		case USB_DEVICE_ID_LENOVO_CUSBKBD:
 		case USB_DEVICE_ID_LENOVO_CBTKBD:
+		case USB_DEVICE_ID_LENOVO_TPIIUSBKBD:
+		case USB_DEVICE_ID_LENOVO_TPIIBTKBD:
 			if (test_bit(EV_REL, hi->input->evbit)) {
 				/* set only for trackpoint device */
 				__set_bit(INPUT_PROP_POINTER, hi->input->propbit);
@@ -1188,7 +1334,9 @@ static int lenovo_input_configured(struct hid_device *hdev,
 static const struct hid_device_id lenovo_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPIIUSBKBD) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPIIBTKBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) },
-- 
2.34.1


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

* [PATCH v3 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards
  2022-01-21 12:32     ` [PATCH v3 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II Florian Klink
@ 2022-01-21 12:32       ` Florian Klink
  2022-01-21 12:32       ` [PATCH v3 3/3] HID: lenovo: Add note about different report numbers Florian Klink
  1 sibling, 0 replies; 22+ messages in thread
From: Florian Klink @ 2022-01-21 12:32 UTC (permalink / raw)
  To: linux-input; +Cc: ValdikSS, Florian Klink

From: ValdikSS <iam@valdikss.org.ru>

When Fn-Esc is pressed on the keyboard, it emits the scancode which could
be used to sync the fn_lock sysfs state.

Previously fn_lock only allowed to set new Fn-lock state and did not
keep the value in sync upon Fn-Esc press, which is now fixed.

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 drivers/hid/hid-lenovo.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index a612ae7dfbfc..e9466ae8a9cb 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -690,6 +690,15 @@ static int lenovo_event_cptkbd(struct hid_device *hdev,
 		return 1;
 	}
 
+	if (usage->type == EV_KEY && usage->code == KEY_FN_ESC && value == 1) {
+		/*
+		 * The user has toggled the Fn-lock state. Toggle our own
+		 * cached value of it and sync our value to the keyboard to
+		 * ensure things are in sync (the syncing should be a no-op).
+		 */
+		cptkbd_data->fn_lock = !cptkbd_data->fn_lock;
+	}
+
 	return 0;
 }
 
-- 
2.34.1


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

* [PATCH v3 3/3] HID: lenovo: Add note about different report numbers
  2022-01-21 12:32     ` [PATCH v3 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II Florian Klink
  2022-01-21 12:32       ` [PATCH v3 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards Florian Klink
@ 2022-01-21 12:32       ` Florian Klink
  1 sibling, 0 replies; 22+ messages in thread
From: Florian Klink @ 2022-01-21 12:32 UTC (permalink / raw)
  To: linux-input; +Cc: ValdikSS, Florian Klink

From: ValdikSS <iam@valdikss.org.ru>

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 drivers/hid/hid-lenovo.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index e9466ae8a9cb..7076407a6340 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -487,6 +487,11 @@ static int lenovo_send_cmd_cptkbd(struct hid_device *hdev,
 	if (!buf)
 		return -ENOMEM;
 
+	/*
+	* Feature report 0x13 is used for USB,
+	* output report 0x18 is used for Bluetooth.
+	* buf[0] is ignored by hid_hw_raw_request.
+	*/
 	buf[0] = 0x18;
 	buf[1] = byte2;
 	buf[2] = byte3;
-- 
2.34.1


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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-06 15:03   ` ValdikSS
  2022-01-21 12:32     ` [PATCH v3 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II Florian Klink
@ 2022-01-21 12:41     ` Florian Klink
  2022-01-21 15:24       ` Jiri Kosina
  1 sibling, 1 reply; 22+ messages in thread
From: Florian Klink @ 2022-01-21 12:41 UTC (permalink / raw)
  To: ValdikSS; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

On 22-01-06 18:03:49, ValdikSS wrote:
>On 06.01.2022 16:19, Jiri Kosina wrote:
>>Thanks for the patches. Could you however, please, resubmit with your real
>>name, as outlined in Documentation/process/submitting-patches.rst ?
>>
>
>I prefer to use my internet identity on the internet. If this is a 
>strict enforcement, I don't mind if you apply the patches from your 
>name, as a HID input maintainer, if that's possible.

I tested the driver and it's a big improvement. I just sent a v3 with my
name in the Signed-Off-By field.

It seems the "real name" requirement only applies to the Signed-Off-By
(not Author) field, and sending a contribution provided by some other
person is covered by (c) in the DCO 1.1.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-21 12:41     ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Florian Klink
@ 2022-01-21 15:24       ` Jiri Kosina
  2022-01-21 15:28         ` Florian Klink
  0 siblings, 1 reply; 22+ messages in thread
From: Jiri Kosina @ 2022-01-21 15:24 UTC (permalink / raw)
  To: Florian Klink; +Cc: ValdikSS, Benjamin Tissoires, linux-input

On Fri, 21 Jan 2022, Florian Klink wrote:

> I tested the driver and it's a big improvement. I just sent a v3 with my
> name in the Signed-Off-By field.

Thanks. Where did you send it to? :) I don't seem to have it in my inbox.

-- 
Jiri Kosina
SUSE Labs


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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-21 15:24       ` Jiri Kosina
@ 2022-01-21 15:28         ` Florian Klink
  2022-01-21 15:31           ` Jiri Kosina
  0 siblings, 1 reply; 22+ messages in thread
From: Florian Klink @ 2022-01-21 15:28 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: ValdikSS, Benjamin Tissoires, linux-input

On 22-01-21 16:24:37, Jiri Kosina wrote:
>On Fri, 21 Jan 2022, Florian Klink wrote:
>
>> I tested the driver and it's a big improvement. I just sent a v3 with my
>> name in the Signed-Off-By field.
>
>Thanks. Where did you send it to? :) I don't seem to have it in my inbox.

Message-Id 20220121123206.36978-1-flokli@flokli.de and following, it's
also visible on https://lore.kernel.org/all/20220121123206.36978-1-flokli@flokli.de/

Florian

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-21 15:28         ` Florian Klink
@ 2022-01-21 15:31           ` Jiri Kosina
  2022-01-21 15:51             ` Florian Klink
  0 siblings, 1 reply; 22+ messages in thread
From: Jiri Kosina @ 2022-01-21 15:31 UTC (permalink / raw)
  To: Florian Klink; +Cc: ValdikSS, Benjamin Tissoires, linux-input

On Fri, 21 Jan 2022, Florian Klink wrote:

> >> I tested the driver and it's a big improvement. I just sent a v3 with my
> >> name in the Signed-Off-By field.
> >
> >Thanks. Where did you send it to? :) I don't seem to have it in my inbox.
> 
> Message-Id 20220121123206.36978-1-flokli@flokli.de and following, it's
> also visible on
> https://lore.kernel.org/all/20220121123206.36978-1-flokli@flokli.de/

I see; please always CC the maintainers of the code directly as well, 
otherwise the patch might fall in between cracks easily.

Thanks,

-- 
Jiri Kosina
SUSE Labs


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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-21 15:31           ` Jiri Kosina
@ 2022-01-21 15:51             ` Florian Klink
  0 siblings, 0 replies; 22+ messages in thread
From: Florian Klink @ 2022-01-21 15:51 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: ValdikSS, Benjamin Tissoires, linux-input

>> >> I tested the driver and it's a big improvement. I just sent a v3 with my
>> >> name in the Signed-Off-By field.
>> >
>> >Thanks. Where did you send it to? :) I don't seem to have it in my inbox.
>>
>> Message-Id 20220121123206.36978-1-flokli@flokli.de and following, it's
>> also visible on
>> https://lore.kernel.org/all/20220121123206.36978-1-flokli@flokli.de/
>
>I see; please always CC the maintainers of the code directly as well,
>otherwise the patch might fall in between cracks easily.

Oops, I forgot to copy the CC list again while invoking git send-email.

I now also bounced the three mails over to you manually.

Let me know if there's anything else left to be done :-)

-- 
Florian Klink

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2021-12-16 22:46 [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support ValdikSS
                   ` (3 preceding siblings ...)
  2022-01-06 13:19 ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Jiri Kosina
@ 2022-01-24 12:24 ` Florian Klink
  2022-01-24 13:07   ` ValdikSS
  4 siblings, 1 reply; 22+ messages in thread
From: Florian Klink @ 2022-01-24 12:24 UTC (permalink / raw)
  To: ValdikSS; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input

Hey ValdikSS,

>This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
>in both USB and Bluetooth modes.
>
>It brings additional functional keys mapping, native vertical and horizontal
>scrolling, trackpoint sensitivity configuration and Fn-Lock sync.

Quick follow-up question on this - did you do any tinkering with battery
status?

I realized there's a
/sys/devices/pci0000:00/0000:00:08.1/0000:07:00.4/usb6/6-2/6-2:1.1/0003:17EF:60EE.001F/power_supply/hid-0003:17EF:60EE.001F-battery
in my system, which knows about model_name, but things like "capacity"
and "status" return a "No data available".

Regards,
Florian

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-24 12:24 ` Florian Klink
@ 2022-01-24 13:07   ` ValdikSS
  2022-01-24 13:08     ` ValdikSS
  0 siblings, 1 reply; 22+ messages in thread
From: ValdikSS @ 2022-01-24 13:07 UTC (permalink / raw)
  To: Florian Klink; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input


[-- Attachment #1.1: Type: text/plain, Size: 823 bytes --]

On 24.01.2022 15:24, Florian Klink wrote:
> Hey ValdikSS,
> 
>> This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
>> in both USB and Bluetooth modes.
>>
>> It brings additional functional keys mapping, native vertical and 
>> horizontal
>> scrolling, trackpoint sensitivity configuration and Fn-Lock sync.
> 
> Quick follow-up question on this - did you do any tinkering with battery
> status?
> 
> I realized there's a
> /sys/devices/pci0000:00/0000:00:08.1/0000:07:00.4/usb6/6-2/6-2:1.1/0003:17EF:60EE.001F/power_supply/hid-0003:17EF:60EE.001F-battery 
> 
> in my system, which knows about model_name, but things like "capacity"
> and "status" return a "No data available".
> 

Hello, no, I didn't do anything. It works for me just fine, it shows 
battery status in KDE applet.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-24 13:07   ` ValdikSS
@ 2022-01-24 13:08     ` ValdikSS
  2022-01-24 13:40       ` Florian Klink
  0 siblings, 1 reply; 22+ messages in thread
From: ValdikSS @ 2022-01-24 13:08 UTC (permalink / raw)
  To: Florian Klink; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input


[-- Attachment #1.1: Type: text/plain, Size: 930 bytes --]

On 24.01.2022 16:07, ValdikSS wrote:
> On 24.01.2022 15:24, Florian Klink wrote:
>> Hey ValdikSS,
>>
>>> This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
>>> in both USB and Bluetooth modes.
>>>
>>> It brings additional functional keys mapping, native vertical and 
>>> horizontal
>>> scrolling, trackpoint sensitivity configuration and Fn-Lock sync.
>>
>> Quick follow-up question on this - did you do any tinkering with battery
>> status?
>>
>> I realized there's a
>> /sys/devices/pci0000:00/0000:00:08.1/0000:07:00.4/usb6/6-2/6-2:1.1/0003:17EF:60EE.001F/power_supply/hid-0003:17EF:60EE.001F-battery 
>>
>> in my system, which knows about model_name, but things like "capacity"
>> and "status" return a "No data available".
>>
> 
> Hello, no, I didn't do anything. It works for me just fine, it shows 
> battery status in KDE applet.

Note: I'm using the keyboard over Bluetooth.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-24 13:08     ` ValdikSS
@ 2022-01-24 13:40       ` Florian Klink
  2022-01-26 21:47         ` Florian Klink
  0 siblings, 1 reply; 22+ messages in thread
From: Florian Klink @ 2022-01-24 13:40 UTC (permalink / raw)
  To: ValdikSS; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input

[-- Attachment #1: Type: text/plain, Size: 1371 bytes --]

On 22-01-24 16:08:03, ValdikSS wrote:
>On 24.01.2022 16:07, ValdikSS wrote:
>>On 24.01.2022 15:24, Florian Klink wrote:
>>>Hey ValdikSS,
>>>
>>>>This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
>>>>in both USB and Bluetooth modes.
>>>>
>>>>It brings additional functional keys mapping, native vertical 
>>>>and horizontal
>>>>scrolling, trackpoint sensitivity configuration and Fn-Lock sync.
>>>
>>>Quick follow-up question on this - did you do any tinkering with battery
>>>status?
>>>
>>>I realized there's a
>>>/sys/devices/pci0000:00/0000:00:08.1/0000:07:00.4/usb6/6-2/6-2:1.1/0003:17EF:60EE.001F/power_supply/hid-0003:17EF:60EE.001F-battery
>>>
>>>in my system, which knows about model_name, but things like "capacity"
>>>and "status" return a "No data available".
>>>
>>
>>Hello, no, I didn't do anything. It works for me just fine, it shows 
>>battery status in KDE applet.
>
>Note: I'm using the keyboard over Bluetooth.

Hm, over bluetooth, there's a `/sys/devices/virtual/misc/uhid/0005:17EF:60E1.0030/power_supply/hid-*-battery` directory with the same files, and they also have the same "No data available" thing.

For now I'll just assume it's due to the controller internally still
calibrating and not exposing anything - the keyboard is fairly new.

Thanks for confirming it should work in theory :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2022-01-24 13:40       ` Florian Klink
@ 2022-01-26 21:47         ` Florian Klink
  0 siblings, 0 replies; 22+ messages in thread
From: Florian Klink @ 2022-01-26 21:47 UTC (permalink / raw)
  To: ValdikSS; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input

[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]

>>>>Quick follow-up question on this - did you do any tinkering with battery
>>>>status?
>>>>
>>>>I realized there's a
>>>>/sys/devices/pci0000:00/0000:00:08.1/0000:07:00.4/usb6/6-2/6-2:1.1/0003:17EF:60EE.001F/power_supply/hid-0003:17EF:60EE.001F-battery
>>>>
>>>>in my system, which knows about model_name, but things like "capacity"
>>>>and "status" return a "No data available".
>>>>
>>>
>>>Hello, no, I didn't do anything. It works for me just fine, it 
>>>shows battery status in KDE applet.
>>
>>Note: I'm using the keyboard over Bluetooth.
>
>Hm, over bluetooth, there's a `/sys/devices/virtual/misc/uhid/0005:17EF:60E1.0030/power_supply/hid-*-battery` directory with the same files, and they also have the same "No data available" thing.
>
>For now I'll just assume it's due to the controller internally still
>calibrating and not exposing anything - the keyboard is fairly new.
>
>Thanks for confirming it should work in theory :-)

Alright, I now also see battery levels (that also go down after
continued use) - needed to enable upower on my system. Works like a
charm!

Florian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2021-11-01 22:11 ValdikSS
  2021-12-12 22:06 ` ValdikSS
@ 2021-12-17  0:49 ` Maximilian Schmidt
  1 sibling, 0 replies; 22+ messages in thread
From: Maximilian Schmidt @ 2021-12-17  0:49 UTC (permalink / raw)
  To: ValdikSS; +Cc: linux-input

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]

I quickly tested the patchset on archlinux using a custom kernel.
Based on 5.15.8, I can confirm these changes work like a charm.
I tested with an "Lenovo TrackPoint Keyboard II"

On Tue, Nov 02, 2021 at 01:11:29AM +0300, ValdikSS wrote:
> This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
> in both USB and Bluetooth modes.
> 
> It brings additional functional keys mapping, native vertical and horizontal
> scrolling, trackpoint sensitivity configuration and Fn-Lock sync.
> 
> There is no code difference between the previous patchset, only minor
> patch subject changes and code/comments split.
> 
> ValdikSS (3):
>   HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
>   HID: lenovo: Sync Fn-lock state on button press for Compact and
>     TrackPoint II keyboards
>   HID: lenovo: Add note about different report numbers
> 
>  drivers/hid/hid-ids.h    |   2 +
>  drivers/hid/hid-lenovo.c | 174 +++++++++++++++++++++++++++++++++++++--
>  2 files changed, 170 insertions(+), 6 deletions(-)
> 
> -- 
> 2.31.1
> 

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
  2021-11-01 22:11 ValdikSS
@ 2021-12-12 22:06 ` ValdikSS
  2021-12-17  0:49 ` Maximilian Schmidt
  1 sibling, 0 replies; 22+ messages in thread
From: ValdikSS @ 2021-12-12 22:06 UTC (permalink / raw)
  To: iam; +Cc: linux-input


[-- Attachment #1.1: Type: text/plain, Size: 188 bytes --]

Kindly asking  to review the patch and give the feedback. I've been 
using keyboard with this driver for a while now, without any issues. If 
the patch needs rework, please tell so.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support
@ 2021-11-01 22:11 ValdikSS
  2021-12-12 22:06 ` ValdikSS
  2021-12-17  0:49 ` Maximilian Schmidt
  0 siblings, 2 replies; 22+ messages in thread
From: ValdikSS @ 2021-11-01 22:11 UTC (permalink / raw)
  To: linux-input

This patchset adds support for Lenovo ThinkPad TrackPoint Keyboard II,
in both USB and Bluetooth modes.

It brings additional functional keys mapping, native vertical and horizontal
scrolling, trackpoint sensitivity configuration and Fn-Lock sync.

There is no code difference between the previous patchset, only minor
patch subject changes and code/comments split.

ValdikSS (3):
  HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II
  HID: lenovo: Sync Fn-lock state on button press for Compact and
    TrackPoint II keyboards
  HID: lenovo: Add note about different report numbers

 drivers/hid/hid-ids.h    |   2 +
 drivers/hid/hid-lenovo.c | 174 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 170 insertions(+), 6 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2022-01-26 21:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 22:46 [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support ValdikSS
2021-12-16 22:46 ` [PATCH v2 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II ValdikSS
2021-12-16 22:46 ` [PATCH v2 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards ValdikSS
2021-12-16 22:46 ` [PATCH v2 3/3] HID: lenovo: Add note about different report numbers ValdikSS
2022-01-06 13:19 ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Jiri Kosina
2022-01-06 15:03   ` ValdikSS
2022-01-21 12:32     ` [PATCH v3 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II Florian Klink
2022-01-21 12:32       ` [PATCH v3 2/3] HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards Florian Klink
2022-01-21 12:32       ` [PATCH v3 3/3] HID: lenovo: Add note about different report numbers Florian Klink
2022-01-21 12:41     ` [PATCH v2 0/3] HID: lenovo: ThinkPad TrackPoint Keyboard II support Florian Klink
2022-01-21 15:24       ` Jiri Kosina
2022-01-21 15:28         ` Florian Klink
2022-01-21 15:31           ` Jiri Kosina
2022-01-21 15:51             ` Florian Klink
2022-01-24 12:24 ` Florian Klink
2022-01-24 13:07   ` ValdikSS
2022-01-24 13:08     ` ValdikSS
2022-01-24 13:40       ` Florian Klink
2022-01-26 21:47         ` Florian Klink
  -- strict thread matches above, loose matches on Subject: below --
2021-11-01 22:11 ValdikSS
2021-12-12 22:06 ` ValdikSS
2021-12-17  0:49 ` Maximilian Schmidt

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.