History log of /linux-master/drivers/hid/hid-lenovo.c
Revision Date Author Comments
# 2814646f 23-Dec-2023 Mikhail Khvainitski <me@khvoinitsky.org>

HID: lenovo: Add middleclick_workaround sysfs knob for cptkbd

Previous attempt to autodetect well-behaving patched firmware
introduced in commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw
on cptkbd and stop applying workaround") has shown that there are
false-positives on original firmware (on both 1st gen and 2nd gen
keyboards) which causes the middle button click workaround to be
mistakenly disabled.

This commit adds explicit parameter to sysfs to control this
workaround.

Fixes: 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround")
Fixes: 43527a0094c1 ("HID: lenovo: Restrict detection of patched firmware only to USB cptkbd")
Signed-off-by: Mikhail Khvainitski <me@khvoinitsky.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>


# 43527a00 12-Dec-2023 Mikhail Khvainitski <me@khvoinitsky.org>

HID: lenovo: Restrict detection of patched firmware only to USB cptkbd

Commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and
stop applying workaround") introduced a regression for ThinkPad
TrackPoint Keyboard II which has similar quirks to cptkbd (so it uses
the same workarounds) but slightly different so that there are
false-positives during detecting well-behaving firmware. This commit
restricts detecting well-behaving firmware to the only model which
known to have one and have stable enough quirks to not cause
false-positives.

Fixes: 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround")
Link: https://lore.kernel.org/linux-input/ZXRiiPsBKNasioqH@jekhomev/
Link: https://bbs.archlinux.org/viewtopic.php?pid=2135468#p2135468
Signed-off-by: Mikhail Khvainitski <me@khvoinitsky.org>
Tested-by: Yauhen Kharuzhy <jekhor@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>


# 2f2bd7cb 02-Oct-2023 Jamie Lentin <jm@lentin.co.uk>

hid: lenovo: Resend all settings on reset_resume for compact keyboards

The USB Compact Keyboard variant requires a reset_resume function to
restore keyboard configuration after a suspend in some situations. Move
configuration normally done on probe to lenovo_features_set_cptkbd(), then
recycle this for use on reset_resume.

Without, the keyboard and driver would end up in an inconsistent state,
breaking middle-button scrolling amongst other problems, and twiddling
sysfs values wouldn't help as the middle-button mode won't be set until
the driver is reloaded.

Tested on a USB and Bluetooth Thinkpad Compact Keyboard.

CC: stable@vger.kernel.org
Fixes: 94eefa271323 ("HID: lenovo: Use native middle-button mode for compact keyboards")
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Martin Kepplinger <martink@posteo.de>
Link: https://lore.kernel.org/r/20231002150914.22101-1-martink@posteo.de
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>


# 46a0a2c9 23-Sep-2023 Mikhail Khvainitski <me@khvoinitsky.org>

HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround

Built-in firmware of cptkbd handles scrolling by itself (when middle
button is pressed) but with issues: it does not support horizontal and
hi-res scrolling and upon middle button release it sends middle button
click even if there was a scrolling event. Commit 3cb5ff0220e3 ("HID:
lenovo: Hide middle-button press until release") workarounds last
issue but it's impossible to workaround scrolling-related issues
without firmware modification.

Likely, Dennis Schneider has reverse engineered the firmware and
provided an instruction on how to patch it [1]. However,
aforementioned workaround prevents userspace (libinput) from knowing
exact moment when middle button has been pressed down and performing
"On-Button scrolling". This commit detects correctly-behaving patched
firmware if cursor movement events has been received during middle
button being pressed and stops applying workaround for this device.

Link: https://hohlerde.org/rauch/en/elektronik/projekte/tpkbd-fix/ [1]

Signed-off-by: Mikhail Khvainitski <me@khvoinitsky.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e66928af 05-Oct-2022 Colin Ian King <colin.i.king@gmail.com>

HID: lenovo: Make array tp10ubkbd_led static const

Don't populate the read-only array tp10ubkbd_led on the stack but instead
make it static const. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 5c9b8fae 13-Feb-2022 ValdikSS <iam@valdikss.org.ru>

HID: lenovo: Add note about different report numbers

Signed-off-by: Florian Klink <flokli@flokli.de>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a0a5c2a6 13-Feb-2022 ValdikSS <iam@valdikss.org.ru>

HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards

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>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 24401f29 13-Feb-2022 ValdikSS <iam@valdikss.org.ru>

HID: lenovo: Add support for ThinkPad TrackPoint Keyboard II

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>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# c158c2af 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Add support for Thinkpad X1 Tablet Thin keyboard

The Thinkpad X1 Tablet Thin keyboard's HID interface for the media-keys
and other special functions, is quite similar to the Thinkpad 10 ultrabook
keyboard's mouse/media-keys HID interface.

The only difference is that it needs a bit different key mappings.

Add support for the mute-LED and the non-standard media-keys on this
keyboard by re-using the tp10_ultrabook_kbd code combined with a new
lenovo_input_mapping_x1_tab_kbd() function.

Co-authored-by: Alexander Kobel <a-kobel@a-kobel.de>
Tested-by: Alexander Kobel <a-kobel@a-kobel.de>
Signed-off-by: Alexander Kobel <a-kobel@a-kobel.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2d0f1c07 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Rework how the tp10ubkbd code decides which USB interface to use

Instead of looking for a hdev with a type of HID_TYPE_USBMOUSE find
the interface for the mute/mic-mute/fn-lock LEDs by checking for the
output-report which is used to set them.

This is a preparation patch for adding support for the LEDs on the
X1 tablet thin keyboard which uses the same output-report, but has
a separate (third) USB interface for the touchpad/mouse functionality.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e2da5ff4 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Set default_triggers for the mute and micmute LEDs

The mute and mic-mute LEDs should be automatically turned on/off based
on the audio-card's mixer settings.

Add the standardized default-trigger names for this, so that the alsa
code can turn the LEDs on/off as appropriate (on supported audio cards).

This brings the mute/mic-mute LED support inline with the thinkpad_acpi
support for the same LEDs in keyboards directly connected to the
laptop's embedded-controller.

Reviewed-by: Marek Behún <kabel@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 61710324 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Map mic-mute button to KEY_F20 instead of KEY_MICMUTE

Mapping the mic-mute button to KEY_MICMUTE is technically correct but
KEY_MICMUTE translates to a scancode of 256 (248 + 8) under X,
which does not fit in 8 bits, so it does not work.

Because of this userspace is expecting KEY_F20 instead,
theoretically KEY_MICMUTE should work under Wayland but even
there it does not work, because the desktop-environment is
listening only for KEY_F20 and not for KEY_MICMUTE.

Fixes: bc04b37ea0ec ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support")
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 8744eeec 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Set LEDs max_brightness value

The LEDs can only by turned on/off, so max_brightness should be set to 1.
Without this the max_brightness sysfs-attribute will report 255 which is
wrong.

Reviewed-by: Marek Behún <kabel@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 033c9786 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Remove lenovo_led_brightness_get()

The led_classdev already contains a cached value of the last set
brightness, the brightness_get callback is only meant for LED drivers
which can read back the actual / current brightness from the hardware.

Since lenovo_led_brightness_get() just returns the last set value
it does not add any functionality, so we can just remove it.

Reviewed-by: Marek Behún <kabel@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 34348a86 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Check hid_get_drvdata() returns non NULL in lenovo_event()

The HID lenovo probe function only attaches drvdata to one of the
USB interfaces, but lenovo_event() will get called for all USB interfaces
to which hid-lenovo is bound.

This allows a malicious device to fake being a device handled by
hid-lenovo, which generates events for which lenovo_event() has
special handling (and thus dereferences hid_get_drvdata()) on another
interface triggering a NULL pointer exception.

Add a check for hid_get_drvdata() returning NULL, avoiding this
possible NULL pointer exception.

Fixes: bc04b37ea0ec ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support")
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 658d04e6 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Fix lenovo_led_set_tp10ubkbd() error handling

Fix the following issues with lenovo_led_set_tp10ubkbd() error handling:

1. On success hid_hw_raw_request() returns the number of bytes sent.
So we should check for (ret != 3) rather then for (ret != 0).

2. Actually propagate errors to the caller.

3. Since the LEDs are part of an USB keyboard-dock the mute LEDs can go
away at any time. Don't log an error when ret == -ENODEV and set the
LED_HW_PLUGGABLE flag to avoid errors getting logged when the USB gets
disconnected.

Fixes: bc04b37ea0ec ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support")
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# bbf62645 04-Apr-2021 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Use brightness_set_blocking callback for setting LEDs brightness

The lenovo_led_brightness_set function may sleep, so we should have the
the led_class_dev's brightness_set_blocking callback point to it, rather
then the regular brightness_set callback.

When toggled through sysfs this is not a problem, but the brightness_set
callback may be called from atomic context when using LED-triggers.

Fixes: bc04b37ea0ec ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support")
Reviewed-by: Marek Behún <kabel@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 49429428 04-Jul-2020 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Fix spurious F23 key press report during resume from suspend

The Ultrabook Keyboard sends a spurious F23 key-press when resuming
from suspend. GNOME uses F23 to toggle the touchpad on/off so this causes
the OSD graphics for the touchpad toggle to show on resume.

The keyboard does not actually have a F23 key, se we can simple fix it
by marking the 0x00070072 HID usage, which normally is F23, to be ignored.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# c87de33e 04-Jul-2020 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard fn_lock support

Add support for setting the Fn lock value of the ThinkPad 10 Ultrabook
Keyboard through sysfs, re-using the fn_lock sysfs attribute read/write
helpers from the existing ThinkPad Compact Keyboard with TrackPoint
support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# bc04b37e 04-Jul-2020 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support

Some of the function keys special functions all use the same
0x000c0001 usage code, add a mapping for these based on the usage_index;

And add support for the Speaker and Mic mute LEDs integrated into the
F1 and F4 keys.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# ef550c5d 04-Jul-2020 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Rename fn_lock sysfs attr handlers to make them generic

Except for a single call, there is nothing keyboard-model specific about
the cptkbd fn_lock sysfs attr handlers, rename them dropping the cptkbd
post-/pre-fix, so that they can be re-used for supporting Fn-lock on the
Thinkpad 10 ultrabook kbd.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 484921f5 04-Jul-2020 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Factor out generic parts of the LED code

Factor out the generic parts of the tpkbd LED code, so that they can be
re-used for supporting the LEDs on the Thinkpad 10 ultrabook kbd.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b72cdfa8 04-Jul-2020 Hans de Goede <hdegoede@redhat.com>

HID: lenovo: Merge tpkbd and cptkbd data structures

Merge the tpkbd and cptkbd data structures, into a single unified
structure instead of having a separate data structure per keyboard type.

This is a preparation patch for making the tpkbd LED functions more
generic, so that they can be re-used for supporting the LEDs on the
Thinkpad 10 ultrabook keyboard.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 87fcb6a6 12-Aug-2019 Benjamin Tissoires <benjamin.tissoires@redhat.com>

HID: do not call hid_set_drvdata(hdev, NULL) in drivers

This is a common pattern in the HID drivers to reset the drvdata. Some
do it properly, some do it only in case of failure.

But, this is actually already handled by driver core, so there is no need
to do it manually.

[for hid-sensor-hub.c]
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[For hid-picolcd_core.c]
Acked-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6ae16dfb 24-Dec-2018 Aditya Pakki <pakki001@umn.edu>

HID: lenovo: Add checks to fix of_led_classdev_register

In lenovo_probe_tpkbd(), the function of_led_classdev_register() could
return an error value that is unchecked. The fix adds these checks.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a230cd52 12-Apr-2018 pgzh <peter.ganzhorn@gmail.com>

HID: lenovo: Add support for IBM/Lenovo Scrollpoint mice

The IBM/Lenovo Scrollpoint mice feature a trackpoint-like stick instead of a
scrolling wheel capable of 2-D (vertical+horizontal) scrolling. hid-generic
does only expose 1-D (vertical) scrolling functionality for these mice. This
patch adds support for horizontal scrolling for the IBM/Lenovo Scrollpoint mice
to hid-lenovo.

[jkosina@suse.cz: remove change versioning from git changelog]
Signed-off-by: Peter Ganzhorn <peter.ganzhorn@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# ea36ae09 28-Mar-2016 Josh Boyer <jwboyer@fedoraproject.org>

HID: lenovo: Don't use stack variables for DMA buffers

The lenovo_send_cmd_cptkbd function uses a stack variable to submit
commands via hid_hw_raw_request. Eventually this gets to the
usb_hcd_map_urb_for_dma function, which causes a warning to be thrown
if the CONFIG_DMA_API_DEBUG option is enabled.

Fix this by allocating a temporary buffer instead.

[jkosina@suse.cz: no need to NULL-initialize buf, spotted by Benjamin]
Reported-by: lejeczek <peljasz@yahoo.co.uk>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# ee79a8f8 27-Dec-2015 Geliang Tang <geliangtang@163.com>

HID: use to_hid_device()

Use to_hid_device() instead of container_of().

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 9154301a 29-Sep-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

HID: hid-input: allow input_configured callback return errors

When configuring input device via input_configured callback we may
encounter errors (for example input_mt_init_slots() may fail). Instead
of continuing with half-initialized input device let's allow driver
indicate failures.

Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Acked-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b2c68a2f 29-Sep-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

HID: hid-input: allow input_configured callback return errors

When configuring input device via input_configured callback we may
encounter errors (for example input_mt_init_slots() may fail). Instead
of continuing with half-initialized input device let's allow driver
indicate failures.

Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Acked-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 3cb5ff02 11-Aug-2015 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Hide middle-button press until release

Don't relay a middle button press to userspace until release, and then
only if there was no scroll events inbetween. This is closer to what
Xorg's wheel emulation does, and avoids spurious middle-click pastes.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# dbfebb44 11-Aug-2015 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Add missing return-value check

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 7f65068f 11-Aug-2015 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Use constants for axes names

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b7212600 28-May-2015 Alexey Khoroshilov <khoroshilov@ispras.ru>

HID: lenovo: Remove sysfs group on failure path

There is no sysfs_group_remove() on failure path in lenovo_probe_tpkbd().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 181a8b91 01-May-2015 Benjamin Tissoires <benjamin.tissoires@redhat.com>

HID: lenovo: add support for Lenovo ThinkPad Keyboard Pro unit

This dock is used with the Thinkpad Helix 2 but suffers from an error
in the report descriptor where an usage max is 65535.

Add a report fixup for it and make the keyboard working.

Tested-by: Jonathan Oppenheim <lejono@gmail.com>
Tested-by: John Reid <owlman.lists@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# d92189eb 23-Apr-2015 Andreas Fleig <andreasfleig@gmail.com>

HID: lenovo: set INPUT_PROP_POINTING_STICK

Set flags INPUT_PROP_POINTER and INPUT_PROP_POINTING_STICK for the trackpoint
integrated in Lenovo USB and Bluetooth keyboards. Libinput checks these flags
to enable features such as middle-button-scrolling by default.

Signed-off-by: Andreas Fleig <andreasfleig@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 94eefa27 16-Dec-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Use native middle-button mode for compact keyboards

By default the middle button is in a compatibility mode, and generates
standard wheel events when dragging with the middle trackpoint button.
Unfortunately this is buggy:
* The middle button comes up before starting wheel events, causing a middle
click on whatever the mouse cursor was sitting on
* The USB keyboard always generates the "native" horizontal wheel event,
regardless of mode.

Instead, enable the "native" mode the Windows driver uses, and add support
for the custom events this generates. This fixes the USB keyboard wheel
events, and the middle-click up event comes after the wheel events.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e3cb0acd 16-Dec-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Add sensitivity control to compact keyboards

The trackpoint sensitivity can also be controlled, expose this via
sysfs.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# c87d92b3 09-Nov-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Don't set EV_REP to avoid repeating mice buttons

On the USB keyboard, the VENDOR hotkeys share the same device as the
mouse. Setting EV_REP also affects mouse buttons, so leave it off.

The bluetooth keyboard still has autorepeating mouse buttons, as it
only has one device and is set by the KEYBOARD pages.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 5556eb14 09-Nov-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Move USB KEY_FILE to 0x00f9 to prevent scancode clash

The bluetooth keyboard also generates 0x00fa when the middle button is
pressed. Move the made-up report out of the way so we don't trigger
KEY_FILE when middle button is pressed

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f3d4ff0e 23-Jul-2014 Jamie Lentin <jm@lentin.co.uk>

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

Add support for both ThinkPad Compact Bluetooth Keyboard with
TrackPoint and ThinkPad Compact USB Keyboard with TrackPoint.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Reviewed-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e0a6aad6 26-Jul-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Don't call function in condition, show error codes

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 6a5b414b 23-Jul-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Prepare support for adding other devices

Ensure all tpkbd specifics are within a postfixed function, the
main functions for the driver should just switch to the appropriate
function depending on product ID. Given this, we can add extra devices
by including extra postfixed functions.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Reviewed-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 94723bfa 23-Jul-2014 Jamie Lentin <jm@lentin.co.uk>

HID: lenovo: Rename hid-lenovo-tpkbd to hid-lenovo

Rename module and all functions within so we can add support for other
keyboards in the same file. Rename the _tp postfix to _tpkbd, to
signify functions relevant to the TP USB keyboard.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Reviewed-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>