2019-05-27 14:55:01 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2008-05-16 17:49:19 +08:00
|
|
|
/*
|
|
|
|
* HID driver for some logitech "special" devices
|
|
|
|
*
|
|
|
|
* Copyright (c) 1999 Andreas Gal
|
|
|
|
* Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
|
|
|
|
* Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
|
|
|
|
* Copyright (c) 2006-2007 Jiri Kosina
|
|
|
|
* Copyright (c) 2008 Jiri Slaby
|
2010-10-04 21:39:49 +08:00
|
|
|
* Copyright (c) 2010 Hendrik Iben
|
2008-05-16 17:49:19 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/hid.h>
|
|
|
|
#include <linux/module.h>
|
2010-09-22 19:19:42 +08:00
|
|
|
#include <linux/random.h>
|
|
|
|
#include <linux/sched.h>
|
2013-02-18 01:53:13 +08:00
|
|
|
#include <linux/usb.h>
|
2010-09-22 19:19:42 +08:00
|
|
|
#include <linux/wait.h>
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2013-02-18 01:53:13 +08:00
|
|
|
#include "usbhid/usbhid.h"
|
2008-05-16 17:49:19 +08:00
|
|
|
#include "hid-ids.h"
|
2008-07-05 05:06:45 +08:00
|
|
|
#include "hid-lg.h"
|
2015-02-19 00:59:22 +08:00
|
|
|
#include "hid-lg4ff.h"
|
2008-05-16 17:49:19 +08:00
|
|
|
|
|
|
|
#define LG_RDESC 0x001
|
|
|
|
#define LG_BAD_RELATIVE_KEYS 0x002
|
|
|
|
#define LG_DUPLICATE_USAGES 0x004
|
|
|
|
#define LG_EXPANDED_KEYMAP 0x010
|
|
|
|
#define LG_IGNORE_DOUBLED_WHEEL 0x020
|
|
|
|
#define LG_WIRELESS 0x040
|
|
|
|
#define LG_INVERT_HWHEEL 0x080
|
|
|
|
#define LG_NOGET 0x100
|
2008-07-05 05:06:45 +08:00
|
|
|
#define LG_FF 0x200
|
|
|
|
#define LG_FF2 0x400
|
2009-11-13 17:45:53 +08:00
|
|
|
#define LG_RDESC_REL_ABS 0x800
|
2010-01-13 07:25:58 +08:00
|
|
|
#define LG_FF3 0x1000
|
2010-09-22 19:19:42 +08:00
|
|
|
#define LG_FF4 0x2000
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2013-02-18 01:53:13 +08:00
|
|
|
/* Size of the original descriptors of the Driving Force (and Pro) wheels */
|
|
|
|
#define DF_RDESC_ORIG_SIZE 130
|
2011-06-03 06:40:14 +08:00
|
|
|
#define DFP_RDESC_ORIG_SIZE 97
|
2013-10-10 22:20:12 +08:00
|
|
|
#define FV_RDESC_ORIG_SIZE 130
|
2013-02-20 11:25:10 +08:00
|
|
|
#define MOMO_RDESC_ORIG_SIZE 87
|
2013-10-10 22:20:13 +08:00
|
|
|
#define MOMO2_RDESC_ORIG_SIZE 87
|
2016-09-19 00:55:41 +08:00
|
|
|
#define FFG_RDESC_ORIG_SIZE 85
|
2019-01-24 19:40:50 +08:00
|
|
|
#define FG_RDESC_ORIG_SIZE 82
|
2011-06-03 06:40:14 +08:00
|
|
|
|
2013-02-18 01:53:13 +08:00
|
|
|
/* Fixed report descriptors for Logitech Driving Force (and Pro)
|
|
|
|
* wheel controllers
|
2011-06-03 06:40:14 +08:00
|
|
|
*
|
2013-02-18 01:53:13 +08:00
|
|
|
* The original descriptors hide the separate throttle and brake axes in
|
2011-06-03 06:40:14 +08:00
|
|
|
* a custom vendor usage page, providing only a combined value as
|
|
|
|
* GenericDesktop.Y.
|
2013-02-18 01:53:13 +08:00
|
|
|
* These descriptors remove the combined Y axis and instead report
|
2011-06-03 06:40:14 +08:00
|
|
|
* separate throttle (Y) and brake (RZ).
|
|
|
|
*/
|
2013-02-18 01:53:13 +08:00
|
|
|
static __u8 df_rdesc_fixed[] = {
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
2016-02-09 20:55:04 +08:00
|
|
|
0x09, 0x04, /* Usage (Joystick), */
|
2013-02-18 01:53:13 +08:00
|
|
|
0xA1, 0x01, /* Collection (Application), */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x0A, /* Report Size (10), */
|
|
|
|
0x14, /* Logical Minimum (0), */
|
|
|
|
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
|
|
|
|
0x34, /* Physical Minimum (0), */
|
|
|
|
0x46, 0xFF, 0x03, /* Physical Maximum (1023), */
|
|
|
|
0x09, 0x30, /* Usage (X), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x0C, /* Report Count (12), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x05, 0x09, /* Usage (Buttons), */
|
|
|
|
0x19, 0x01, /* Usage Minimum (1), */
|
|
|
|
0x29, 0x0c, /* Usage Maximum (12), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x02, /* Report Count (2), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (Vendor: 65280), */
|
|
|
|
0x09, 0x01, /* Usage (?: 1), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x25, 0x07, /* Logical Maximum (7), */
|
|
|
|
0x46, 0x3B, 0x01, /* Physical Maximum (315), */
|
|
|
|
0x75, 0x04, /* Report Size (4), */
|
|
|
|
0x65, 0x14, /* Unit (Degrees), */
|
|
|
|
0x09, 0x39, /* Usage (Hat Switch), */
|
|
|
|
0x81, 0x42, /* Input (Variable, Null State), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x95, 0x04, /* Report Count (4), */
|
|
|
|
0x65, 0x00, /* Unit (none), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (Vendor: 65280), */
|
|
|
|
0x09, 0x01, /* Usage (?: 1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
2013-02-18 01:53:14 +08:00
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
2013-02-18 01:53:13 +08:00
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
2013-02-18 01:53:14 +08:00
|
|
|
0x09, 0x31, /* Usage (Y), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x09, 0x35, /* Usage (Rz), */
|
2013-02-18 01:53:13 +08:00
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x95, 0x07, /* Report Count (7), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x09, 0x03, /* Usage (?: 3), */
|
|
|
|
0x91, 0x02, /* Output (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xC0 /* End Collection */
|
|
|
|
};
|
|
|
|
|
2011-06-03 06:40:14 +08:00
|
|
|
static __u8 dfp_rdesc_fixed[] = {
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
2016-02-09 20:55:04 +08:00
|
|
|
0x09, 0x04, /* Usage (Joystick), */
|
2011-06-03 06:40:14 +08:00
|
|
|
0xA1, 0x01, /* Collection (Application), */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x0E, /* Report Size (14), */
|
|
|
|
0x14, /* Logical Minimum (0), */
|
|
|
|
0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
|
|
|
|
0x34, /* Physical Minimum (0), */
|
|
|
|
0x46, 0xFF, 0x3F, /* Physical Maximum (16383), */
|
|
|
|
0x09, 0x30, /* Usage (X), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x0E, /* Report Count (14), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x05, 0x09, /* Usage Page (Button), */
|
|
|
|
0x19, 0x01, /* Usage Minimum (01h), */
|
|
|
|
0x29, 0x0E, /* Usage Maximum (0Eh), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x04, /* Report Size (4), */
|
|
|
|
0x25, 0x07, /* Logical Maximum (7), */
|
|
|
|
0x46, 0x3B, 0x01, /* Physical Maximum (315), */
|
|
|
|
0x65, 0x14, /* Unit (Degrees), */
|
|
|
|
0x09, 0x39, /* Usage (Hat Switch), */
|
|
|
|
0x81, 0x42, /* Input (Variable, Nullstate), */
|
|
|
|
0x65, 0x00, /* Unit, */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x81, 0x01, /* Input (Constant), */
|
|
|
|
0x09, 0x31, /* Usage (Y), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x09, 0x35, /* Usage (Rz), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x81, 0x01, /* Input (Constant), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x09, 0x02, /* Usage (02h), */
|
|
|
|
0x95, 0x07, /* Report Count (7), */
|
|
|
|
0x91, 0x02, /* Output (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xC0 /* End Collection */
|
|
|
|
};
|
|
|
|
|
2013-10-10 22:20:12 +08:00
|
|
|
static __u8 fv_rdesc_fixed[] = {
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
2016-02-09 20:55:04 +08:00
|
|
|
0x09, 0x04, /* Usage (Joystick), */
|
2013-10-10 22:20:12 +08:00
|
|
|
0xA1, 0x01, /* Collection (Application), */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x0A, /* Report Size (10), */
|
|
|
|
0x15, 0x00, /* Logical Minimum (0), */
|
|
|
|
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
|
|
|
|
0x35, 0x00, /* Physical Minimum (0), */
|
|
|
|
0x46, 0xFF, 0x03, /* Physical Maximum (1023), */
|
|
|
|
0x09, 0x30, /* Usage (X), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x0C, /* Report Count (12), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x05, 0x09, /* Usage Page (Button), */
|
|
|
|
0x19, 0x01, /* Usage Minimum (01h), */
|
|
|
|
0x29, 0x0C, /* Usage Maximum (0Ch), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x02, /* Report Count (2), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x01, /* Usage (01h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x09, 0x02, /* Usage (02h), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x25, 0x07, /* Logical Maximum (7), */
|
|
|
|
0x46, 0x3B, 0x01, /* Physical Maximum (315), */
|
|
|
|
0x75, 0x04, /* Report Size (4), */
|
|
|
|
0x65, 0x14, /* Unit (Degrees), */
|
|
|
|
0x09, 0x39, /* Usage (Hat Switch), */
|
|
|
|
0x81, 0x42, /* Input (Variable, Null State), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x95, 0x04, /* Report Count (4), */
|
|
|
|
0x65, 0x00, /* Unit, */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x01, /* Usage (01h), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
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), */
|
|
|
|
0x95, 0x07, /* Report Count (7), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x09, 0x03, /* Usage (03h), */
|
|
|
|
0x91, 0x02, /* Output (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xC0 /* End Collection */
|
|
|
|
};
|
|
|
|
|
2013-02-20 11:25:10 +08:00
|
|
|
static __u8 momo_rdesc_fixed[] = {
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
2016-02-09 20:55:04 +08:00
|
|
|
0x09, 0x04, /* Usage (Joystick), */
|
2013-02-20 11:25:10 +08:00
|
|
|
0xA1, 0x01, /* Collection (Application), */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x0A, /* Report Size (10), */
|
|
|
|
0x15, 0x00, /* Logical Minimum (0), */
|
|
|
|
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
|
|
|
|
0x35, 0x00, /* Physical Minimum (0), */
|
|
|
|
0x46, 0xFF, 0x03, /* Physical Maximum (1023), */
|
|
|
|
0x09, 0x30, /* Usage (X), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x08, /* Report Count (8), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x05, 0x09, /* Usage Page (Button), */
|
|
|
|
0x19, 0x01, /* Usage Minimum (01h), */
|
|
|
|
0x29, 0x08, /* Usage Maximum (08h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x75, 0x0E, /* Report Size (14), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x09, 0x00, /* Usage (00h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x09, 0x31, /* Usage (Y), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x09, 0x32, /* Usage (Z), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x01, /* Usage (01h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x09, 0x02, /* Usage (02h), */
|
|
|
|
0x95, 0x07, /* Report Count (7), */
|
|
|
|
0x91, 0x02, /* Output (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xC0 /* End Collection */
|
|
|
|
};
|
2011-06-03 06:40:14 +08:00
|
|
|
|
2013-10-10 22:20:13 +08:00
|
|
|
static __u8 momo2_rdesc_fixed[] = {
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
2016-02-09 20:55:04 +08:00
|
|
|
0x09, 0x04, /* Usage (Joystick), */
|
2013-10-10 22:20:13 +08:00
|
|
|
0xA1, 0x01, /* Collection (Application), */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x0A, /* Report Size (10), */
|
|
|
|
0x15, 0x00, /* Logical Minimum (0), */
|
|
|
|
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
|
|
|
|
0x35, 0x00, /* Physical Minimum (0), */
|
|
|
|
0x46, 0xFF, 0x03, /* Physical Maximum (1023), */
|
|
|
|
0x09, 0x30, /* Usage (X), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x0A, /* Report Count (10), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x05, 0x09, /* Usage Page (Button), */
|
|
|
|
0x19, 0x01, /* Usage Minimum (01h), */
|
|
|
|
0x29, 0x0A, /* Usage Maximum (0Ah), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x00, /* Usage (00h), */
|
|
|
|
0x95, 0x04, /* Report Count (4), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x09, 0x01, /* Usage (01h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x09, 0x31, /* Usage (Y), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x09, 0x32, /* Usage (Z), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x00, /* Usage (00h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x09, 0x02, /* Usage (02h), */
|
|
|
|
0x95, 0x07, /* Report Count (7), */
|
|
|
|
0x91, 0x02, /* Output (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xC0 /* End Collection */
|
|
|
|
};
|
|
|
|
|
2016-09-19 00:55:41 +08:00
|
|
|
static __u8 ffg_rdesc_fixed[] = {
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x09, 0x04, /* Usage (Joystik), */
|
|
|
|
0xA1, 0x01, /* Collection (Application), */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x0A, /* Report Size (10), */
|
|
|
|
0x15, 0x00, /* Logical Minimum (0), */
|
|
|
|
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
|
|
|
|
0x35, 0x00, /* Physical Minimum (0), */
|
|
|
|
0x46, 0xFF, 0x03, /* Physical Maximum (1023), */
|
|
|
|
0x09, 0x30, /* Usage (X), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x06, /* Report Count (6), */
|
|
|
|
0x75, 0x01, /* Report Size (1), */
|
|
|
|
0x25, 0x01, /* Logical Maximum (1), */
|
|
|
|
0x45, 0x01, /* Physical Maximum (1), */
|
|
|
|
0x05, 0x09, /* Usage Page (Button), */
|
|
|
|
0x19, 0x01, /* Usage Minimum (01h), */
|
|
|
|
0x29, 0x06, /* Usage Maximum (06h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x95, 0x01, /* Report Count (1), */
|
|
|
|
0x75, 0x08, /* Report Size (8), */
|
|
|
|
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
|
|
|
|
0x46, 0xFF, 0x00, /* Physical Maximum (255), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x01, /* Usage (01h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x05, 0x01, /* Usage Page (Desktop), */
|
|
|
|
0x81, 0x01, /* Input (Constant), */
|
|
|
|
0x09, 0x31, /* Usage (Y), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x09, 0x32, /* Usage (Z), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
|
|
|
|
0x09, 0x01, /* Usage (01h), */
|
|
|
|
0x81, 0x02, /* Input (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xA1, 0x02, /* Collection (Logical), */
|
|
|
|
0x09, 0x02, /* Usage (02h), */
|
|
|
|
0x95, 0x07, /* Report Count (7), */
|
|
|
|
0x91, 0x02, /* Output (Variable), */
|
|
|
|
0xC0, /* End Collection, */
|
|
|
|
0xC0 /* End Collection */
|
|
|
|
};
|
|
|
|
|
2019-01-24 19:40:50 +08:00
|
|
|
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, */
|
|
|
|
};
|
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
/*
|
|
|
|
* Certain Logitech keyboards send in report #3 keys which are far
|
|
|
|
* above the logical maximum described in descriptor. This extends
|
|
|
|
* the original value of 0x28c of logical maximum to 0x104d
|
|
|
|
*/
|
2010-08-07 03:03:06 +08:00
|
|
|
static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
|
|
|
|
unsigned int *rsize)
|
2008-05-16 17:49:19 +08:00
|
|
|
{
|
2012-09-13 14:08:32 +08:00
|
|
|
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2014-08-21 22:57:48 +08:00
|
|
|
if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
|
2008-05-16 17:49:19 +08:00
|
|
|
rdesc[84] == 0x8c && rdesc[85] == 0x02) {
|
2010-12-10 11:29:03 +08:00
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech keyboard report descriptor\n");
|
2008-05-16 17:49:19 +08:00
|
|
|
rdesc[84] = rdesc[89] = 0x4d;
|
|
|
|
rdesc[85] = rdesc[90] = 0x10;
|
|
|
|
}
|
2014-08-21 22:57:48 +08:00
|
|
|
if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 &&
|
2009-11-13 17:45:53 +08:00
|
|
|
rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
|
|
|
|
rdesc[49] == 0x81 && rdesc[50] == 0x06) {
|
2010-12-10 11:29:03 +08:00
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up rel/abs in Logitech report descriptor\n");
|
2009-11-13 17:45:53 +08:00
|
|
|
rdesc[33] = rdesc[50] = 0x02;
|
|
|
|
}
|
2011-06-03 06:40:14 +08:00
|
|
|
|
|
|
|
switch (hdev->product) {
|
2013-02-18 01:53:13 +08:00
|
|
|
|
2019-01-24 19:40:50 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
|
2016-09-19 00:55:41 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
|
|
|
|
if (*rsize == FFG_RDESC_ORIG_SIZE) {
|
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech Wingman Formula Force GP report descriptor\n");
|
|
|
|
rdesc = ffg_rdesc_fixed;
|
|
|
|
*rsize = sizeof(ffg_rdesc_fixed);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-02-18 01:53:13 +08:00
|
|
|
/* Several wheels report as this id when operating in emulation mode. */
|
|
|
|
case USB_DEVICE_ID_LOGITECH_WHEEL:
|
2016-09-19 00:55:40 +08:00
|
|
|
if (*rsize == DF_RDESC_ORIG_SIZE) {
|
2013-02-18 01:53:13 +08:00
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech Driving Force report descriptor\n");
|
|
|
|
rdesc = df_rdesc_fixed;
|
|
|
|
*rsize = sizeof(df_rdesc_fixed);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-02-20 11:25:10 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
|
|
|
|
if (*rsize == MOMO_RDESC_ORIG_SIZE) {
|
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech Momo Force (Red) report descriptor\n");
|
|
|
|
rdesc = momo_rdesc_fixed;
|
|
|
|
*rsize = sizeof(momo_rdesc_fixed);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-10-10 22:20:13 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
|
|
|
|
if (*rsize == MOMO2_RDESC_ORIG_SIZE) {
|
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech Momo Racing Force (Black) report descriptor\n");
|
|
|
|
rdesc = momo2_rdesc_fixed;
|
|
|
|
*rsize = sizeof(momo2_rdesc_fixed);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-10-10 22:20:12 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL:
|
|
|
|
if (*rsize == FV_RDESC_ORIG_SIZE) {
|
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech Formula Vibration report descriptor\n");
|
|
|
|
rdesc = fv_rdesc_fixed;
|
|
|
|
*rsize = sizeof(fv_rdesc_fixed);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-06-03 06:40:14 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
|
|
|
|
if (*rsize == DFP_RDESC_ORIG_SIZE) {
|
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up Logitech Driving Force Pro report descriptor\n");
|
|
|
|
rdesc = dfp_rdesc_fixed;
|
|
|
|
*rsize = sizeof(dfp_rdesc_fixed);
|
|
|
|
}
|
|
|
|
break;
|
2013-02-20 11:25:11 +08:00
|
|
|
|
|
|
|
case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
|
|
|
|
if (*rsize >= 101 && rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
|
|
|
|
rdesc[47] == 0x05 && rdesc[48] == 0x09) {
|
|
|
|
hid_info(hdev, "fixing up Logitech Speed Force Wireless report descriptor\n");
|
|
|
|
rdesc[41] = 0x05;
|
|
|
|
rdesc[42] = 0x09;
|
|
|
|
rdesc[47] = 0x95;
|
|
|
|
rdesc[48] = 0x0B;
|
|
|
|
}
|
|
|
|
break;
|
2011-06-03 06:40:14 +08:00
|
|
|
}
|
|
|
|
|
2010-08-07 03:03:06 +08:00
|
|
|
return rdesc;
|
2008-05-16 17:49:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
|
|
|
|
EV_KEY, (c))
|
|
|
|
|
|
|
|
static int lg_ultrax_remote_mapping(struct hid_input *hi,
|
|
|
|
struct hid_usage *usage, unsigned long **bit, int *max)
|
|
|
|
{
|
|
|
|
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
set_bit(EV_REP, hi->input->evbit);
|
|
|
|
switch (usage->hid & HID_USAGE) {
|
|
|
|
/* Reported on Logitech Ultra X Media Remote */
|
|
|
|
case 0x004: lg_map_key_clear(KEY_AGAIN); break;
|
|
|
|
case 0x00d: lg_map_key_clear(KEY_HOME); break;
|
|
|
|
case 0x024: lg_map_key_clear(KEY_SHUFFLE); break;
|
|
|
|
case 0x025: lg_map_key_clear(KEY_TV); break;
|
|
|
|
case 0x026: lg_map_key_clear(KEY_MENU); break;
|
|
|
|
case 0x031: lg_map_key_clear(KEY_AUDIO); break;
|
|
|
|
case 0x032: lg_map_key_clear(KEY_TEXT); break;
|
|
|
|
case 0x033: lg_map_key_clear(KEY_LAST); break;
|
|
|
|
case 0x047: lg_map_key_clear(KEY_MP3); break;
|
|
|
|
case 0x048: lg_map_key_clear(KEY_DVD); break;
|
|
|
|
case 0x049: lg_map_key_clear(KEY_MEDIA); break;
|
|
|
|
case 0x04a: lg_map_key_clear(KEY_VIDEO); break;
|
|
|
|
case 0x04b: lg_map_key_clear(KEY_ANGLE); break;
|
|
|
|
case 0x04c: lg_map_key_clear(KEY_LANGUAGE); break;
|
|
|
|
case 0x04d: lg_map_key_clear(KEY_SUBTITLE); break;
|
|
|
|
case 0x051: lg_map_key_clear(KEY_RED); break;
|
|
|
|
case 0x052: lg_map_key_clear(KEY_CLOSE); break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-11-25 01:22:20 +08:00
|
|
|
static int lg_dinovo_mapping(struct hid_input *hi, struct hid_usage *usage,
|
|
|
|
unsigned long **bit, int *max)
|
|
|
|
{
|
|
|
|
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (usage->hid & HID_USAGE) {
|
|
|
|
|
|
|
|
case 0x00d: lg_map_key_clear(KEY_MEDIA); break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
static int lg_wireless_mapping(struct hid_input *hi, struct hid_usage *usage,
|
|
|
|
unsigned long **bit, int *max)
|
|
|
|
{
|
|
|
|
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (usage->hid & HID_USAGE) {
|
|
|
|
case 0x1001: lg_map_key_clear(KEY_MESSENGER); break;
|
|
|
|
case 0x1003: lg_map_key_clear(KEY_SOUND); break;
|
|
|
|
case 0x1004: lg_map_key_clear(KEY_VIDEO); break;
|
|
|
|
case 0x1005: lg_map_key_clear(KEY_AUDIO); break;
|
|
|
|
case 0x100a: lg_map_key_clear(KEY_DOCUMENTS); break;
|
2010-04-17 01:00:31 +08:00
|
|
|
/* The following two entries are Playlist 1 and 2 on the MX3200 */
|
|
|
|
case 0x100f: lg_map_key_clear(KEY_FN_1); break;
|
|
|
|
case 0x1010: lg_map_key_clear(KEY_FN_2); break;
|
2008-05-16 17:49:19 +08:00
|
|
|
case 0x1011: lg_map_key_clear(KEY_PREVIOUSSONG); break;
|
|
|
|
case 0x1012: lg_map_key_clear(KEY_NEXTSONG); break;
|
|
|
|
case 0x1013: lg_map_key_clear(KEY_CAMERA); break;
|
|
|
|
case 0x1014: lg_map_key_clear(KEY_MESSENGER); break;
|
|
|
|
case 0x1015: lg_map_key_clear(KEY_RECORD); break;
|
|
|
|
case 0x1016: lg_map_key_clear(KEY_PLAYER); break;
|
|
|
|
case 0x1017: lg_map_key_clear(KEY_EJECTCD); break;
|
|
|
|
case 0x1018: lg_map_key_clear(KEY_MEDIA); break;
|
|
|
|
case 0x1019: lg_map_key_clear(KEY_PROG1); break;
|
|
|
|
case 0x101a: lg_map_key_clear(KEY_PROG2); break;
|
|
|
|
case 0x101b: lg_map_key_clear(KEY_PROG3); break;
|
2010-04-17 01:00:31 +08:00
|
|
|
case 0x101c: lg_map_key_clear(KEY_CYCLEWINDOWS); break;
|
2008-05-16 17:49:19 +08:00
|
|
|
case 0x101f: lg_map_key_clear(KEY_ZOOMIN); break;
|
|
|
|
case 0x1020: lg_map_key_clear(KEY_ZOOMOUT); break;
|
|
|
|
case 0x1021: lg_map_key_clear(KEY_ZOOMRESET); break;
|
|
|
|
case 0x1023: lg_map_key_clear(KEY_CLOSE); break;
|
|
|
|
case 0x1027: lg_map_key_clear(KEY_MENU); break;
|
|
|
|
/* this one is marked as 'Rotate' */
|
|
|
|
case 0x1028: lg_map_key_clear(KEY_ANGLE); break;
|
|
|
|
case 0x1029: lg_map_key_clear(KEY_SHUFFLE); break;
|
|
|
|
case 0x102a: lg_map_key_clear(KEY_BACK); break;
|
|
|
|
case 0x102b: lg_map_key_clear(KEY_CYCLEWINDOWS); break;
|
2010-04-17 01:00:31 +08:00
|
|
|
case 0x102d: lg_map_key_clear(KEY_WWW); break;
|
|
|
|
/* The following two are 'Start/answer call' and 'End/reject call'
|
|
|
|
on the MX3200 */
|
|
|
|
case 0x1031: lg_map_key_clear(KEY_OK); break;
|
|
|
|
case 0x1032: lg_map_key_clear(KEY_CANCEL); break;
|
2008-05-16 17:49:19 +08:00
|
|
|
case 0x1041: lg_map_key_clear(KEY_BATTERY); break;
|
|
|
|
case 0x1042: lg_map_key_clear(KEY_WORDPROCESSOR); break;
|
|
|
|
case 0x1043: lg_map_key_clear(KEY_SPREADSHEET); break;
|
|
|
|
case 0x1044: lg_map_key_clear(KEY_PRESENTATION); break;
|
|
|
|
case 0x1045: lg_map_key_clear(KEY_UNDO); break;
|
|
|
|
case 0x1046: lg_map_key_clear(KEY_REDO); break;
|
|
|
|
case 0x1047: lg_map_key_clear(KEY_PRINT); break;
|
|
|
|
case 0x1048: lg_map_key_clear(KEY_SAVE); break;
|
|
|
|
case 0x1049: lg_map_key_clear(KEY_PROG1); break;
|
|
|
|
case 0x104a: lg_map_key_clear(KEY_PROG2); break;
|
|
|
|
case 0x104b: lg_map_key_clear(KEY_PROG3); break;
|
|
|
|
case 0x104c: lg_map_key_clear(KEY_PROG4); break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
|
|
struct hid_field *field, struct hid_usage *usage,
|
|
|
|
unsigned long **bit, int *max)
|
|
|
|
{
|
|
|
|
/* extended mapping for certain Logitech hardware (Logitech cordless
|
|
|
|
desktop LX500) */
|
|
|
|
static const u8 e_keymap[] = {
|
|
|
|
0,216, 0,213,175,156, 0, 0, 0, 0,
|
|
|
|
144, 0, 0, 0, 0, 0, 0, 0, 0,212,
|
|
|
|
174,167,152,161,112, 0, 0, 0,154, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0,183,184,185,186,187,
|
|
|
|
188,189,190,191,192,193,194, 0, 0, 0
|
|
|
|
};
|
2012-09-13 14:08:32 +08:00
|
|
|
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
|
2008-05-16 17:49:19 +08:00
|
|
|
unsigned int hid = usage->hid;
|
|
|
|
|
|
|
|
if (hdev->product == USB_DEVICE_ID_LOGITECH_RECEIVER &&
|
|
|
|
lg_ultrax_remote_mapping(hi, usage, bit, max))
|
|
|
|
return 1;
|
|
|
|
|
2009-11-25 01:22:20 +08:00
|
|
|
if (hdev->product == USB_DEVICE_ID_DINOVO_MINI &&
|
|
|
|
lg_dinovo_mapping(hi, usage, bit, max))
|
|
|
|
return 1;
|
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if ((drv_data->quirks & LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max))
|
2008-05-16 17:49:19 +08:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if ((hid & HID_USAGE_PAGE) != HID_UP_BUTTON)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
hid &= HID_USAGE;
|
|
|
|
|
|
|
|
/* Special handling for Logitech Cordless Desktop */
|
|
|
|
if (field->application == HID_GD_MOUSE) {
|
2012-03-31 17:17:25 +08:00
|
|
|
if ((drv_data->quirks & LG_IGNORE_DOUBLED_WHEEL) &&
|
2008-05-16 17:49:19 +08:00
|
|
|
(hid == 7 || hid == 8))
|
|
|
|
return -1;
|
|
|
|
} else {
|
2012-03-31 17:17:25 +08:00
|
|
|
if ((drv_data->quirks & LG_EXPANDED_KEYMAP) &&
|
2008-05-16 17:49:19 +08:00
|
|
|
hid < ARRAY_SIZE(e_keymap) &&
|
|
|
|
e_keymap[hid] != 0) {
|
|
|
|
hid_map_usage(hi, usage, bit, max, EV_KEY,
|
|
|
|
e_keymap[hid]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
|
|
|
|
struct hid_field *field, struct hid_usage *usage,
|
|
|
|
unsigned long **bit, int *max)
|
|
|
|
{
|
2012-09-13 14:08:32 +08:00
|
|
|
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if ((drv_data->quirks & LG_BAD_RELATIVE_KEYS) && usage->type == EV_KEY &&
|
2008-05-16 17:49:19 +08:00
|
|
|
(field->flags & HID_MAIN_ITEM_RELATIVE))
|
|
|
|
field->flags &= ~HID_MAIN_ITEM_RELATIVE;
|
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if ((drv_data->quirks & LG_DUPLICATE_USAGES) && (usage->type == EV_KEY ||
|
2008-05-16 17:49:19 +08:00
|
|
|
usage->type == EV_REL || usage->type == EV_ABS))
|
|
|
|
clear_bit(usage->code, *bit);
|
|
|
|
|
2013-02-20 11:25:12 +08:00
|
|
|
/* Ensure that Logitech wheels are not given a default fuzz/flat value */
|
|
|
|
if (usage->type == EV_ABS && (usage->code == ABS_X ||
|
|
|
|
usage->code == ABS_Y || usage->code == ABS_Z ||
|
|
|
|
usage->code == ABS_RZ)) {
|
|
|
|
switch (hdev->product) {
|
2015-11-02 22:56:52 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
|
2019-01-24 19:40:50 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_WINGMAN_FG:
|
2016-09-19 00:55:41 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
|
2013-02-20 11:25:12 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_G25_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_G27_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
|
|
|
|
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
|
2013-10-08 00:48:12 +08:00
|
|
|
case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL:
|
2013-02-20 11:25:12 +08:00
|
|
|
field->application = HID_GD_MULTIAXIS;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lg_event(struct hid_device *hdev, struct hid_field *field,
|
|
|
|
struct hid_usage *usage, __s32 value)
|
|
|
|
{
|
2012-09-13 14:08:32 +08:00
|
|
|
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if ((drv_data->quirks & LG_INVERT_HWHEEL) && usage->code == REL_HWHEEL) {
|
2008-05-16 17:49:19 +08:00
|
|
|
input_event(field->hidinput->input, usage->type, usage->code,
|
|
|
|
-value);
|
|
|
|
return 1;
|
|
|
|
}
|
2012-09-24 04:41:08 +08:00
|
|
|
if (drv_data->quirks & LG_FF4) {
|
|
|
|
return lg4ff_adjust_input_event(hdev, field, usage, value, drv_data);
|
|
|
|
}
|
2008-05-16 17:49:19 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-09-19 00:55:38 +08:00
|
|
|
static int lg_raw_event(struct hid_device *hdev, struct hid_report *report,
|
|
|
|
u8 *rd, int size)
|
|
|
|
{
|
|
|
|
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
|
|
|
|
|
|
|
|
if (drv_data->quirks & LG_FF4)
|
|
|
|
return lg4ff_raw_event(hdev, report, rd, size, drv_data);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|
|
|
{
|
2015-11-02 22:56:52 +08:00
|
|
|
struct usb_interface *iface = to_usb_interface(hdev->dev.parent);
|
|
|
|
__u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber;
|
2008-07-05 05:06:45 +08:00
|
|
|
unsigned int connect_mask = HID_CONNECT_DEFAULT;
|
2012-03-31 17:17:25 +08:00
|
|
|
struct lg_drv_data *drv_data;
|
2008-05-16 17:49:19 +08:00
|
|
|
int ret;
|
|
|
|
|
2015-12-01 17:26:24 +08:00
|
|
|
/* G29 only work with the 1st interface */
|
|
|
|
if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
|
|
|
|
(iface_num != 0)) {
|
2015-11-02 22:56:52 +08:00
|
|
|
dbg_hid("%s: ignoring ifnum %d\n", __func__, iface_num);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
drv_data = kzalloc(sizeof(struct lg_drv_data), GFP_KERNEL);
|
|
|
|
if (!drv_data) {
|
|
|
|
hid_err(hdev, "Insufficient memory, cannot allocate driver data\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
drv_data->quirks = id->driver_data;
|
2012-09-24 07:13:17 +08:00
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
hid_set_drvdata(hdev, (void *)drv_data);
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if (drv_data->quirks & LG_NOGET)
|
2008-05-16 17:49:19 +08:00
|
|
|
hdev->quirks |= HID_QUIRK_NOGET;
|
|
|
|
|
|
|
|
ret = hid_parse(hdev);
|
|
|
|
if (ret) {
|
2010-12-10 11:29:03 +08:00
|
|
|
hid_err(hdev, "parse failed\n");
|
2008-05-16 17:49:19 +08:00
|
|
|
goto err_free;
|
|
|
|
}
|
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if (drv_data->quirks & (LG_FF | LG_FF2 | LG_FF3 | LG_FF4))
|
2008-07-05 05:06:45 +08:00
|
|
|
connect_mask &= ~HID_CONNECT_FF;
|
|
|
|
|
|
|
|
ret = hid_hw_start(hdev, connect_mask);
|
2008-05-16 17:49:19 +08:00
|
|
|
if (ret) {
|
2010-12-10 11:29:03 +08:00
|
|
|
hid_err(hdev, "hw start failed\n");
|
2008-05-16 17:49:19 +08:00
|
|
|
goto err_free;
|
|
|
|
}
|
|
|
|
|
HID: lg4ff - Move handling of Logitech wheels to lg4ff driver
This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely
- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.
- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.
- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch
There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.
As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.
Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-08-04 22:16:09 +08:00
|
|
|
/* Setup wireless link with Logitech Wii wheel */
|
2012-09-24 07:13:17 +08:00
|
|
|
if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) {
|
2017-08-26 01:12:50 +08:00
|
|
|
static const unsigned char cbuf[] = {
|
|
|
|
0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
};
|
2016-11-21 18:48:40 +08:00
|
|
|
u8 *buf = kmemdup(cbuf, sizeof(cbuf), GFP_KERNEL);
|
2010-09-22 19:19:42 +08:00
|
|
|
|
2016-11-21 18:48:40 +08:00
|
|
|
if (!buf) {
|
|
|
|
ret = -ENOMEM;
|
2019-08-21 04:00:21 +08:00
|
|
|
goto err_stop;
|
2016-11-21 18:48:40 +08:00
|
|
|
}
|
2010-09-22 19:19:42 +08:00
|
|
|
|
2016-11-21 18:48:40 +08:00
|
|
|
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
|
|
|
|
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
|
2010-09-22 19:19:42 +08:00
|
|
|
if (ret >= 0) {
|
|
|
|
/* insert a little delay of 10 jiffies ~ 40ms */
|
|
|
|
wait_queue_head_t wait;
|
|
|
|
init_waitqueue_head (&wait);
|
2015-05-02 23:55:15 +08:00
|
|
|
wait_event_interruptible_timeout(wait, 0,
|
|
|
|
msecs_to_jiffies(40));
|
2010-09-22 19:19:42 +08:00
|
|
|
|
|
|
|
/* Select random Address */
|
|
|
|
buf[1] = 0xB2;
|
|
|
|
get_random_bytes(&buf[2], 2);
|
|
|
|
|
2016-11-21 18:48:40 +08:00
|
|
|
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
|
2014-02-11 01:58:54 +08:00
|
|
|
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
|
2010-09-22 19:19:42 +08:00
|
|
|
}
|
2016-11-21 18:48:40 +08:00
|
|
|
kfree(buf);
|
2010-09-22 19:19:42 +08:00
|
|
|
}
|
|
|
|
|
2012-03-31 17:17:25 +08:00
|
|
|
if (drv_data->quirks & LG_FF)
|
2015-04-09 04:56:45 +08:00
|
|
|
ret = lgff_init(hdev);
|
2015-04-09 04:56:53 +08:00
|
|
|
else if (drv_data->quirks & LG_FF2)
|
2015-04-09 04:56:45 +08:00
|
|
|
ret = lg2ff_init(hdev);
|
2015-04-09 04:56:53 +08:00
|
|
|
else if (drv_data->quirks & LG_FF3)
|
2015-04-09 04:56:45 +08:00
|
|
|
ret = lg3ff_init(hdev);
|
2015-04-09 04:56:53 +08:00
|
|
|
else if (drv_data->quirks & LG_FF4)
|
2015-04-09 04:56:45 +08:00
|
|
|
ret = lg4ff_init(hdev);
|
|
|
|
|
|
|
|
if (ret)
|
2019-08-21 04:00:21 +08:00
|
|
|
goto err_stop;
|
2008-07-05 05:06:45 +08:00
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
return 0;
|
2019-08-21 04:00:21 +08:00
|
|
|
|
|
|
|
err_stop:
|
|
|
|
hid_hw_stop(hdev);
|
2008-05-16 17:49:19 +08:00
|
|
|
err_free:
|
2012-03-31 17:17:25 +08:00
|
|
|
kfree(drv_data);
|
2008-05-16 17:49:19 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-08-04 22:20:40 +08:00
|
|
|
static void lg_remove(struct hid_device *hdev)
|
|
|
|
{
|
2012-09-13 14:08:32 +08:00
|
|
|
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
|
2012-03-31 17:17:25 +08:00
|
|
|
if (drv_data->quirks & LG_FF4)
|
2011-08-04 22:20:40 +08:00
|
|
|
lg4ff_deinit(hdev);
|
2019-08-21 04:00:21 +08:00
|
|
|
hid_hw_stop(hdev);
|
2012-03-31 17:17:25 +08:00
|
|
|
kfree(drv_data);
|
2011-08-04 22:20:40 +08:00
|
|
|
}
|
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
static const struct hid_device_id lg_devices[] = {
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER),
|
|
|
|
.driver_data = LG_RDESC | LG_WIRELESS },
|
|
|
|
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER),
|
|
|
|
.driver_data = LG_BAD_RELATIVE_KEYS },
|
|
|
|
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP),
|
|
|
|
.driver_data = LG_DUPLICATE_USAGES },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE),
|
|
|
|
.driver_data = LG_DUPLICATE_USAGES },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI),
|
|
|
|
.driver_data = LG_DUPLICATE_USAGES },
|
|
|
|
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD),
|
|
|
|
.driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500),
|
|
|
|
.driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
|
|
|
|
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D),
|
|
|
|
.driver_data = LG_NOGET },
|
2013-11-30 17:51:28 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DUAL_ACTION),
|
|
|
|
.driver_data = LG_NOGET },
|
2008-05-16 17:49:19 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL),
|
HID: lg4ff - Move handling of Logitech wheels to lg4ff driver
This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely
- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.
- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.
- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch
There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.
As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.
Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-08-04 22:16:09 +08:00
|
|
|
.driver_data = LG_NOGET | LG_FF4 },
|
2008-07-05 05:06:45 +08:00
|
|
|
|
2010-10-04 21:39:49 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD),
|
|
|
|
.driver_data = LG_FF2 },
|
2008-07-05 05:06:45 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD),
|
|
|
|
.driver_data = LG_FF },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2),
|
|
|
|
.driver_data = LG_FF },
|
2015-07-24 09:10:03 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL),
|
|
|
|
.driver_data = LG_FF4 },
|
2008-07-05 05:06:45 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D),
|
|
|
|
.driver_data = LG_FF },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO),
|
|
|
|
.driver_data = LG_FF },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL),
|
2013-02-20 11:25:10 +08:00
|
|
|
.driver_data = LG_NOGET | LG_FF4 },
|
2008-07-05 05:06:45 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2),
|
HID: lg4ff - Move handling of Logitech wheels to lg4ff driver
This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely
- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.
- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.
- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch
There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.
As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.
Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-08-04 22:16:09 +08:00
|
|
|
.driver_data = LG_FF4 },
|
2013-10-08 00:48:12 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL),
|
|
|
|
.driver_data = LG_FF2 },
|
HID: Add support for the G25 force feedback wheel in native mode
Add Product Id 0xc299 for the Logitech G25 force feedback wheel
The Logitech G25 force feedback wheel, is first recognize by the kernel
with the product id "0xc294". In this mode, we can't use all the axes
and buttons of the wheel.
Using a userland utility, it is possible to make the wheel switch to native
mode -- http://svn.vdrift.net/viewvc.cgi/trunk/tools/G25manage/?root=VDrift
In native mode, the wheel change its id number to "0xc299".
The packet that needs to be sent to the wheel to swtich to native mode and
change its PID is
{ 0xf8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 }
Signed-off-by: Christophe Borivant <christophe.borivant@wanadoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-04-17 17:39:39 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL),
|
HID: lg4ff - Move handling of Logitech wheels to lg4ff driver
This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely
- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.
- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.
- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch
There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.
As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.
Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-08-04 22:16:09 +08:00
|
|
|
.driver_data = LG_FF4 },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL),
|
|
|
|
.driver_data = LG_FF4 },
|
2011-05-03 16:15:03 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL),
|
HID: lg4ff - Move handling of Logitech wheels to lg4ff driver
This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely
- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.
- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.
- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch
There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.
As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.
Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-08-04 22:16:09 +08:00
|
|
|
.driver_data = LG_FF4 },
|
2011-03-17 07:43:23 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL),
|
HID: lg4ff - Move handling of Logitech wheels to lg4ff driver
This is the first out of five patches me and Simon Wood (CC'd) have been
working on. It separates the handling of Logite from the generic lgff driver
and adds additional features specific for the Logitech wheels, namely
- Native mode support for Driving Force GT, Driving Force Pro, G25 and G27
wheels Every Logitech wheel reports itself as generic Logitech Driving Force
wheel (VID 046d, PID c294). This is done to ensu wheel will work on every USB
HID-aware system even when no Logitech driver is available. It however limits
the capabilit wheel - range is limited to 200 degrees, G25/G27 don't report the
clutch pedal and there is only one combined axis for t brake. The switch to
native mode is done via hardware-specific command which is different for each
wheel. When the wheel receives such command, it simulates reconnect and reports
to the OS with its actual PID.
- Adjustable wheel range DFGT, DFP, G25 and G27 have variable range of the
steering wheel. The range is limited by applying a maximum constant when the
wheel is turned beyond the allowed range. The limit as also set by a
hardware-specific command. There is a comm command for DFGT, G25 and G27 and
another one for DFP. It is probably possible to use the DFP command to limit
the range other Logitech wheels too, but this is not supported by the official
Logitech driver for Windows. The patch adds a sysfs interface which allows for
the range to be set from userspace.
- Fixed autocentering command All Logitech wheels support FF_AUTOCENTER effect.
The original implementation in the lgff driver didn't work well with patch
fixes it. According to USB communication sniffs the Formula Force EX (pretty
much rebranded original Driving Force accept the generic autocentering command,
this issue is also addressed by the patch
There are still some features this patch doesn't cover, but since some of them
will most likely require modifications of memless driver we have decided not to
include them yet.
As first we decided to move the handling of Logitech wheels from hid-lgff
driver to hid-lg4ff driver (originally used fo At also adds PID of Logitech
Driving Force GT.
Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-08-04 22:16:09 +08:00
|
|
|
.driver_data = LG_NOGET | LG_FF4 },
|
2010-09-22 19:19:42 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
|
|
|
|
.driver_data = LG_FF4 },
|
2019-01-24 19:40:50 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FG),
|
|
|
|
.driver_data = LG_NOGET },
|
2012-09-24 07:13:17 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG),
|
2016-09-19 00:55:41 +08:00
|
|
|
.driver_data = LG_NOGET | LG_FF4 },
|
2008-07-05 05:06:45 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
|
2017-01-26 21:54:42 +08:00
|
|
|
.driver_data = LG_NOGET | LG_FF2 },
|
2010-01-13 07:25:58 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
|
|
|
|
.driver_data = LG_FF3 },
|
2009-11-13 17:45:53 +08:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
|
|
|
|
.driver_data = LG_RDESC_REL_ABS },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER),
|
|
|
|
.driver_data = LG_RDESC_REL_ABS },
|
2008-05-16 17:49:19 +08:00
|
|
|
{ }
|
|
|
|
};
|
2009-11-13 17:45:53 +08:00
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
MODULE_DEVICE_TABLE(hid, lg_devices);
|
|
|
|
|
|
|
|
static struct hid_driver lg_driver = {
|
|
|
|
.name = "logitech",
|
|
|
|
.id_table = lg_devices,
|
|
|
|
.report_fixup = lg_report_fixup,
|
|
|
|
.input_mapping = lg_input_mapping,
|
|
|
|
.input_mapped = lg_input_mapped,
|
|
|
|
.event = lg_event,
|
2016-09-19 00:55:38 +08:00
|
|
|
.raw_event = lg_raw_event,
|
2008-05-16 17:49:19 +08:00
|
|
|
.probe = lg_probe,
|
2011-08-04 22:20:40 +08:00
|
|
|
.remove = lg_remove,
|
2008-05-16 17:49:19 +08:00
|
|
|
};
|
2012-12-18 06:28:26 +08:00
|
|
|
module_hid_driver(lg_driver);
|
2008-05-16 17:49:19 +08:00
|
|
|
|
2015-02-19 00:59:22 +08:00
|
|
|
#ifdef CONFIG_LOGIWHEELS_FF
|
|
|
|
int lg4ff_no_autoswitch = 0;
|
|
|
|
module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO);
|
|
|
|
MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically");
|
|
|
|
#endif
|
|
|
|
|
2008-05-16 17:49:19 +08:00
|
|
|
MODULE_LICENSE("GPL");
|