hid-lg.c (7363b25af33251d036a4bedb7daed1e6bc395142) hid-lg.c (560bea30ff9dd4823d8f611aaab88d3c3f9c7d8d)
1/*
2 * HID driver for some logitech "special" devices
3 *
4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2008 Jiri Slaby

--- 35 unchanged lines hidden (view full) ---

44#define LG_FF4 0x2000
45
46/* Size of the original descriptors of the Driving Force (and Pro) wheels */
47#define DF_RDESC_ORIG_SIZE 130
48#define DFP_RDESC_ORIG_SIZE 97
49#define FV_RDESC_ORIG_SIZE 130
50#define MOMO_RDESC_ORIG_SIZE 87
51#define MOMO2_RDESC_ORIG_SIZE 87
1/*
2 * HID driver for some logitech "special" devices
3 *
4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2008 Jiri Slaby

--- 35 unchanged lines hidden (view full) ---

44#define LG_FF4 0x2000
45
46/* Size of the original descriptors of the Driving Force (and Pro) wheels */
47#define DF_RDESC_ORIG_SIZE 130
48#define DFP_RDESC_ORIG_SIZE 97
49#define FV_RDESC_ORIG_SIZE 130
50#define MOMO_RDESC_ORIG_SIZE 87
51#define MOMO2_RDESC_ORIG_SIZE 87
52#define FFG_RDESC_ORIG_SIZE 85
52
53/* Fixed report descriptors for Logitech Driving Force (and Pro)
54 * wheel controllers
55 *
56 * The original descriptors hide the separate throttle and brake axes in
57 * a custom vendor usage page, providing only a combined value as
58 * GenericDesktop.Y.
59 * These descriptors remove the combined Y axis and instead report

--- 269 unchanged lines hidden (view full) ---

3290xA1, 0x02, /* Collection (Logical), */
3300x09, 0x02, /* Usage (02h), */
3310x95, 0x07, /* Report Count (7), */
3320x91, 0x02, /* Output (Variable), */
3330xC0, /* End Collection, */
3340xC0 /* End Collection */
335};
336
53
54/* Fixed report descriptors for Logitech Driving Force (and Pro)
55 * wheel controllers
56 *
57 * The original descriptors hide the separate throttle and brake axes in
58 * a custom vendor usage page, providing only a combined value as
59 * GenericDesktop.Y.
60 * These descriptors remove the combined Y axis and instead report

--- 269 unchanged lines hidden (view full) ---

3300xA1, 0x02, /* Collection (Logical), */
3310x09, 0x02, /* Usage (02h), */
3320x95, 0x07, /* Report Count (7), */
3330x91, 0x02, /* Output (Variable), */
3340xC0, /* End Collection, */
3350xC0 /* End Collection */
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/*
338 * Certain Logitech keyboards send in report #3 keys which are far
339 * above the logical maximum described in descriptor. This extends
340 * the original value of 0x28c of logical maximum to 0x104d
341 */
342static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
343 unsigned int *rsize)
344{

--- 11 unchanged lines hidden (view full) ---

356 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
357 hid_info(hdev,
358 "fixing up rel/abs in Logitech report descriptor\n");
359 rdesc[33] = rdesc[50] = 0x02;
360 }
361
362 switch (hdev->product) {
363
384/*
385 * Certain Logitech keyboards send in report #3 keys which are far
386 * above the logical maximum described in descriptor. This extends
387 * the original value of 0x28c of logical maximum to 0x104d
388 */
389static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
390 unsigned int *rsize)
391{

--- 11 unchanged lines hidden (view full) ---

403 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
404 hid_info(hdev,
405 "fixing up rel/abs in Logitech report descriptor\n");
406 rdesc[33] = rdesc[50] = 0x02;
407 }
408
409 switch (hdev->product) {
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. */
365 case USB_DEVICE_ID_LOGITECH_WHEEL:
366 if (*rsize == DF_RDESC_ORIG_SIZE) {
367 hid_info(hdev,
368 "fixing up Logitech Driving Force report descriptor\n");
369 rdesc = df_rdesc_fixed;
370 *rsize = sizeof(df_rdesc_fixed);
371 }

--- 231 unchanged lines hidden (view full) ---

603 clear_bit(usage->code, *bit);
604
605 /* Ensure that Logitech wheels are not given a default fuzz/flat value */
606 if (usage->type == EV_ABS && (usage->code == ABS_X ||
607 usage->code == ABS_Y || usage->code == ABS_Z ||
608 usage->code == ABS_RZ)) {
609 switch (hdev->product) {
610 case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
420 /* Several wheels report as this id when operating in emulation mode. */
421 case USB_DEVICE_ID_LOGITECH_WHEEL:
422 if (*rsize == DF_RDESC_ORIG_SIZE) {
423 hid_info(hdev,
424 "fixing up Logitech Driving Force report descriptor\n");
425 rdesc = df_rdesc_fixed;
426 *rsize = sizeof(df_rdesc_fixed);
427 }

--- 231 unchanged lines hidden (view full) ---

659 clear_bit(usage->code, *bit);
660
661 /* Ensure that Logitech wheels are not given a default fuzz/flat value */
662 if (usage->type == EV_ABS && (usage->code == ABS_X ||
663 usage->code == ABS_Y || usage->code == ABS_Z ||
664 usage->code == ABS_RZ)) {
665 switch (hdev->product) {
666 case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
667 case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
611 case USB_DEVICE_ID_LOGITECH_WHEEL:
612 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
613 case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
614 case USB_DEVICE_ID_LOGITECH_G25_WHEEL:
615 case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL:
616 case USB_DEVICE_ID_LOGITECH_G27_WHEEL:
617 case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
618 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:

--- 183 unchanged lines hidden (view full) ---

802 .driver_data = LG_FF4 },
803 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL),
804 .driver_data = LG_FF4 },
805 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL),
806 .driver_data = LG_NOGET | LG_FF4 },
807 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
808 .driver_data = LG_FF4 },
809 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG),
668 case USB_DEVICE_ID_LOGITECH_WHEEL:
669 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
670 case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
671 case USB_DEVICE_ID_LOGITECH_G25_WHEEL:
672 case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL:
673 case USB_DEVICE_ID_LOGITECH_G27_WHEEL:
674 case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
675 case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:

--- 183 unchanged lines hidden (view full) ---

859 .driver_data = LG_FF4 },
860 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL),
861 .driver_data = LG_FF4 },
862 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL),
863 .driver_data = LG_NOGET | LG_FF4 },
864 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
865 .driver_data = LG_FF4 },
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),
812 .driver_data = LG_FF2 },
813 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
814 .driver_data = LG_FF3 },
815 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
816 .driver_data = LG_RDESC_REL_ABS },
817 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER),
818 .driver_data = LG_RDESC_REL_ABS },

--- 25 unchanged lines hidden ---
868 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
869 .driver_data = LG_FF2 },
870 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
871 .driver_data = LG_FF3 },
872 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
873 .driver_data = LG_RDESC_REL_ABS },
874 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER),
875 .driver_data = LG_RDESC_REL_ABS },

--- 25 unchanged lines hidden ---