Skip to content

Commit 560bea3

Browse files
Simon WoodJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 7363b25 commit 560bea3

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

drivers/hid/hid-lg.c

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#define FV_RDESC_ORIG_SIZE 130
5050
#define MOMO_RDESC_ORIG_SIZE 87
5151
#define MOMO2_RDESC_ORIG_SIZE 87
52+
#define FFG_RDESC_ORIG_SIZE 85
5253

5354
/* Fixed report descriptors for Logitech Driving Force (and Pro)
5455
* wheel controllers
@@ -334,6 +335,52 @@ static __u8 momo2_rdesc_fixed[] = {
334335
0xC0 /* End Collection */
335336
};
336337

338+
static __u8 ffg_rdesc_fixed[] = {
339+
0x05, 0x01, /* Usage Page (Desktop), */
340+
0x09, 0x04, /* Usage (Joystik), */
341+
0xA1, 0x01, /* Collection (Application), */
342+
0xA1, 0x02, /* Collection (Logical), */
343+
0x95, 0x01, /* Report Count (1), */
344+
0x75, 0x0A, /* Report Size (10), */
345+
0x15, 0x00, /* Logical Minimum (0), */
346+
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
347+
0x35, 0x00, /* Physical Minimum (0), */
348+
0x46, 0xFF, 0x03, /* Physical Maximum (1023), */
349+
0x09, 0x30, /* Usage (X), */
350+
0x81, 0x02, /* Input (Variable), */
351+
0x95, 0x06, /* Report Count (6), */
352+
0x75, 0x01, /* Report Size (1), */
353+
0x25, 0x01, /* Logical Maximum (1), */
354+
0x45, 0x01, /* Physical Maximum (1), */
355+
0x05, 0x09, /* Usage Page (Button), */
356+
0x19, 0x01, /* Usage Minimum (01h), */
357+
0x29, 0x06, /* Usage Maximum (06h), */
358+
0x81, 0x02, /* Input (Variable), */
359+
0x95, 0x01, /* Report Count (1), */
360+
0x75, 0x08, /* Report Size (8), */
361+
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
362+
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
363+
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
364+
0x09, 0x01, /* Usage (01h), */
365+
0x81, 0x02, /* Input (Variable), */
366+
0x05, 0x01, /* Usage Page (Desktop), */
367+
0x81, 0x01, /* Input (Constant), */
368+
0x09, 0x31, /* Usage (Y), */
369+
0x81, 0x02, /* Input (Variable), */
370+
0x09, 0x32, /* Usage (Z), */
371+
0x81, 0x02, /* Input (Variable), */
372+
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
373+
0x09, 0x01, /* Usage (01h), */
374+
0x81, 0x02, /* Input (Variable), */
375+
0xC0, /* End Collection, */
376+
0xA1, 0x02, /* Collection (Logical), */
377+
0x09, 0x02, /* Usage (02h), */
378+
0x95, 0x07, /* Report Count (7), */
379+
0x91, 0x02, /* Output (Variable), */
380+
0xC0, /* End Collection, */
381+
0xC0 /* End Collection */
382+
};
383+
337384
/*
338385
* Certain Logitech keyboards send in report #3 keys which are far
339386
* above the logical maximum described in descriptor. This extends
@@ -361,6 +408,15 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
361408

362409
switch (hdev->product) {
363410

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+
364420
/* Several wheels report as this id when operating in emulation mode. */
365421
case USB_DEVICE_ID_LOGITECH_WHEEL:
366422
if (*rsize == DF_RDESC_ORIG_SIZE) {
@@ -608,6 +664,7 @@ static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
608664
usage->code == ABS_RZ)) {
609665
switch (hdev->product) {
610666
case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
667+
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
611668
case USB_DEVICE_ID_LOGITECH_WHEEL:
612669
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
613670
case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
@@ -807,7 +864,7 @@ static const struct hid_device_id lg_devices[] = {
807864
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
808865
.driver_data = LG_FF4 },
809866
{ 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 },
811868
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
812869
.driver_data = LG_FF2 },
813870
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),

drivers/hid/hid-lg4ff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ struct lg4ff_alternate_mode {
137137
};
138138

139139
static const struct lg4ff_wheel lg4ff_devices[] = {
140+
{USB_DEVICE_ID_LOGITECH_WINGMAN_FFG, lg4ff_wheel_effects, 40, 180, NULL},
140141
{USB_DEVICE_ID_LOGITECH_WHEEL, lg4ff_wheel_effects, 40, 270, NULL},
141142
{USB_DEVICE_ID_LOGITECH_MOMO_WHEEL, lg4ff_wheel_effects, 40, 270, NULL},
142143
{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,
345346
rd[5] = rd[3];
346347
rd[6] = 0x7F;
347348
return 1;
349+
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
348350
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
349351
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
350352
rd[4] = rd[3];

0 commit comments

Comments
 (0)