summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-elan.c
AgeCommit message (Collapse)Author
2021-12-02HID: check for valid USB device for many HID driversGreg Kroah-Hartman
Many HID drivers assume that the HID device assigned to them is a USB device as that was the only way HID devices used to be able to be created in Linux. However, with the additional ways that HID devices can be created for many different bus types, that is no longer true, so properly check that we have a USB device associated with the HID device before allowing a driver that makes this assumption to claim it. Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: Michael Zaidman <michael.zaidman@gmail.com> Cc: Stefan Achatz <erazor_de@users.sourceforge.net> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: linux-input@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> [bentiss: amended for thrustmater.c hunk to apply] Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20211201183503.2373082-3-gregkh@linuxfoundation.org
2021-04-07HID: elan: Remove elan_mute_led_get_brigtness()Hans de Goede
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 elan_mute_led_get_brigtness() 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>
2021-04-07HID: elan: Set default_trigger for the mute LEDHans de Goede
The mute LED should be automatically turned on/off based on the audio-card's mixer settings. Add the standardized default-trigger name for this, so that the alsa code can turn the LED on/off as appropriate (on supported audio cards). 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>
2021-04-07HID: elan: Silence mute LED errors being logged when the device is unpluggedHans de Goede
Being integrated into an USB keyboard-dock the mute LED can go away at any time, leading to the following errors: [ 918.667671] elan 0003:04F3:0755.0002: Failed to set mute led brightness: -19 [ 918.667737] leds elan:red:mute: Setting an LED's brightness failed (-19) Fix this by making the following changes: 1. Don't log an error from elan_mute_led_set_brigtness() when ret == -ENODEV 2. Set the LED_HW_PLUGGABLE flag on the mute LED led_classdev While at it also make sure that elan_mute_led_set_brigtness() returns an error (-EIO) when ret != 3 but it is not an error (>= 0). 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>
2020-09-01HID: elan: Fix memleak in elan_input_configuredDinghao Liu
When input_mt_init_slots() fails, input should be freed to prevent memleak. When input_register_device() fails, we should call input_mt_destroy_slots() to free memory allocated by input_mt_init_slots(). Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner
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>
2019-01-28HID: elan: Make array buf static, shrinks object sizeColin Ian King
Don't populate the array buf on the stack but instead make it static. Makes the object code smaller by 43 bytes: Before: text data bss dec hex filename 7769 1520 0 9289 2449 drivers/hid/hid-elan.o After: text data bss dec hex filename 7662 1584 0 9246 241e drivers/hid/hid-elan.o (gcc version 8.2.0 x86_64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-10-09HID: elan: fix spelling mistake "registred" -> "registered"Colin Ian King
Trivial fix to spelling mistake in hid_err error message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Add support for touchpad on the Toshiba Click Mini L9WHans de Goede
The Toshiba Click Mini L9W keyboard dock has a single i2c-hid Elan device for both the keyboard and the touchpad. Add support for the touchpad to the hid-elan driver, rather then relying on mouse emulation. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Add USB-id for HP x2 10-n000nd touchpadHans de Goede
Now that we query all the parameters, adding support for new hardware is easy. This commit adds support for the touchpad found on the HP x2 10-n000nd touchpad 2-in-1. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Add a flag for selecting if the touchpad has a LEDHans de Goede
Note all Elan touchpads have a LED make this configurable using a flag in hi_id.driver_data. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Query resolution from the touchpadHans de Goede
Query the resolution from the touchpad and report it to userspace Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Query device max_x and max_y value from touchpadHans de Goede
Query the device's max_x and max_y value from the touchpad rather then hardcoding it. This makes adding support for other USB ids a lot easier. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Hardcode finger-count and usb-interfaceHans de Goede
There is no need to have these configurable. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Correctly report MT_PRESSURE instead of TOOL_WIDTHHans de Goede
Elan has given me a (GPL-ed) Android driver for their non HID-mt touchpads to help improve the upstream support. Acoording to Elan what we are currently reporting as tool-width really is a per-touch pressure. This always has a maximum of 255, so there is no need to make the max configurable. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Stop claiming we have TOUCH_MAJOR and then never reporting itHans de Goede
We never report MT_TOUCH_MAJOR, so lets not claim that we do. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-07-17HID: elan: Remove unused max_area_x and max_area_y vatiablesHans de Goede
max_area_x and max_area_y are initialized but never used anywhere, drop them. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-02-16HID: Add driver for USB ELAN TouchpadAlexandrov Stansilav
This is driver for usb touchpad found on HP Pavilion x2 10-p0xx laptop. On this device keyboard and touchpad connected as a single usb device with two interfaces: keyboard, which exposes ordinary keys and second interface is touchpad which also contains FlightMode button and audio mute led (which physically placed on keyboard for some reason). Initially, this touchpad works in mouse emulation mode, this driver will switch it to touchpad mode, which can track 5 fingers and can report coordinates for two of them. Signed-off-by: Alexandrov Stansilav <neko@nya.ai> Signed-off-by: Jiri Kosina <jkosina@suse.cz>