aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Wood <gitsend@mungewell.org>2016-09-18 12:55:41 -0400
committerJiri Kosina <jkosina@suse.cz>2016-09-26 09:39:56 -0400
commit560bea30ff9dd4823d8f611aaab88d3c3f9c7d8d (patch)
tree7fa65a362c9eebd448169148b7dd82c273aaa468
parent7363b25af33251d036a4bedb7daed1e6bc395142 (diff)
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>
-rw-r--r--drivers/hid/hid-lg.c59
-rw-r--r--drivers/hid/hid-lg4ff.c2
2 files changed, 60 insertions, 1 deletions
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index ffcf4f162ea5..76f644deb0a7 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -49,6 +49,7 @@
49#define FV_RDESC_ORIG_SIZE 130 49#define FV_RDESC_ORIG_SIZE 130
50#define MOMO_RDESC_ORIG_SIZE 87 50#define MOMO_RDESC_ORIG_SIZE 87
51#define MOMO2_RDESC_ORIG_SIZE 87 51#define MOMO2_RDESC_ORIG_SIZE 87
52#define FFG_RDESC_ORIG_SIZE 85
52 53
53/* Fixed report descriptors for Logitech Driving Force (and Pro) 54/* Fixed report descriptors for Logitech Driving Force (and Pro)
54 * wheel controllers 55 * wheel controllers
@@ -334,6 +335,52 @@ static __u8 momo2_rdesc_fixed[] = {
3340xC0 /* End Collection */ 3350xC0 /* End Collection */
335}; 336};
336 337
338static __u8 ffg_rdesc_fixed[] = {
3390x05, 0x01, /* Usage Page (Desktop), */
3400x09, 0x04, /* Usage (Joystik), */
3410xA1, 0x01, /* Collection (Application), */
3420xA1, 0x02, /* Collection (Logical), */
3430x95, 0x01, /* Report Count (1), */
3440x75, 0x0A, /* Report Size (10), */
3450x15, 0x00, /* Logical Minimum (0), */
3460x26, 0xFF, 0x03, /* Logical Maximum (1023), */
3470x35, 0x00, /* Physical Minimum (0), */
3480x46, 0xFF, 0x03, /* Physical Maximum (1023), */
3490x09, 0x30, /* Usage (X), */
3500x81, 0x02, /* Input (Variable), */
3510x95, 0x06, /* Report Count (6), */
3520x75, 0x01, /* Report Size (1), */
3530x25, 0x01, /* Logical Maximum (1), */
3540x45, 0x01, /* Physical Maximum (1), */
3550x05, 0x09, /* Usage Page (Button), */
3560x19, 0x01, /* Usage Minimum (01h), */
3570x29, 0x06, /* Usage Maximum (06h), */
3580x81, 0x02, /* Input (Variable), */
3590x95, 0x01, /* Report Count (1), */
3600x75, 0x08, /* Report Size (8), */
3610x26, 0xFF, 0x00, /* Logical Maximum (255), */
3620x46, 0xFF, 0x00, /* Physical Maximum (255), */
3630x06, 0x00, 0xFF, /* Usage Page (FF00h), */
3640x09, 0x01, /* Usage (01h), */
3650x81, 0x02, /* Input (Variable), */
3660x05, 0x01, /* Usage Page (Desktop), */
3670x81, 0x01, /* Input (Constant), */
3680x09, 0x31, /* Usage (Y), */
3690x81, 0x02, /* Input (Variable), */
3700x09, 0x32, /* Usage (Z), */
3710x81, 0x02, /* Input (Variable), */
3720x06, 0x00, 0xFF, /* Usage Page (FF00h), */
3730x09, 0x01, /* Usage (01h), */
3740x81, 0x02, /* Input (Variable), */
3750xC0, /* End Collection, */
3760xA1, 0x02, /* Collection (Logical), */
3770x09, 0x02, /* Usage (02h), */
3780x95, 0x07, /* Report Count (7), */
3790x91, 0x02, /* Output (Variable), */
3800xC0, /* End Collection, */
3810xC0 /* End Collection */
382};
383
337/* 384/*
338 * Certain Logitech keyboards send in report #3 keys which are far 385 * Certain Logitech keyboards send in report #3 keys which are far
339 * above the logical maximum described in descriptor. This extends 386 * above the logical maximum described in descriptor. This extends
@@ -361,6 +408,15 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
361 408
362 switch (hdev->product) { 409 switch (hdev->product) {
363 410
411 case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
412 if (*rsize == FFG_RDESC_ORIG_SIZE) {
413 hid_info(hdev,
414 "fixing up Logitech Wingman Formula Force GP report descriptor\n");
415 rdesc = ffg_rdesc_fixed;
416 *rsize = sizeof(ffg_rdesc_fixed);
417 }
418 break;
419
364 /* Several wheels report as this id when operating in emulation mode. */ 420 /* Several wheels report as this id when operating in emulation mode. */
365 case USB_DEVICE_ID_LOGITECH_WHEEL: 421 case USB_DEVICE_ID_LOGITECH_WHEEL:
366 if (*rsize == DF_RDESC_ORIG_SIZE) { 422 if (*rsize == DF_RDESC_ORIG_SIZE) {
@@ -608,6 +664,7 @@ static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
608 usage->code == ABS_RZ)) { 664 usage->code == ABS_RZ)) {
609 switch (hdev->product) { 665 switch (hdev->product) {
610 case USB_DEVICE_ID_LOGITECH_G29_WHEEL: 666 case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
667 case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
611 case USB_DEVICE_ID_LOGITECH_WHEEL: 668 case USB_DEVICE_ID_LOGITECH_WHEEL:
612 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: 669 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
613 case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: 670 case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
@@ -807,7 +864,7 @@ static const struct hid_device_id lg_devices[] = {
807 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL), 864 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
808 .driver_data = LG_FF4 }, 865 .driver_data = LG_FF4 },
809 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG), 866 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG),
810 .driver_data = LG_FF }, 867 .driver_data = LG_NOGET | LG_FF4 },
811 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), 868 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
812 .driver_data = LG_FF2 }, 869 .driver_data = LG_FF2 },
813 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), 870 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index cc5c9ebd12a1..1fc12e357035 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -137,6 +137,7 @@ struct lg4ff_alternate_mode {
137}; 137};
138 138
139static const struct lg4ff_wheel lg4ff_devices[] = { 139static const struct lg4ff_wheel lg4ff_devices[] = {
140 {USB_DEVICE_ID_LOGITECH_WINGMAN_FFG, lg4ff_wheel_effects, 40, 180, NULL},
140 {USB_DEVICE_ID_LOGITECH_WHEEL, lg4ff_wheel_effects, 40, 270, NULL}, 141 {USB_DEVICE_ID_LOGITECH_WHEEL, lg4ff_wheel_effects, 40, 270, NULL},
141 {USB_DEVICE_ID_LOGITECH_MOMO_WHEEL, lg4ff_wheel_effects, 40, 270, NULL}, 142 {USB_DEVICE_ID_LOGITECH_MOMO_WHEEL, lg4ff_wheel_effects, 40, 270, NULL},
142 {USB_DEVICE_ID_LOGITECH_DFP_WHEEL, lg4ff_wheel_effects, 40, 900, lg4ff_set_range_dfp}, 143 {USB_DEVICE_ID_LOGITECH_DFP_WHEEL, lg4ff_wheel_effects, 40, 900, lg4ff_set_range_dfp},
@@ -345,6 +346,7 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report,
345 rd[5] = rd[3]; 346 rd[5] = rd[3];
346 rd[6] = 0x7F; 347 rd[6] = 0x7F;
347 return 1; 348 return 1;
349 case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
348 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: 350 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
349 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: 351 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
350 rd[4] = rd[3]; 352 rd[4] = rd[3];