History log of /linux-master/drivers/hid/hid-lg.c
Revision Date Author Comments
# 93020953 01-Dec-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: check for valid USB device for many HID drivers

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


# 434f7709 04-Feb-2021 Hans de Goede <hdegoede@redhat.com>

HID: logitech-dj: Handle newer quad/bt2.0 receivers in HID proxy mode

The Dinovo Edge and Dinovo Mini keyboards with builtin touchpad come with
a different version of the quad/bt2.0 combo receivers shipped with the
MX5000 and MX5500 keyboards. These receivers are compatible with one
another, e.g. the Dinovo Edge keyboard can be paired with the MX5000
receiver.

Like the MX5x00 receivers in HID proxy mode these receivers present
themselves as a hub with multiple USB-HID devices, one for the keyboard
and one for the mouse.

Where they differ is that the mouse USB-device has 2 input reports for
reporting mice events. It has the exact same INPUT(2) report as the
MX5x00 receivers, but it also has a second INPUT(5) mouse report which
is different; and when the Dinovo receivers are paired with the Dinovo
keyboards the second INPUT(5) mouse report is actually used for events
on the builtin touchpad.

Add support for handling the Dinovo quad/bluetooth-2.0 combo receivers
in HID proxy mode to logitech-dj, like we already do for the similar
MX5000 and MX5500 receivers.

This adds battery monitoring functionality (through logitech-hidpp) and
fixes the Phone (Fn + F1) and "[A]" - "[D]" (Fn + F9 - F12) hotkeys not
working on the Dinovo Edge.

Note these receivers present themselves as a hub with 2 separate USB
devices for the keyboard and mouse; and the logitech-dj code needs to
bind to both devices (just as with the MX5x00 receivers).

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


# 5f924277 20-Aug-2019 Alan Stern <stern@rowland.harvard.edu>

HID: logitech: Fix general protection fault caused by Logitech driver

The syzbot fuzzer found a general protection fault in the HID subsystem:

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN
CPU: 0 PID: 3715 Comm: syz-executor.3 Not tainted 5.2.0-rc6+ #15
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:__pm_runtime_resume+0x49/0x180 drivers/base/power/runtime.c:1069
Code: ed 74 d5 fe 45 85 ed 0f 85 9a 00 00 00 e8 6f 73 d5 fe 48 8d bd c1 02
00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48
89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 fe 00 00 00
RSP: 0018:ffff8881d99d78e0 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000020 RCX: ffffc90003f3f000
RDX: 0000000416d8686d RSI: ffffffff82676841 RDI: 00000020b6c3436a
RBP: 00000020b6c340a9 R08: ffff8881c6d64800 R09: fffffbfff0e84c25
R10: ffff8881d99d7940 R11: ffffffff87426127 R12: 0000000000000004
R13: 0000000000000000 R14: ffff8881d9b94000 R15: ffffffff897f9048
FS: 00007f047f542700(0000) GS:ffff8881db200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30f21000 CR3: 00000001ca032000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
pm_runtime_get_sync include/linux/pm_runtime.h:226 [inline]
usb_autopm_get_interface+0x1b/0x50 drivers/usb/core/driver.c:1707
usbhid_power+0x7c/0xe0 drivers/hid/usbhid/hid-core.c:1234
hid_hw_power include/linux/hid.h:1038 [inline]
hidraw_open+0x20d/0x740 drivers/hid/hidraw.c:282
chrdev_open+0x219/0x5c0 fs/char_dev.c:413
do_dentry_open+0x497/0x1040 fs/open.c:778
do_last fs/namei.c:3416 [inline]
path_openat+0x1430/0x3ff0 fs/namei.c:3533
do_filp_open+0x1a1/0x280 fs/namei.c:3563
do_sys_open+0x3c0/0x580 fs/open.c:1070
do_syscall_64+0xb7/0x560 arch/x86/entry/common.c:301
entry_SYSCALL_64_after_hwframe+0x49/0xbe

It turns out the fault was caused by a bug in the HID Logitech driver,
which violates the requirement that every pathway calling
hid_hw_start() must also call hid_hw_stop(). This patch fixes the bug
by making sure the requirement is met.

Reported-and-tested-by: syzbot+3cbe5cd105d2ad56a1df@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 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>


# 423dfbc3 09-May-2019 Hans de Goede <hdegoede@redhat.com>

HID: logitech-dj: Add usb-id for the 27MHz MX3000 receiver

Testing has shown that, as expected, the MX3000 receiver is fully
compatible with the existing 27MHz receiver support in hid-logitech-dj.c.

After this the only, presumably also compatible, receiver id left in
hid-lg.c is the USB_DEVICE_ID_S510_RECEIVER / 0xc50c id. If we can get
someone to confirm that this receiver works with the dj 27Mhz support too,
then the handling of the LG_RDESC and LG_WIRELESS quirks can be removed
from hid-lg.c.

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


# c9121cf6 20-Apr-2019 Hans de Goede <hdegoede@redhat.com>

HID: logitech-dj: add support for 27 MHz receivers

Most Logitech wireless keyboard and mice using the 27 MHz are hidpp10
devices, add support to logitech-dj for their receivers.

Doing so leads to 2 improvements:

1) All these devices share the same USB product-id for their receiver,
making it impossible to properly map some special keys / buttons
which differ from device to device. Adding support to logitech-dj to
see these as hidpp10 devices allows us to get the actual device-id
from the keyboard / mouse.

2) It enables battery-monitoring of these devices

This patch uses a new HID group for 27Mhz devices, since the logitech-hidpp
code needs to be able to differentiate them from other devices instantiated
by the logitech-dj code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# e41b3cda 24-Jan-2019 Jarrad Whitaker <jarrad.whitaker@gmail.com>

HID: fix Logitech WingMan Formula GP joined axes

The Logitech WingMan Formula GP by default presents a combined
accelerate/brake axis, so this patch assigns it to hid-logitech in order to
benefit from the axis-splitting logic in lg4ff. There is also a fixed
report descriptor for the resulting report.

Signed-off-by: Jarrad Whitaker <jarrad.whitaker@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 47af1cdb 25-Aug-2017 Colin Ian King <colin.king@canonical.com>

HID: hid-lg: make array cbuf static const to shink object code size

Don't populate array cbuf on the stack, instead make it static.
Makes the object code smaller by over 110 bytes:

Before:
text data bss dec hex filename
15096 3504 128 18728 4928 drivers/hid/hid-lg.o

After:
text data bss dec hex filename
14884 3600 128 18612 48b4 drivers/hid/hid-lg.o

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


# 877a021e 26-Jan-2017 Ardinartsev Nikita <pinguin255@gmail.com>

HID: hid-lg: Fix immediate disconnection of Logitech Rumblepad 2

With NOGET quirk Logitech F510 is now fully workable in dinput mode including
rumble effects (according to fftest).

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=117091

[jkosina@suse.cz: fix patch format]
Signed-off-by: Ardinartsev Nikita <ardinar23@gmail.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 061232f0 21-Nov-2016 Benjamin Tissoires <benjamin.tissoires@redhat.com>

HID: lg: make transfer buffers DMA capable

Kernel v4.9 strictly enforces DMA capable buffers, so we need to remove
buffers allocated on the stack.

[jkosina@suse.cz: fix up second usage of hid_hw_raw_request(), spotted by
0day build bot]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 560bea30 18-Sep-2016 Simon Wood <gitsend@mungewell.org>

HID: hid-logitech: Improve Wingman Formula Force GP support

Move ForceFeedback support for the Formula Force GP into hid-lgff4
and re-write HID descriptor, thus allowing combined pedals or not
as user desires.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 7363b25a 18-Sep-2016 Simon Wood <gitsend@mungewell.org>

HID: hid-logitech: Rewrite of descriptor for all DF wheels

Rewrite the HID descriptor for _all_ Driving Force wheels (real
or emulated) so that they can report separate Accelerator and
Brake axis.

If the user wants a combined accel/brake axis, they can use the
'combined pedals' feature.

$ echo 1 > /sys/bus/hid/devices/<device-id>/combine_pedals

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# c832f86e 18-Sep-2016 Simon Wood <gitsend@mungewell.org>

HID: hid-logitech: Add combined pedal support Logitech wheels

Add support for reporting a combined accelerator/brake axis for wheels
which contain combined data in their HID stream.

This includes DF, MOMO, MOMO2 and DFP.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# bfb61abf 09-Feb-2016 Antonio Ospite <ao2@ao2.it>

HID: lg: fix a typo in descriptors comments s/Joystik/Joystick/

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2078665a 01-Dec-2015 Benjamin Tissoires <benjamin.tissoires@redhat.com>

HID: lg: restrict filtering out of first interface to G29 only

Looks like 29fae1c85 ("HID: logitech: Add support for G29") was a little
bit aggressive and broke other devices.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=108121

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


# 29fae1c8 02-Nov-2015 Simon Wood <simon@mungewell.org>

HID: logitech: Add support for G29

At present the G29 is mis-identified as a DFGT, this patch ensures
that the wheel is correctly detected and allows setting the LEDs and
turning range via the '/sys' interface.

This wheel can also emulate other types of Logitech wheels.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# c873d9ab 23-Jul-2015 Simon Wood <simon@mungewell.org>

HID: hid-lg: Add USBID for Logitech G29 Wheel

Since this wheel is now available, and the USBID is listed on their website,
this patch adds it to allow the hid-lg4ff force feedback driver to find it.

I do not have this wheel to test with, but this should at least get it working
in emulation mode.

Note: There is probably more work required for adjust HID descriptor and handle
switching between emulation and native modes.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>


# f4e1eb96 08-Apr-2015 Michal Malý <madcatxster@devoid-pointer.net>

HID: hid-lg: Only one of LG_FF flags can be set for a given device

Only one of LG_FF flags can be set for a given device.

Signed-off-by: Michal Malý <madcatxster@devoid-pointer.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b211a638 08-Apr-2015 Michal Malý <madcatxster@devoid-pointer.net>

HID: hid-lg4ff: Stop the hid device from lg4ff

Stop the hid device from lg4ff. Originally hid-lg was responsible for
stopping of the device.

Signed-off-by: Michal Malý <madcatxster@devoid-pointer.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2dbf635e 08-Apr-2015 Michal Malý <madcatxster@devoid-pointer.net>

HID: hid-lg: Check return values from lg[N]ff_init()

Check return values from lg[N]ff_init(). hid-lg did not check return values from
the lg[N]_init() functions, possibly trying to work with a device whose
initialization has failed.

Signed-off-by: Michal Malý <madcatxster@devoid-pointer.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e0393062 02-May-2015 Nicholas Mc Guire <hofrat@osadl.org>

HID: make timeout HZ independent

wait_event_interruptible_timeout() expects a timeout in jiffies so the
numeric constant becomes HZ dependent - put it through msecs_to_jiffies()
to make it HZ independent.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a54dc779 18-Feb-2015 Michal Malý <madcatxster@devoid-pointer.net>

HID: hid-lg4ff: Introduce a module parameter to disable automatic switch of compatibility mode

Introduce a module parameter to disable automatic switch of Logitech gaming
wheels from compatibility to native mode. This only applies to multimode wheels.

Signed-off-by: Michal Malý <madcatxster@devoid-pointer.net>
Tested-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 4ab25786 21-Aug-2014 Jiri Kosina <jkosina@suse.cz>

HID: fix a couple of off-by-ones

There are a few very theoretical off-by-one bugs in report descriptor size
checking when performing a pre-parsing fixup. Fix those.

Cc: stable@vger.kernel.org
Reported-by: Ben Hawkes <hawkes@google.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b0dd72aa 09-Feb-2014 Benjamin Tissoires <benjamin.tissoires@redhat.com>

HID: replace hid_output_raw_report with hid_hw_raw_request for feature requests

ret = hid_output_raw_report(A, B, C, HID_FEATURE_REPORT);
is equivalent to
ret = hid_hw_raw_request(A, B[0], B, C, HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
whatever the transport layer is.

So use the new API where available

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


# 7e845d46 05-Feb-2014 Benjamin Tissoires <benjamin.tissoires@redhat.com>

HID: introduce helper to access hid_output_raw_report()

Add a helper to access hdev->hid_output_raw_report().

To convert the drivers, use the following snippets:

for i in drivers/hid/*.c
do
sed -i.bak "s/[^ \t]*->hid_output_raw_report(/hid_output_raw_report(/g" $i
done

Then manually fix for checkpatch.pl

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 56d0c8b7 30-Nov-2013 Vitaly Katraew <zawullon@gmail.com>

HID: add support for Logitech Dual Action gamepads

I have two Logitech Dual Action gamepads, both have same Vendor/Device id pair.
Newest gamepad (A) can switch between old mode (HID) and XBox gamepad emulation
mode. Old gamepad (B) can only work in HID mode. In HID mode gamepad A sends
many EPIPE errors during initialization and was disconnected immediately after
connect to usb port. It works fine in Win and Mac. After adding NOGET quirk in
driver, it was working properly. Gamepad B works fine before and after
changes. I tested both gamepads with 3.8.0 and 3.11.6 kernels with modified
driver. Follow patch can apply for current git kernel version. I can send pcap
log from usb bus with both gamepads or any other additional information if it
is needed

Signed-off-by: Vitaly Katraew <zawullon@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 348cbaa8 10-Oct-2013 Simon Wood <simon@mungewell.org>

HID: lg: fix Report Descriptor for Logitech MOMO Force (Black)

By default the Logitech MOMO Force (Black) presents a combined accel/brake
axis ('Y'). This patch modifies the HID descriptor to present seperate
accel/brake axes ('Y' and 'Z').

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 7f505470 10-Oct-2013 Simon Wood <simon@mungewell.org>

HID: lg: fix ReportDescriptor for Logitech Formula Vibration

By default the Logitech Formula Vibration presents a combined accel/brake
axis ('Y'). This patch modifies the HID descriptor to present seperate
accel/brake axes ('Y' and 'Z').

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# bd04363d 07-Oct-2013 Elias Vanderstuyft <Elias.vds@gmail.com>

HID: logitech - lg2ff: Add IDs for Formula Vibration Feedback Wheel

Add USB IDs for Logitech Formula Vibration Feedback Wheel (046d:ca04).

The lg2ff force feedback subdriver is used for vibration and
HID_GD_MULTIAXIS is set to avoid deadzone like other Logitech wheels.

Kconfig description etc are also updated accordingly.

Signed-off-by: Elias Vanderstuyft <Elias.vds@gmail.com>
[anssi.hannula@iki.fi: added description and CCs]
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 94b3f712 19-Feb-2013 Simon Wood <simon@mungewell.org>

HID: LG: Prevent the Logitech Gaming Wheels deadzone

This patch ensures that the Logitech wheels are not initialised with
default fuzz/flat values, by marking them as multiaxis devices (rather
than joysticks).

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b5836246 19-Feb-2013 Simon Wood <simon@mungewell.org>

HID: LG: Fix detection of Logitech Speed Force Wireless (WiiWheel)

Previously 'LG4FF' was only used for the WiiWheel, however it is now used
for all the Logitech Wheels. This patch corrects the detection mechanism
for the patching the report descriptor to ensure only the WiiWheel will
be patched.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 270baef1 19-Feb-2013 Simon Wood <simon@mungewell.org>

HID: LG: Add support for Logitech Momo Force (Red) Wheel

This patch provides a modified report descriptor to split accelerator
and brake, and adds the 'NO_GET' flag to prevent it hanging on
connection.

Note: for convience this patch is against the follow patch which was applied
earlier this week.
https://patchwork.kernel.org/patch/2153471/

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 5a9b571b 17-Feb-2013 Paul Sbarra <sbarra.paul@gmail.com>

HID: logitech: split accel, brake for Driving Force wheel

Signed-off-by: Paul Sbarra <sbarra.paul@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 54bfe3f0 17-Feb-2013 Paul Sbarra <sbarra.paul@gmail.com>

HID: logitech: add report descriptor for Driving Force wheel

This is the original report descriptor as reported by lsusb -vd 046d:c294.

Signed-off-by: Paul Sbarra <sbarra.paul@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f425458e 17-Dec-2012 H Hartley Sweeten <hartleys@visionengravers.com>

HID: Use module_hid_driver macro

Use the new module_hid_driver macro in all HID drivers that have
a simple register/unregister init/exit.

This also converts the hid drivers that test for a failure of
hid_register_driver() and report the failure. Using module_hid_driver
in those drivers removes the failure message.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a80fe5d6 23-Sep-2012 Michal Malý <madcatxster@gmail.com>

HID: lg4ff: Minor coding style fixes in lg4ff and hid-lg

Fixes a couple of minor coding style issues.

Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2b24a960 23-Sep-2012 Michal Malý <madcatxster@gmail.com>

HID: hid-lg4ff: Adjust X axis input value accordingly to selected range.

Range limiting command for the Driving Force Pro wheel is only a FF_SPRING
effect so that the wheel creates resistance when the user tries to turn it past
the limit. It is however possible to overpower the FFB motors quite easily which
leads to the X axis value exceeding the expected limit. This confuses
games which dynamically adjust calibration using the highest/lowest min and max
values reported by the wheel. Joydev device driver also doesn't take in account
any changes in an axis range after the joystick device is created.

This patch recalculates received ABS_X axis value so it is always in
<0; 16383> range where 0 is the left limit and 16383 the right limit.
Logitech driver for Windows does the same thing. As for any concerns about
possible loss of precision, I compared a large set of raw/adjusted values
generated by "mult_frac" to values returned by the Windows driver and I got
a 100% match.

Other Logitech wheels will probably need a similar fix, but I currently lack
the information needed to write one.

Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 25751553 13-Sep-2012 Axel Lin <axel.lin@gmail.com>

HID: lg: Remove unnecessary casts of void pointers

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2f43f874 04-Sep-2012 Jiri Kosina <jkosina@suse.cz>

HID: remove Paul Walmsley's copyright from places where it shouldn't be

Paul Walmsley has implemented dynamic quirk handling back in 2007 through
commits:

2eb5dc30eb ("USB HID: encapsulate quirk handling into hid-quirks.c")
8222fbe67c ("USB HID: clarify static quirk handling as squirks")
8cef908235 ("USB HID: add support for dynamically-created quirks")
876b9276b9 ("USB HID: add 'quirks' module parameter")

and as such, his copyright rightly belongs to
drivers/hid/usbhid/hid-quirks.c file.

However when generic HID code has been converted to bus and individual
quirks separated out to individual drivers on the bus, the copyright has
been blindly transfered into all the tiny drivers, which actually don't
contain any of Pauls' copyrighted code.

Remove the copyright from those sub-drivers.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Paul Walmsley <paul@pwsan.com>


# 8577dbf9 31-Mar-2012 Michal Malý <madcatxster@gmail.com>

HID: hid-lg: Allow for custom device-specific properties to be stored in priv drvdata

This patch adds support for custom device-specific properties which can now be
stored as private driver data and read/saved using hid_get/set_drvdata().

Signed-off-by: Michal Malý <madcatxster@gmail.com>
Tested-by: simon@mungewell.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 30bb75d7 04-Aug-2011 Michal Malý <madcatxster@gmail.com>

HID: lg4ff - Add range setting support and sysfs interface

Wheel range of certain Logitech wheels - namely Driving Force GT, Driving Force
Pro, G25 and G27 can be adjusted. Minimu is 40 degrees, maximum 900. DFGT, G25
and G27 all use a common command, DFP uses another one. Range can be set from
userspace by writing to
"/sys/module/hid_logitech/drivers/hid:logitech/<dev>range". The driver use list
to store range of each connected wheel; it's not possible to use driver_data in
hid_device struct as it's already b hig-lg driver.

Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 7362cd22 04-Aug-2011 Michal Malý <madcatxster@gmail.com>

HID: lg4ff - Move handling of Logitech wheels to lg4ff driver

This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely

- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.

- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.

- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch

There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.

As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.

Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# dc0a4f0c 02-Jun-2011 Michael Bauer <michael@m-bauer.org>

HID: Fix Logitech Driving Force Pro wheel

- Add the quirk "NOGET" to make the wheel work at all in native mode.
- Replace the somehow broken report descriptor with a custom one to have
separate throttle and brake axes.

As there are significant differences in the descriptor (original descriptor
"hides" the separate axes in a 24 bit FF00 usagepage, new descripter replaces
that with two individual 8 bit desktop.y and desktop.rz usages) I provided a
complete replacement descriptor instead trying to patch the original one.
Patching the descriptor seems not feasible as the new one is much larger.

Note: To actually test this you have to use the tool "ltwheelconf" to put the
DFP into it's native mode - See below for more info.

Background:
Most Logitech wheels are initially reporting themselves with a "fallback"
deviceID (USB_DEVICE_ID_LOGITECH_WHEEL - 0xc294), in order to make sure they
are working even without having the proper driver installed.

If the Logitech driver is installed it sends a special command to the wheel
which sets the wheel to "native mode", enabling enhance features like:
- Clutch pedal
- extended wheel rotation range (up to 900 degrees)
- H-gate shifter
- separate axis for throttle / brake
- all buttons

When the wheel is set to native mode it basically disconnects and reconnects
with a different deviceID (USB_DEVICE_ID_LOGITECH_DFP_WHEEL - 0xc298 in this
case).

I am working on a userspace tool [1] which does the switching from fallback to
native mode. During development I found out that the Driving Force Pro wheel
is not supported in native mode - quierk NOGET is missing and the throttle and
brake axes are reported in a combined way only.

Signed-off-by: Michael Bauer <michael@m-bauer.org>
Signed-off-by: Simon Wood <simon@mungewell.org>

[1] https://github.com/TripleSpeeder/LTWheelConf
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# fdc6807f 03-May-2011 Peter Gundermann <slim-one@users.sourceforge.net>

HID: add support for Logitech G27 wheel

Gere's a small patch to add support for the Logitech G27 wheel, since
the prior patch only added FF support for the Driving Force Pro and G25.
The patch contains the changes from the G25 and DFP, too.

I tested the changes with wine/LFS and got full support for all axes and
buttons.

Signed-off: Peter Gundermann <slim-one@users.sourceforge.net>

Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 5623a24a 16-Mar-2011 Jiri Kosina <jkosina@suse.cz>

HID: add support for Logitech Driving Force Pro wheel

Add force feedback support for Logitech Driving Force Pro wheel.

Device IDs reported by Michal Malý.

Reported-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 4291ee30 09-Dec-2010 Joe Perches <joe@perches.com>

HID: Add and use hid_<level>: dev_<level> equivalents

Neaten current uses of dev_<level> by adding and using
hid specific hid_<level> macros.

Convert existing uses of dev_<level> uses to hid_<level>.
Convert hid-pidff printk uses to hid_<level>.

Remove err_hid and use hid_err instead.

Add missing newlines to logging messages where necessary.
Coalesce format strings.

Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Other miscellaneous changes:

Add const struct hid_device * argument to hid-core functions
extract() and implement() so hid_<level> can be used by them.
Fix bad indentation in hid-core hid_input_field function
that calls extract() function above.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# d8692ac0 23-Oct-2010 Jiri Kosina <jkosina@suse.cz>

HID: fix mismerge in hid-lg

Fix wrong merge in hid-lg -- report fixup functions now get
pointer to rdesc.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2c6118e4 04-Oct-2010 Hendrik Iben <Hendrik_Iben@web.de>

HID: force feedback support for Logitech RumblePad gamepad

This patch adds force feedback support for Logitech WingMan RumblePad
gamepads by extending the Logitech Rumblepad 2 force feedback code.

Signed-off-by: Hendrik Iben <Hendrik_Iben@web.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 32c88cbc 22-Sep-2010 Simon Wood <simon@mungewell.org>

HID: Add support for Logitech Speed Force Wireless gaming wheel

The following patch adds support for the Logitech Speed Force Wireless gaming
wheel. Originally designed for the WII console. Details on the protocol:

http://wiibrew.org/wiki/Logitech_USB_steering_wheel

This patch relies on previous patch:
"Don't Send Feature Reports on Interrupt Endpoint"

Logitech as produce a very similar wheel for the PS2/PS3, it is expected that
this patch could also support the PS2/PS3 wheel if the USB ID's are added and
(if required) the HID descriptor is modified.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 73e4008d 06-Aug-2010 Nikolai Kondrashov <spbnick@gmail.com>

HID: allow resizing and replacing report descriptors

Update hid_driver's report_fixup prototype to allow changing report
descriptor size and/or returning completely different report descriptor.
Update existing usage accordingly.

This is to give more freedom in descriptor fixup and to allow having a whole
fixed descriptor in the code for the sake of readability.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 18392212 16-Apr-2010 Lorenzo Castelli <lcastelli@gmail.com>

HID: add mappings for a few keys found on Logitech MX3200

The keys are added to the generic wireless mappings in case other
keyboards use them. Note that the product ID for the MX3200 is the same
as USB_DEVICE_ID_S510_RECEIVER_2.

Signed-off-by: Lorenzo Castelli <lcastelli@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 74f292ca 12-Jan-2010 Gary Stein <LordCnidarian@gmail.com>

HID: add driver for the Logitech Flight System G940

Implements a new USB-HID for Force Feedback based on the normal
Logitech Force Feedback code and FF-Memless.

Currently only supports the FF_CONSTANT effect although the joystick
appears to support additional non-standard ones.

Signed-off-by: Gary Stein <LordCnidarian@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 66d61bec 24-Nov-2009 Jiri Kosina <jkosina@suse.cz>

HID: make Media key on Logitech DiNovo Mini work

Put proper mapping of Media key on Logitech DiNovo Mini.

According to the specification from Logitech webpage, this
key is intended to launch a Media center.

Reported-by: Stefan Plattner <Stefan.Plattner@ilogs.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 24985cf6 13-Nov-2009 Jiri Kosina <jkosina@suse.cz>

HID: support Logitech/3DConnexion SpaceTraveler and SpaceNavigator

These devices wrongly report their axes as relative instead of absolute.

Fix this in up report descriptor of the device before it enters the parser.

Reported-by: simon.windows@gmail.com
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a24f423b 02-Jul-2009 Peter Huewe <peterhuewe@gmx.de>

HID: adding __init/__exit macros to module init/exit functions

Trivial patch which adds the __init and __exit macros to the module_init /
module_exit functions of several HID drivers from drivers/hid/

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# fd30ea8c 22-Jun-2009 Jiri Kosina <jkosina@suse.cz>

HID: add force feedback support for Logitech WingMan Formula Force GP

Add force feedback support for Logitech WingMan Formula Force GP
(0x046d/0xc293).

Reported-by: wylda@volny.cz
Tested-by: wylda@volny.cz
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 243b706d 17-Apr-2009 Christophe Borivant <christophe.borivant@wanadoo.fr>

HID: Add support for the G25 force feedback wheel in native mode

Add Product Id 0xc299 for the Logitech G25 force feedback wheel
The Logitech G25 force feedback wheel, is first recognize by the kernel
with the product id "0xc294". In this mode, we can't use all the axes
and buttons of the wheel.

Using a userland utility, it is possible to make the wheel switch to native
mode -- http://svn.vdrift.net/viewvc.cgi/trunk/tools/G25manage/?root=VDrift
In native mode, the wheel change its id number to "0xc299".

The packet that needs to be sent to the wheel to swtich to native mode and
change its PID is

{ 0xf8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 }

Signed-off-by: Christophe Borivant <christophe.borivant@wanadoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# afa5eb7c 18-Mar-2009 Jiri Slaby <jirislaby@kernel.org>

HID: remove compat stuff

This removal was scheduled and there is no problem with later
distros to adapt for the new bus, thanks to aliases.

module-init-tools map files are deprecated nowadays, so that
the patch which introduced hid ones into the m-i-t won't be
accepted and hence there is no reason for leaving compat stuff in.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 08ef08ee 30-Oct-2008 Alan Stern <stern@rowland.harvard.edu>

HID: automatically call usbhid_set_leds in usbhid driver

This patch (as1146c) makes usbhid automatically call usbhid_set_leds()
for any device that supports the keyboard boot protocol.

In theory this should be perfectly safe. BIOSes send the LED output
report as part of their normal device initialization, so any keyboard
device supporting the boot protocol has to be able to handle it.

As a side effect, the hid-dell and hid-bright drivers are no longer
needed, and the Logitech keyboard driver can be removed from hid-lg.

CC: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 022b7024 17-Oct-2008 Dan Nicholson <dbn.lists@gmail.com>

Revert "HID: Invert HWHEEL mappings for some Logitech mice"

This reverts commit 740f370dc61dc478d891d7d47660bb3ae39ddb4f.

It turned out to be correct in the first place: a positive value should
be sent when the wheel is moved to the right, and a negative value when
moved to the left. This is the behavior expected by the Xorg evdev
driver. I must have had a remapping somewhere else in my system when
originally testing this. Testing on another system shows that the
unpatched kernel is correct.

Here is a bug report from Mandriva that brought the problem to my
attention:

https://qa.mandriva.com/show_bug.cgi?id=44309#c19

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 606bd0a8 04-Jul-2008 Jiri Slaby <jirislaby@kernel.org>

HID: move logitech FF processing

Merge the logitech force feedback processing directly into logitech
driver from the usbhid core.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>