Re: [PATCH v4 1/3] HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II

From: Florian Klink
Date: Fri Apr 01 2022 - 08:04:57 EST


On 22-04-01 12:30:47, Benjamin Tissoires wrote:
Thanks for the work Florian, and sorry for the delay.

One comment below:
@@ -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) {

Is there a chance that other PIDs included in the files are needing that call?
I'm just worried about regressions here.

Beside that question, the series is:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>

`lenovo_probe_cptkbd` was introduced in

f3d4ff0e04cc4450bdc7a4140020913b1280d205
HID: lenovo: Add support for Compact (BT|USB) keyboard)

Back then, it was only called for these two "Compact (BT|USB) keyboard)"
devices (see switch case in `lenovo_probe`).

The new code now calls `lenovo_probe_cptkbd` also for
`USB_DEVICE_ID_LENOVO_TPII{BT,USB}KBD`:

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);

… and the F7/9/11 thing is only done for the compact variants.

Other keyboards still use other `lenovo_probe_tpkbd` and
`lenovo_probe_tp10ubkbd` functions.

I agree the `lenovo_probe_*` names became a bit less self-explaining
over time, but the switch case in `lenovo_probe` itself should be pretty
authoritative about which hardware causes which function to be called.

Regards,
Florian