aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-lg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-lg.c')
-rw-r--r--drivers/hid/hid-lg.c74
1 files changed, 73 insertions, 1 deletions
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 21f205f09250..a7f916e8fc32 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -41,6 +41,66 @@
41#define LG_FF3 0x1000 41#define LG_FF3 0x1000
42#define LG_FF4 0x2000 42#define LG_FF4 0x2000
43 43
44/* Size of the original descriptor of the Driving Force Pro wheel */
45#define DFP_RDESC_ORIG_SIZE 97
46
47/* Fixed report descriptor for Logitech Driving Force Pro wheel controller
48 *
49 * The original descriptor hides the separate throttle and brake axes in
50 * a custom vendor usage page, providing only a combined value as
51 * GenericDesktop.Y.
52 * This descriptor removes the combined Y axis and instead reports
53 * separate throttle (Y) and brake (RZ).
54 */
55static __u8 dfp_rdesc_fixed[] = {
560x05, 0x01, /* Usage Page (Desktop), */
570x09, 0x04, /* Usage (Joystik), */
580xA1, 0x01, /* Collection (Application), */
590xA1, 0x02, /* Collection (Logical), */
600x95, 0x01, /* Report Count (1), */
610x75, 0x0E, /* Report Size (14), */
620x14, /* Logical Minimum (0), */
630x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
640x34, /* Physical Minimum (0), */
650x46, 0xFF, 0x3F, /* Physical Maximum (16383), */
660x09, 0x30, /* Usage (X), */
670x81, 0x02, /* Input (Variable), */
680x95, 0x0E, /* Report Count (14), */
690x75, 0x01, /* Report Size (1), */
700x25, 0x01, /* Logical Maximum (1), */
710x45, 0x01, /* Physical Maximum (1), */
720x05, 0x09, /* Usage Page (Button), */
730x19, 0x01, /* Usage Minimum (01h), */
740x29, 0x0E, /* Usage Maximum (0Eh), */
750x81, 0x02, /* Input (Variable), */
760x05, 0x01, /* Usage Page (Desktop), */
770x95, 0x01, /* Report Count (1), */
780x75, 0x04, /* Report Size (4), */
790x25, 0x07, /* Logical Maximum (7), */
800x46, 0x3B, 0x01, /* Physical Maximum (315), */
810x65, 0x14, /* Unit (Degrees), */
820x09, 0x39, /* Usage (Hat Switch), */
830x81, 0x42, /* Input (Variable, Nullstate), */
840x65, 0x00, /* Unit, */
850x26, 0xFF, 0x00, /* Logical Maximum (255), */
860x46, 0xFF, 0x00, /* Physical Maximum (255), */
870x75, 0x08, /* Report Size (8), */
880x81, 0x01, /* Input (Constant), */
890x09, 0x31, /* Usage (Y), */
900x81, 0x02, /* Input (Variable), */
910x09, 0x35, /* Usage (Rz), */
920x81, 0x02, /* Input (Variable), */
930x81, 0x01, /* Input (Constant), */
940xC0, /* End Collection, */
950xA1, 0x02, /* Collection (Logical), */
960x09, 0x02, /* Usage (02h), */
970x95, 0x07, /* Report Count (7), */
980x91, 0x02, /* Output (Variable), */
990xC0, /* End Collection, */
1000xC0 /* End Collection */
101};
102
103
44/* 104/*
45 * Certain Logitech keyboards send in report #3 keys which are far 105 * Certain Logitech keyboards send in report #3 keys which are far
46 * above the logical maximum described in descriptor. This extends 106 * above the logical maximum described in descriptor. This extends
@@ -74,6 +134,18 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
74 rdesc[47] = 0x95; 134 rdesc[47] = 0x95;
75 rdesc[48] = 0x0B; 135 rdesc[48] = 0x0B;
76 } 136 }
137
138 switch (hdev->product) {
139 case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
140 if (*rsize == DFP_RDESC_ORIG_SIZE) {
141 hid_info(hdev,
142 "fixing up Logitech Driving Force Pro report descriptor\n");
143 rdesc = dfp_rdesc_fixed;
144 *rsize = sizeof(dfp_rdesc_fixed);
145 }
146 break;
147 }
148
77 return rdesc; 149 return rdesc;
78} 150}
79 151
@@ -380,7 +452,7 @@ static const struct hid_device_id lg_devices[] = {
380 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL), 452 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL),
381 .driver_data = LG_FF }, 453 .driver_data = LG_FF },
382 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL), 454 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL),
383 .driver_data = LG_FF }, 455 .driver_data = LG_NOGET | LG_FF },
384 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL), 456 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
385 .driver_data = LG_FF4 }, 457 .driver_data = LG_FF4 },
386 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ), 458 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ),