summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-lg.c
diff options
context:
space:
mode:
authorJarrad Whitaker <jarrad.whitaker@gmail.com>2019-01-24 22:40:50 +1100
committerJiri Kosina <jkosina@suse.cz>2019-02-14 00:21:29 +0100
commite41b3cdafed777f8e927db01c2fab5ae9c95055c (patch)
tree9855bf29f20d07e233fc6023fd38a881794535c0 /drivers/hid/hid-lg.c
parentd47e3da1759230e394096fd742aad423c291ba48 (diff)
downloadlinux-e41b3cdafed777f8e927db01c2fab5ae9c95055c.tar.bz2
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>
Diffstat (limited to 'drivers/hid/hid-lg.c')
-rw-r--r--drivers/hid/hid-lg.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 596227ddb6e0..5d419a95b6c2 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -50,6 +50,7 @@
#define MOMO_RDESC_ORIG_SIZE 87
#define MOMO2_RDESC_ORIG_SIZE 87
#define FFG_RDESC_ORIG_SIZE 85
+#define FG_RDESC_ORIG_SIZE 82
/* Fixed report descriptors for Logitech Driving Force (and Pro)
* wheel controllers
@@ -381,6 +382,49 @@ static __u8 ffg_rdesc_fixed[] = {
0xC0 /* End Collection */
};
+static __u8 fg_rdesc_fixed[] = {
+0x05, 0x01, /* Usage Page (Desktop), */
+0x09, 0x04, /* Usage (Joystik), */
+0xA1, 0x01, /* Collection (Application), */
+0xA1, 0x02, /* Collection (Logical), */
+0x15, 0x00, /* Logical Minimum (0), */
+0x26, 0xFF, 0x00, /* Logical Maximum (255), */
+0x35, 0x00, /* Physical Minimum (0), */
+0x46, 0xFF, 0x00, /* Physical Maximum (255), */
+0x75, 0x08, /* Report Size (8), */
+0x95, 0x01, /* Report Count (1), */
+0x09, 0x30, /* Usage (X), */
+0x81, 0x02, /* Input (Variable), */
+0xA4, /* Push, */
+0x25, 0x01, /* Logical Maximum (1), */
+0x45, 0x01, /* Physical Maximum (1), */
+0x75, 0x01, /* Report Size (1), */
+0x95, 0x02, /* Report Count (2), */
+0x81, 0x01, /* Input (Constant), */
+0x95, 0x06, /* Report Count (6), */
+0x05, 0x09, /* Usage Page (Button), */
+0x19, 0x01, /* Usage Minimum (01h), */
+0x29, 0x06, /* Usage Maximum (06h), */
+0x81, 0x02, /* Input (Variable), */
+0x05, 0x01, /* Usage Page (Desktop), */
+0xB4, /* Pop, */
+0x81, 0x02, /* Input (Constant), */
+0x09, 0x31, /* Usage (Y), */
+0x81, 0x02, /* Input (Variable), */
+0x09, 0x32, /* Usage (Z), */
+0x81, 0x02, /* Input (Variable), */
+0xC0, /* End Collection, */
+0xA1, 0x02, /* Collection (Logical), */
+0x26, 0xFF, 0x00, /* Logical Maximum (255), */
+0x46, 0xFF, 0x00, /* Physical Maximum (255), */
+0x75, 0x08, /* Report Size (8), */
+0x95, 0x04, /* Report Count (4), */
+0x09, 0x02, /* Usage (02h), */
+0xB1, 0x02, /* Feature (Variable), */
+0xC0, /* End Collection, */
+0xC0 /* End Collection, */
+};
+
/*
* Certain Logitech keyboards send in report #3 keys which are far
* above the logical maximum described in descriptor. This extends
@@ -408,6 +452,19 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
switch (hdev->product) {
+ case USB_DEVICE_ID_LOGITECH_WINGMAN_FG:
+ if (*rsize == FG_RDESC_ORIG_SIZE) {
+ hid_info(hdev,
+ "fixing up Logitech Wingman Formula GP report descriptor\n");
+ rdesc = fg_rdesc_fixed;
+ *rsize = sizeof(fg_rdesc_fixed);
+ } else {
+ hid_info(hdev,
+ "rdesc size test failed for formula gp\n");
+ }
+ break;
+
+
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
if (*rsize == FFG_RDESC_ORIG_SIZE) {
hid_info(hdev,
@@ -664,6 +721,7 @@ static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
usage->code == ABS_RZ)) {
switch (hdev->product) {
case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
+ case USB_DEVICE_ID_LOGITECH_WINGMAN_FG:
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
case USB_DEVICE_ID_LOGITECH_WHEEL:
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
@@ -871,6 +929,8 @@ static const struct hid_device_id lg_devices[] = {
.driver_data = LG_NOGET | LG_FF4 },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
.driver_data = LG_FF4 },
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FG),
+ .driver_data = LG_NOGET },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG),
.driver_data = LG_NOGET | LG_FF4 },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),