summaryrefslogtreecommitdiff
path: root/drivers/hid
AgeCommit message (Collapse)Author
2016-03-22drivers/hid/uhid.c: check write() bitness using in_compat_syscallAndy Lutomirski
uhid changes the format expected in write() depending on bitness. It should check the syscall bitness directly. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-17Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid Pull HID updates from Jiri Kosina: - functionally equivalent cleanups for wacom driver, making the code more readable, from Benjamin Tissoires - a bunch of improvements and fixes for thingm driver from Heiner Kallweit - bugfixes to out-of-bound access for generic parsing functions (which have been there since ever) extract() and implement(), from Dmitry Torokhov - a lot of added / improved device support in sony, wacom, microsoft, multitouch and logitech driver, from various people * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (44 commits) HID: microsoft: Add ID for MS Wireless Comfort Keyboard hid: thingm: reorder calls in thingm_probe HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report() HID: multitouch: Release all touch slots on reset_resume HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2 HID: penmount: report only one button for PenMount 6000 USB touchscreen controller HID: i2c-hid: Fix suspend/resume when already runtime suspended HID: i2c-hid: Add hid-over-i2c name to i2c id table HID: multitouch: force retrieving of Win8 signature blob HID: Support for CMedia CM6533 HID audio jack controls HID: thingm: improve locking HID: thingm: switch to managed version of led_classdev_register HID: thingm: remove workqueue HID: corsair: fix mapping of non-keyboard usages HID: wacom: close the wireless receiver on remove() HID: wacom: cleanup input devices HID: wacom: reuse wacom_parse_and_register() in wireless_work HID: wacom: move down wireless_work() HID: wacom: break out parsing of device and registering of input HID: wacom: break out wacom_intuos_get_tool_type ...
2016-03-17Merge branches 'for-4.5/upstream-fixes', 'for-4.6/cmedia', ↵Jiri Kosina
'for-4.6/i2c-hid', 'for-4.6/logitech', 'for-4.6/multitouch', 'for-4.6/penmount', 'for-4.6/sony', 'for-4.6/thingm', 'for-4.6/upstream' and 'for-4.6/wacom' into for-linus
2016-03-16HID: microsoft: Add ID for MS Wireless Comfort KeyboardSlava Bacherikov
Microsoft Wireless Comfort Keyboard has vendor specific My Favorites 1-5 keys. Linux already supports this buttons on other MS keyboards by MS_ERGONOMY quirk. So apply MS_ERGONOMY quirk to USB PID 0x00e3 (Microsoft Wireless Optical Desktop Receiver 3.0A). After this My Favorites 1..5 keys will be reported as KEY_F14..KEY_F15 events. Signed-off-by: Slava Bacherikov <slava@bacher09.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-15hid: thingm: reorder calls in thingm_probeHeiner Kallweit
When reviewing another thingm patch Benjamin Tissoires pointed out the following: "The problem here is that hid_hw_start() is called before thingm_version() which allows user space to briefly introduce races between thingm_version() and any hidraw requests. The mutex will not help here as it is initialized after hid_hw_start() and only used for protecting the concurrent access of the rgb." Avoid this possible issue by calling hid_hw_start() later in the probe function. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-15HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report()Dmitry Torokhov
Even though hid_hw_* checks that passed in data_len is less than HID_MAX_BUFFER_SIZE it is not enough, as i2c-hid does not necessarily allocate buffers of HID_MAX_BUFFER_SIZE but rather checks all device reports and select largest size. In-kernel users normally just send as much data as report needs, so there is no problem, but hidraw users can do whatever they please: BUG: KASAN: slab-out-of-bounds in memcpy+0x34/0x54 at addr ffffffc07135ea80 Write of size 4101 by task syz-executor/8747 CPU: 2 PID: 8747 Comm: syz-executor Tainted: G BU 3.18.0 #37 Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT) Call trace: [<ffffffc00020ebcc>] dump_backtrace+0x0/0x258 arch/arm64/kernel/traps.c:83 [<ffffffc00020ee40>] show_stack+0x1c/0x2c arch/arm64/kernel/traps.c:172 [< inline >] __dump_stack lib/dump_stack.c:15 [<ffffffc001958114>] dump_stack+0x90/0x140 lib/dump_stack.c:50 [< inline >] print_error_description mm/kasan/report.c:97 [< inline >] kasan_report_error mm/kasan/report.c:278 [<ffffffc0004597dc>] kasan_report+0x268/0x530 mm/kasan/report.c:305 [<ffffffc0004592e8>] __asan_storeN+0x20/0x150 mm/kasan/kasan.c:718 [<ffffffc0004594e0>] memcpy+0x30/0x54 mm/kasan/kasan.c:299 [<ffffffc001306354>] __i2c_hid_command+0x2b0/0x7b4 drivers/hid/i2c-hid/i2c-hid.c:178 [< inline >] i2c_hid_set_or_send_report drivers/hid/i2c-hid/i2c-hid.c:321 [<ffffffc0013079a0>] i2c_hid_output_raw_report.isra.2+0x3d4/0x4b8 drivers/hid/i2c-hid/i2c-hid.c:589 [<ffffffc001307ad8>] i2c_hid_output_report+0x54/0x68 drivers/hid/i2c-hid/i2c-hid.c:602 [< inline >] hid_hw_output_report include/linux/hid.h:1039 [<ffffffc0012cc7a0>] hidraw_send_report+0x400/0x414 drivers/hid/hidraw.c:154 [<ffffffc0012cc7f4>] hidraw_write+0x40/0x64 drivers/hid/hidraw.c:177 [<ffffffc0004681dc>] vfs_write+0x1d4/0x3cc fs/read_write.c:534 [< inline >] SYSC_pwrite64 fs/read_write.c:627 [<ffffffc000468984>] SyS_pwrite64+0xec/0x144 fs/read_write.c:614 Object at ffffffc07135ea80, in cache kmalloc-512 Object allocated with size 268 bytes. Let's check data length against the buffer size before attempting to copy data over. Cc: stable@vger.kernel.org Reported-by: Alexander Potapenko <glider@google.com> Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-14HID: multitouch: Release all touch slots on reset_resumeBenson Leung
When resetting a device (especially after power loss) it is unlikely that the firmware will keep the contact tracking data for the previous touches and will be able to reconcile it with the new contacts, so let's release all slots on reset resume as start anew. Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-10HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2Daniel Bristot de Oliveira
The device which identifies itself as a "USB Keykoard" (no typo) with VID:PID 1a2c:0027 does not seem to be handling the reports initialization very well. This results in a "usb_submit_urb(ctrl) failed: -1" message from the kernel when connected, and a delay before its initialization. It can also cause the hang the system. This patch adds the quirk for this device, which causes the delay to disappear. It is named as "USB Keykoard2" because the "USB Keykoard" already exists. Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-10HID: penmount: report only one button for PenMount 6000 USB touchscreen ↵Andrew Shadura
controller PenMount 6000 USB resistive touchscreen controller reports it has three buttons, while in reality it doesn't have any and doesn't support active styli, and only generates touch events. In penmount_input_mapping(), map only the first button (with code 0), ignore the rest. Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk> Tested-by: Christian Gmeiner <c.gmeiner@bachmann.info Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-10HID: i2c-hid: Fix suspend/resume when already runtime suspendedDoug Anderson
On ACPI-based systems ACPI power domain code runtime resumes device before calling suspend method, which ensures that i2c-hid suspend code starts with device not in low-power state and with interrupts enabled. On other systems, especially if device is not a part of any power domain, we may end up calling driver's system-level suspend routine while the device is runtime-suspended (with controller in presumably low power state and interrupts disabled). This will result in interrupts being essentially disabled twice, and we will only re-enable them after both system resume and runtime resume methods complete. Unfortunately i2c_hid_resume() calls i2c_hid_hwreset() and that only works properly if interrupts are enabled. Also if device is runtime-suspended driver's suspend code may fail if it tries to issue I/O requests. Let's fix it by runtime-resuming the device if we need to run HID driver's suspend code and also disabling interrupts only if device is not already runtime-suspended. Also on resume we mark the device as running at full power (since that is what resetting will do to it). Reviewed-by: Benson Leung <bleung@chromium.org> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-10HID: i2c-hid: Add hid-over-i2c name to i2c id tableBenson Leung
When using the device tree binding OF compatible = "hid-over-i2c" the i2c id table also needs to have that name in order to auto load this driver, since i2c core reports module alias as i2c:<string> where <string> is compatible string of OF binding stripped of manufacturer's prefix. Tested-by: Andrew Duggan <aduggan@synaptics.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-07HID: multitouch: force retrieving of Win8 signature blobBenjamin Tissoires
The Synaptics 0x11e5 over I2C found in the Asus T100-CHI requires to fetch the signature blob to actually start sending events. With this patch, we should be close enough to the Windows driver which checks the content of the blob at plugin to validate or not the touchscreen. Link: https://bugzilla.kernel.org/show_bug.cgi?id=113481 Fixes: 6d4f5440 ("HID: multitouch: Fetch feature reports on demand for Win8 devices") Cc: stable@vger.kernel.org Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-02HID: Support for CMedia CM6533 HID audio jack controlsBen Chen
The C-Media CM6533 is a USB audio chip featuring it's jack detection capability.The device originates an interrupt transfer via HID interface each time when a jack event occurs. The purpose of this patch is to handle hid raw events to keep the operating system informed of user interactions. Signed-off-by: Ben Chen <ben_chen@bizlinktech.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-02HID: thingm: improve lockingHeiner Kallweit
Reading from the device consists of two operations: sending the read command and the actual read from the device. If the device is accessed in between we might read wrong data. Therefore protect the full sequence of both operations with a mutex. Also change the semantics of thingm_recv to include both operations. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-02HID: thingm: switch to managed version of led_classdev_registerHeiner Kallweit
Simplify the code by switching to the managed version of led_classdev_register. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-02HID: thingm: remove workqueueHeiner Kallweit
Defining workqueues in LED drivers isn't needed any longer as the LED core was extended with a generic workqueue recently. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-23HID: corsair: fix mapping of non-keyboard usagesClément Vuchener
This fixes a bug where the Volume Up key was ignored because it uses the same usage code as G18. Special Corsair usage codes are in the keyboard page, other pages should be left to the generic driver. Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: wacom: close the wireless receiver on remove()Benjamin Tissoires
rmmod/insmod the wacom.ko module does not work for the receiver because it was not previously closed. Now, we can hack with the wireless receiver without having to unplug/replug it. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: wacom: cleanup input devicesBenjamin Tissoires
Just some cleaning up when the input devices are unregistered. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: wacom: reuse wacom_parse_and_register() in wireless_workBenjamin Tissoires
Removes duplicated code. The only difference is that we now need to stop and start the attached hid device, but this is a small cost. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: wacom: move down wireless_work()Benjamin Tissoires
If wireless_work() wants to reuse parse_and_register(), we need to have it declared after this function. No functional changes. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: wacom: break out parsing of device and registering of inputBenjamin Tissoires
Simplifies the .probe() and will allow to reuse this path in the future. Few things are reshuffled in .probe(): - init wacom struct earlier - then retrieve the report descriptor - then parse it and allocate/register inputs. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: wacom: break out wacom_intuos_get_tool_typeBenjamin Tissoires
Allow to reuse the code in a later series and simplifies the reading of wacom_intuos_inout(). Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: fix hid_ignore_special_drivers module parameterBenjamin Tissoires
hid_ignore_special_drivers works fine until hid_scan_report autodetects and reassign devices (for hid-multitouch, hid-microsoft and hid-rmi). Simplify the handling of the parameter: if it is there, use hid-generic, no matter what, and if not, scan the device or rely on the hid_have_special_driver table. This was detected while trying to disable hid-multitouch on a Surface Pro cover which prevented to use the keyboard. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> CC: stable@vger.kernel.org Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-16HID: logitech: fix Dual Action gamepad supportGrazvydas Ignotas
The patch that added Logitech Dual Action gamepad support forgot to update the special driver list for the device. This caused the logitech driver not to probe unless kernel module load order was favorable. Update the special driver list to fix it. Thanks to Simon Wood for the idea. Cc: Vitaly Katraew <zawullon@gmail.com> Fixes: 56d0c8b7c8fb ("HID: add support for Logitech Dual Action gamepads") Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-10HID: sony: underscores are unnecessary for u8, u16, s32Pavel Machek
Double-underscore prefixed types are unnecessary in pure kernel code, replace them with the non prefixed equivalents. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Antonio Ospite <ao2@ao2.it> Acked-by: Frank Praznik <frank.praznik@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-10HID: sony: fix some warnings from scripts/checkpatch.plAntonio Ospite
WARNING: Block comments use a trailing */ on a separate line #822: FILE: drivers/hid/hid-sony.c:822: + * number but it's not needed for correct operation */ WARNING: Block comments use a trailing */ on a separate line #828: FILE: drivers/hid/hid-sony.c:828: + * buttons multiple keypresses are allowed */ WARNING: Block comments use a trailing */ on a separate line #854: FILE: drivers/hid/hid-sony.c:854: + * 0xff and 11th is for press indication */ WARNING: Missing a blank line after declarations #1930: FILE: drivers/hid/hid-sony.c:1930: + struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); + sc->send_output_report(sc); WARNING: Block comments use a trailing */ on a separate line #2510: FILE: drivers/hid/hid-sony.c:2510: + * Logitech joystick from the device descriptor. */ Signed-off-by: Antonio Ospite <ao2@ao2.it> Acked-by: Frank Praznik <frank.praznik@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-10HID: sony: fix errors from scripts/checkpatch.plAntonio Ospite
./scripts/checkpatch.pl \ --types "SPACING,TRAILING_WHITESPACE,POINTER_LOCATION,CODE_INDENT" \ -f drivers/hid/hid-sony.c ERROR: trailing whitespace #933: FILE: drivers/hid/hid-sony.c:933: +^I * $ ERROR: space prohibited after that open square bracket '[' #947: FILE: drivers/hid/hid-sony.c:947: + [ 1] = BTN_TRIGGER_HAPPY1, ERROR: space prohibited after that open square bracket '[' #948: FILE: drivers/hid/hid-sony.c:948: + [ 2] = BTN_TRIGGER_HAPPY2, ERROR: space prohibited after that open square bracket '[' #949: FILE: drivers/hid/hid-sony.c:949: + [ 3] = BTN_TRIGGER_HAPPY3, ERROR: space prohibited after that open square bracket '[' #950: FILE: drivers/hid/hid-sony.c:950: + [ 4] = BTN_TRIGGER_HAPPY4, ERROR: space prohibited after that open square bracket '[' #951: FILE: drivers/hid/hid-sony.c:951: + [ 5] = BTN_TRIGGER_HAPPY5, ERROR: space prohibited after that open square bracket '[' #952: FILE: drivers/hid/hid-sony.c:952: + [ 6] = BTN_TRIGGER_HAPPY6, ERROR: space prohibited after that open square bracket '[' #953: FILE: drivers/hid/hid-sony.c:953: + [ 7] = BTN_TRIGGER_HAPPY7, ERROR: space prohibited after that open square bracket '[' #954: FILE: drivers/hid/hid-sony.c:954: + [ 8] = BTN_TRIGGER_HAPPY8, ERROR: space prohibited after that open square bracket '[' #955: FILE: drivers/hid/hid-sony.c:955: + [ 9] = BTN_TRIGGER_HAPPY9, ERROR: "(foo*)" should be "(foo *)" #1032: FILE: drivers/hid/hid-sony.c:1032: + void(*send_output_report)(struct sony_sc*); WARNING: missing space after return type #1032: FILE: drivers/hid/hid-sony.c:1032: + void(*send_output_report)(struct sony_sc*); ERROR: "(foo*)" should be "(foo *)" #2261: FILE: drivers/hid/hid-sony.c:2261: + void(*send_output_report)(struct sony_sc*)) WARNING: missing space after return type #2261: FILE: drivers/hid/hid-sony.c:2261: + void(*send_output_report)(struct sony_sc*)) ERROR: code indent should use tabs where possible #2449: FILE: drivers/hid/hid-sony.c:2449: + */$ total: 13 errors, 2 warnings, 2570 lines checked Signed-off-by: Antonio Ospite <ao2@ao2.it> Acked-by: Frank Praznik <frank.praznik@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-10HID: lg: fix a typo in descriptors comments s/Joystik/Joystick/Antonio Ospite
Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-05HID: multitouch: warn on sysfs group creation failureNicholas Krause
This adds a warning message stating that the sysfs group was not able to be created for the passed hid_device structure pointer with dev_warn. Signed-off-by: Nicholas Krause <xerofoify@gmail.com> Reviewed-by: Benjamin Tissoires <benajmin.tissoires@redhat.com> [jkosina@suse.cz: massaged changelog a bit] [jkosina@suse.cz: reformatted source] Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-29HID: sony: fix a typo in descriptors comments s/Joystik/Joystick/Antonio Ospite
Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-29HID: dragonrise: fix a typo in descriptors comments s/Joystik/Joystick/Antonio Ospite
Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-29HID: quirks: Add no_init_reports for AKAI midi controllerStafford Horne
The midi controller times-out while initializing reports, this causes boot to take an extra 10 seconds. The device descriptor advertises that it has an internal HID device but seems to not actually do anything useful. Signed-off-by: Stafford Horne <shorne@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-28HID: logitech-hidpp: limit visibility of init/deinit functionsJiri Kosina
hidpp_ff_init() and hidpp_ff_deinit() are not used outside of hid-logitech-hidpp.c, so let's make them static. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-28HID: logitech-hidpp: Force feedback support for the Logitech G920Edwin Velds
This patch implements force feedback support for the Logitech G920 Driving Force Racing Wheel. It is a generic implementation of feature 0x8123 of the Logitech HID++ protocol and should be usable for any future devices that implement this feature. This patch should be applied after the basic G920 support patch by Simon Wood: http://www.spinics.net/lists/linux-input/msg42174.html The driving supports everything that is supported by the G920 firmware: FF_CONSTANT FF_PERIODIC FF_SINE FF_SQUARE FF_SAW_UP FF_SAW_DOWN FF_TRIANGLE FF_SPRING FF_DAMPER FF_AUTOCENTER FF_GAIN and for version 2 firmware also: FF_FRICTION FF_INERTIA FF_RAMP Both envelopes and replay values are supported as well, but some problems may occur when using firmware release 1. There is also a small residual clockwise damper in the wheel when using the first firmware release. All problems are fixed in the soon te be released firmware version 2. The default spring is disabled by permanently placing a spring force in the wheel. This spring is also used as the autocenter spring. Note: The wheel _DOES_NOT_ auto switch to Logitech/HID mode (it is stuck in XBox since the xpad changes where not included). Michal has an alternative approach documented here (and the changes should be submitted upstream to usb_modeswitch project): === Create a file named "046d:c261" in "/etc/usb_modeswitch.d" with the following content: DefaultVendor=046d DefaultProduct=c261 MessageEndpoint=01 ResponseEndpoint=01 TargetClass=0x03 MessageContent="0f00010142" Then run "usb_modeswitch -c /etc/modeswitch.d/046d:c291" as root and watch the magic happen:) === [jkosina@suse.cz: added information about mode switching from Simon] [jkosina@suse.cz: fixed a few stylistic issues pointed out by Simon] [jkosina@suse.cz: fix merge conflict due to to_hid_device() changes] Signed-off-by: Edwin Velds <e.velds@gmail.com> Tested-by: Elias Vanderstuyft <elias.vds@gmail.com> Tested-by: Simon Wood <simon@mungewell.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-27HID: rmi: Check that the device is a RMI device in suspend and resume callbacksAndrew Duggan
Commit 092563604217 ("HID: rmi: Disable scanning if the device is not a wake source") introduced a regression for devices which use hid-rmi to handle composite USB devices. The suspend or resume callbacks are not checking that the device is a RMI device before calling rmi_read or rmi_write. This results in dereferencing uninitialized variables on non RMI devices. This patch checks that the RMI_DEVICE flag is set before sending RMI commands to the device. Reported-by: Rodrigo Gomes <rodrigo.toste.gomes@gmail.com> Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-25HID: usbhid: Fix incorrect product id of old 4nes4snesRaphael Assenat
The correct product ID for the old version of the raphnet 4nes4snes device was 0x0a9d, not 0x0a8d. Signed-off-by: Raphael Assenat <raph@raphnet.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-21HID: add HID_QUIRK_NOGET to Quanta 3003 tooBenjamin Tissoires
dmesg shows a lot of: [ 1374.890348] hid-multitouch 0003:0408:3003.0007: usb_submit_urb(ctrl) failed: -1 [ 1384.916388] hid-multitouch 0003:0408:3003.0007: usb_submit_urb(ctrl) failed: -1 [ 1384.916432] hid-multitouch 0003:0408:3003.0007: timeout initializing reports Add the quirk and make the touchscreen happy. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Jim lovell <jimlovell777@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-20Merge tag 'asm-generic-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic Pull asm-generic updates from Arnd Bergmann: "The asm-generic tree this time contains one series from Nicolas Pitre that makes the optimized do_div() implementation from the ARM architecture available to all architectures. This also adds stricter type checking for callers of do_div, which has uncovered a number of bugs in existing code, and fixes up the ones we have found" * tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: ARM: asm/div64.h: adjust to generic codde __div64_32(): make it overridable at compile time __div64_const32(): abstract out the actual 128-bit cross product code do_div(): generic optimization for constant divisor on 32-bit machines div64.h: optimize do_div() for power-of-two constant divisors mtd/sm_ftl.c: fix wrong do_div() usage drm/mgag200/mgag200_mode.c: fix wrong do_div() usage hid-sensor-hub.c: fix wrong do_div() usage ti/fapll: fix wrong do_div() usage ti/clkt_dpll: fix wrong do_div() usage tegra/clk-divider: fix wrong do_div() usage imx/clk-pllv2: fix wrong do_div() usage imx/clk-pllv1: fix wrong do_div() usage nouveau/nvkm/subdev/clk/gk20a.c: fix wrong do_div() usage
2016-01-19HID: core: prevent out-of-bound readingsBenjamin Tissoires
Plugging a Logitech DJ receiver with KASAN activated raises a bunch of out-of-bound readings. The fields are allocated up to MAX_USAGE, meaning that potentially, we do not have enough fields to fit the incoming values. Add checks and silence KASAN. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-19HID: fix out of bound access in extract() and implement()Dmitry Torokhov
extract() and implement() access buffer containing reports in 64-bit chunks, but there is no guarantee that buffers are padded to 64 bit boundary. In fact, KASAN has caught such OOB access with i2c-hid and Synaptics touch controller. Instead of trying to hunt all parties that allocate buffers and make sure they are padded, let's switch extract() and implement() to byte access. It is a bit slower, bit we are not dealing with super fast devices here. Also let's fix link to the HID spec while we are at it. Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: sony: Fixup output reports for the nyko core controllerScott Moreau
The nyko core controller uses the same output report format as the sixaxis controllers, but it expects the report id at offset 1. This does not interfere with the official controllers as this byte is considered a padding byte by the current code. Signed-off-by: Scott Moreau <oreaus@gmail.com> Acked-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: sony: Add nyko core controller supportScott Moreau
This adds rumble and LED support for nyko core controllers using the sino lite chip vendor:1345 product:3008, for PS3. Setting operational mode and output reports are the same as sixaxis but the input report has a different format since the PS3 accepts HID usb devices. For it to work, an exception is needed to skip overriding the report descriptor and use the original one. Signed-off-by: Scott Moreau <oreaus@gmail.com> Acked-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: sony: do not bail out when the sixaxis refuses the output reportBenjamin Tissoires
When setting the operational mode, some third party (Speedlink Strike-FX) gamepads refuse the output report. Failing here means we refuse to initialize the gamepad while this should be harmless. The weird part is that the initial commit that added this: a7de9b8 ("HID: sony: Enable Gasia third-party PS3 controllers") mentions this very same controller as one requiring this output report. Anyway, it's broken for one user at least, so let's change it. We will report an error, but at least the controller should work. And no, these devices present themselves as legacy Sony controllers (VID:PID of 054C:0268, as in the official ones) so there are no ways of discriminating them from the official ones. https://bugzilla.redhat.com/show_bug.cgi?id=1255325 Reported-and-tested-by: Max Fedotov <thesourcehim@gmail.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: wacom - Add quirks for INTUOSHT2 in range eventsPing Cheng
INTUOSHT2 in range event is not used to indicate in proximity state. INTUOSHT2 only has one stylus. Signed-off-by: Ping Cheng <pingc@wacom.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: wacom - Cleanup touch arbitration logicPing Cheng
stylus_in_proximity was introduced to support touch arbitration before in range was supported. With in range event, the logic changed. stylus_in_proximity should be set for both in prox and in range events. To finish a clean touch arbitration logic, we should send touch up (if it was down) before posting any general pen events. Signed-off-by: Ping Cheng <pingc@wacom.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: wacom - make sure wacom_intuos_inout only process in/out eventsPing Cheng
Move general events related data validation to wacom_intuos_general. Signed-off-by: Ping Cheng <pingc@wacom.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-18HID: wacom - request tool info only when we get general eventsPing Cheng
Move wacom_intuos_schedule_prox_event inside wacom_intuos_general so we don't call it when general event data isn't ready. Signed-off-by: Ping Cheng <pingc@wacom.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-01-17Merge tag 'gpio-v4.5-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "Here is the bulk of GPIO changes for v4.5. Notably there are big refactorings mostly by myself, aimed at getting the gpio_chip into a shape that makes me believe I can proceed to preserve state for a proper userspace ABI (character device) that has already been proposed once, but resulted in the feedback that I need to go back and restructure stuff. So I've been restructuring stuff. On the way I ran into brokenness (return code from the get_value() callback) and had to fix it. Also, refactored generic GPIO to be simpler. Some of that is still waiting to trickle down from the subsystems all over the kernel that provide random gpio_chips, I've touched every single GPIO driver in the kernel now, oh man I didn't know I was responsible for so much... Apart from that we're churning along as usual. I took some effort to test and retest so it should merge nicely and we shook out a couple of bugs in -next. Infrastructural changes: - In struct gpio_chip, rename the .dev node to .parent to better reflect the fact that this is not the GPIO struct device abstraction. We will add that soon so this would be totallt confusing. - It was noted that the driver .get_value() callbacks was sometimes reporting negative -ERR values to the gpiolib core, expecting them to be propagated to consumer gpiod_get_value() and gpio_get_value() calls. This was not happening, so as there was a mess of drivers returning negative errors and some returning "anything else than zero" to indicate that a line was active. As some would have bit 31 set to indicate "line active" it clashed with negative error codes. This is fixed by the largeish series clamping values in all drivers with !!value to [0,1] and then augmenting the code to propagate error codes to consumers. (Includes some ACKed patches in other subsystems.) - Add a void *data pointer to struct gpio_chip. The container_of() design pattern is indeed very nice, but we want to reform the struct gpio_chip to be a non-volative, stateless business, and keep states internal to the gpiolib to be able to hold on to the state when adding a proper userspace ABI (character device) further down the road. To achieve this, drivers need a handle at the internal state that is not dependent on their struct gpio_chip() so we add gpiochip_add_data() and gpiochip_get_data() following the pattern of many other subsystems. All the "use gpiochip data pointer" patches transforms drivers to this scheme. - The Generic GPIO chip header has been merged into the general <linux/gpio/driver.h> header, and the custom header for that removed. Instead of having a separate mm_gpio_chip struct for these generic drivers, merge that into struct gpio_chip, simplifying the code and removing the need for separate and confusing includes. Misc improvements: - Stabilize the way GPIOs are looked up from the ACPI legacy specification. - Incremental driver features for PXA, PCA953X, Lantiq (patches from the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48 New drivers: - Add a GPIO chip to the ALSA SoC AC97 driver. - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but the branch is merged here too to account for infrastructural changes). - The sx150x driver now supports the sx1502" * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits) gpio: generic: make bgpio_pdata always visible gpiolib: fix chip order in gpio list gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs() gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs() gpio: brcmstb: Allow building driver for BMIPS_GENERIC gpio: brcmstb: Set endian flags for big-endian MIPS gpio: moxart: fix build regression gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() leds: pca9532: use gpiochip data pointer leds: tca6507: use gpiochip data pointer hid: cp2112: use gpiochip data pointer bcma: gpio: use gpiochip data pointer avr32: gpio: use gpiochip data pointer video: fbdev: via: use gpiochip data pointer gpio: pch: Optimize pch_gpio_get() Revert "pinctrl: lantiq: Implement gpio_chip.to_irq" pinctrl: nsp-gpio: use gpiochip data pointer pinctrl: vt8500-wmt: use gpiochip data pointer pinctrl: exynos5440: use gpiochip data pointer pinctrl: at91-pio4: use gpiochip data pointer ...
2016-01-14Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid Pull HID updates from Jiri Kosina: - appoint Benjamin Tissoires as co-maintainer / designated reviewer - sysfs report_descriptor visibility fix for unclaimed devices, from Andy Lutomirski - suspend/resume fixes for Sony driver from Frank Praznik - IRQ deadlock fix from Ioan-Adrian Ratiu - hid-i2c fixes affecting (at least) Yoga 900 from Mika Westerberg and Srinivas Pandruvada - a lot of new device support (especially, but not limited to, Wacom) and assorted small misc fixes - almost complete G920 support; the only bit that is missing is switching the device to HID mode automatically; Simon Wood and Michal Maly are working on it. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (46 commits) Revert "INPUT: xpad: switch Logitech G920 Wheel into HID mode" HID: sensor-hub: Add quirk for Lenovo Yoga 900 with ITE Chips HID: Add new PID for Microchip Pick16F1454 HID: wacom: Use correct report to query pen ID from INTUOSHT2 devices HID: i2c-hid: Prevent sending reports from racing with device reset HID: use kobj_to_dev() HID: wiimote: use dev_to_wii() HID: add a new helper to_hid_driver() HID: use to_hid_device() HID: move to_hid_device() to hid.h HID: usbhid: use to_usb_device HID: corsair: Convert to use module_hid_driver HID: input: ignore the battery in OKLICK Laser BTmouse HID: wacom: Fix pad button range for CINTIQ_COMPANION_2 HID: wacom: Fix touchring value reporting HID: wacom: Report 'strip2' values in ABS_RY HID: wacom: Limit touchstrip data to 13 bits HID: wacom: bitwise vs logical ORs HID: wacom: Apply lowres quirk to BAMBOO_TOUCH devices HID: enable hid device to suspend/resume asynchronously ...