Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 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 |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 8 | * Copyright (c) 2008 Jiri Slaby |
Hendrik Iben | 2c6118e | 2010-10-04 15:39:49 +0200 | [diff] [blame] | 9 | * Copyright (c) 2010 Hendrik Iben |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | /* |
| 13 | * This program is free software; you can redistribute it and/or modify it |
| 14 | * under the terms of the GNU General Public License as published by the Free |
| 15 | * Software Foundation; either version 2 of the License, or (at your option) |
| 16 | * any later version. |
| 17 | */ |
| 18 | |
| 19 | #include <linux/device.h> |
| 20 | #include <linux/hid.h> |
| 21 | #include <linux/module.h> |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 22 | #include <linux/random.h> |
| 23 | #include <linux/sched.h> |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 24 | #include <linux/usb.h> |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 25 | #include <linux/wait.h> |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 26 | |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 27 | #include "usbhid/usbhid.h" |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 28 | #include "hid-ids.h" |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 29 | #include "hid-lg.h" |
Michal Malý | a54dc779 | 2015-02-18 17:59:22 +0100 | [diff] [blame] | 30 | #include "hid-lg4ff.h" |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 31 | |
| 32 | #define LG_RDESC 0x001 |
| 33 | #define LG_BAD_RELATIVE_KEYS 0x002 |
| 34 | #define LG_DUPLICATE_USAGES 0x004 |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 35 | #define LG_EXPANDED_KEYMAP 0x010 |
| 36 | #define LG_IGNORE_DOUBLED_WHEEL 0x020 |
| 37 | #define LG_WIRELESS 0x040 |
| 38 | #define LG_INVERT_HWHEEL 0x080 |
| 39 | #define LG_NOGET 0x100 |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 40 | #define LG_FF 0x200 |
| 41 | #define LG_FF2 0x400 |
Jiri Kosina | 24985cf | 2009-11-13 10:45:53 +0100 | [diff] [blame] | 42 | #define LG_RDESC_REL_ABS 0x800 |
Gary Stein | 74f292c | 2010-01-13 00:25:58 +0100 | [diff] [blame] | 43 | #define LG_FF3 0x1000 |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 44 | #define LG_FF4 0x2000 |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 45 | |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 46 | /* Size of the original descriptors of the Driving Force (and Pro) wheels */ |
| 47 | #define DF_RDESC_ORIG_SIZE 130 |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 48 | #define DFP_RDESC_ORIG_SIZE 97 |
Simon Wood | 7f50547 | 2013-10-10 08:20:12 -0600 | [diff] [blame] | 49 | #define FV_RDESC_ORIG_SIZE 130 |
Simon Wood | 270baef | 2013-02-19 20:25:10 -0700 | [diff] [blame] | 50 | #define MOMO_RDESC_ORIG_SIZE 87 |
Simon Wood | 348cbaa | 2013-10-10 08:20:13 -0600 | [diff] [blame] | 51 | #define MOMO2_RDESC_ORIG_SIZE 87 |
Simon Wood | 560bea3 | 2016-09-18 10:55:41 -0600 | [diff] [blame] | 52 | #define FFG_RDESC_ORIG_SIZE 85 |
Jarrad Whitaker | e41b3cd | 2019-01-24 22:40:50 +1100 | [diff] [blame] | 53 | #define FG_RDESC_ORIG_SIZE 82 |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 54 | |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 55 | /* Fixed report descriptors for Logitech Driving Force (and Pro) |
| 56 | * wheel controllers |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 57 | * |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 58 | * The original descriptors hide the separate throttle and brake axes in |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 59 | * a custom vendor usage page, providing only a combined value as |
| 60 | * GenericDesktop.Y. |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 61 | * These descriptors remove the combined Y axis and instead report |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 62 | * separate throttle (Y) and brake (RZ). |
| 63 | */ |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 64 | static __u8 df_rdesc_fixed[] = { |
| 65 | 0x05, 0x01, /* Usage Page (Desktop), */ |
Antonio Ospite | bfb61ab | 2016-02-09 13:55:04 +0100 | [diff] [blame] | 66 | 0x09, 0x04, /* Usage (Joystick), */ |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 67 | 0xA1, 0x01, /* Collection (Application), */ |
| 68 | 0xA1, 0x02, /* Collection (Logical), */ |
| 69 | 0x95, 0x01, /* Report Count (1), */ |
| 70 | 0x75, 0x0A, /* Report Size (10), */ |
| 71 | 0x14, /* Logical Minimum (0), */ |
| 72 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
| 73 | 0x34, /* Physical Minimum (0), */ |
| 74 | 0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ |
| 75 | 0x09, 0x30, /* Usage (X), */ |
| 76 | 0x81, 0x02, /* Input (Variable), */ |
| 77 | 0x95, 0x0C, /* Report Count (12), */ |
| 78 | 0x75, 0x01, /* Report Size (1), */ |
| 79 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 80 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 81 | 0x05, 0x09, /* Usage (Buttons), */ |
| 82 | 0x19, 0x01, /* Usage Minimum (1), */ |
| 83 | 0x29, 0x0c, /* Usage Maximum (12), */ |
| 84 | 0x81, 0x02, /* Input (Variable), */ |
| 85 | 0x95, 0x02, /* Report Count (2), */ |
| 86 | 0x06, 0x00, 0xFF, /* Usage Page (Vendor: 65280), */ |
| 87 | 0x09, 0x01, /* Usage (?: 1), */ |
| 88 | 0x81, 0x02, /* Input (Variable), */ |
| 89 | 0x05, 0x01, /* Usage Page (Desktop), */ |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 90 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 91 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 92 | 0x95, 0x01, /* Report Count (1), */ |
| 93 | 0x75, 0x08, /* Report Size (8), */ |
| 94 | 0x81, 0x02, /* Input (Variable), */ |
| 95 | 0x25, 0x07, /* Logical Maximum (7), */ |
| 96 | 0x46, 0x3B, 0x01, /* Physical Maximum (315), */ |
| 97 | 0x75, 0x04, /* Report Size (4), */ |
| 98 | 0x65, 0x14, /* Unit (Degrees), */ |
| 99 | 0x09, 0x39, /* Usage (Hat Switch), */ |
| 100 | 0x81, 0x42, /* Input (Variable, Null State), */ |
| 101 | 0x75, 0x01, /* Report Size (1), */ |
| 102 | 0x95, 0x04, /* Report Count (4), */ |
| 103 | 0x65, 0x00, /* Unit (none), */ |
| 104 | 0x06, 0x00, 0xFF, /* Usage Page (Vendor: 65280), */ |
| 105 | 0x09, 0x01, /* Usage (?: 1), */ |
| 106 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 107 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 108 | 0x81, 0x02, /* Input (Variable), */ |
Paul Sbarra | 5a9b571b | 2013-02-17 11:53:14 -0600 | [diff] [blame] | 109 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 110 | 0x95, 0x01, /* Report Count (1), */ |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 111 | 0x75, 0x08, /* Report Size (8), */ |
| 112 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 113 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
Paul Sbarra | 5a9b571b | 2013-02-17 11:53:14 -0600 | [diff] [blame] | 114 | 0x09, 0x31, /* Usage (Y), */ |
| 115 | 0x81, 0x02, /* Input (Variable), */ |
| 116 | 0x09, 0x35, /* Usage (Rz), */ |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 117 | 0x81, 0x02, /* Input (Variable), */ |
| 118 | 0xC0, /* End Collection, */ |
| 119 | 0xA1, 0x02, /* Collection (Logical), */ |
| 120 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 121 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 122 | 0x95, 0x07, /* Report Count (7), */ |
| 123 | 0x75, 0x08, /* Report Size (8), */ |
| 124 | 0x09, 0x03, /* Usage (?: 3), */ |
| 125 | 0x91, 0x02, /* Output (Variable), */ |
| 126 | 0xC0, /* End Collection, */ |
| 127 | 0xC0 /* End Collection */ |
| 128 | }; |
| 129 | |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 130 | static __u8 dfp_rdesc_fixed[] = { |
| 131 | 0x05, 0x01, /* Usage Page (Desktop), */ |
Antonio Ospite | bfb61ab | 2016-02-09 13:55:04 +0100 | [diff] [blame] | 132 | 0x09, 0x04, /* Usage (Joystick), */ |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 133 | 0xA1, 0x01, /* Collection (Application), */ |
| 134 | 0xA1, 0x02, /* Collection (Logical), */ |
| 135 | 0x95, 0x01, /* Report Count (1), */ |
| 136 | 0x75, 0x0E, /* Report Size (14), */ |
| 137 | 0x14, /* Logical Minimum (0), */ |
| 138 | 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */ |
| 139 | 0x34, /* Physical Minimum (0), */ |
| 140 | 0x46, 0xFF, 0x3F, /* Physical Maximum (16383), */ |
| 141 | 0x09, 0x30, /* Usage (X), */ |
| 142 | 0x81, 0x02, /* Input (Variable), */ |
| 143 | 0x95, 0x0E, /* Report Count (14), */ |
| 144 | 0x75, 0x01, /* Report Size (1), */ |
| 145 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 146 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 147 | 0x05, 0x09, /* Usage Page (Button), */ |
| 148 | 0x19, 0x01, /* Usage Minimum (01h), */ |
| 149 | 0x29, 0x0E, /* Usage Maximum (0Eh), */ |
| 150 | 0x81, 0x02, /* Input (Variable), */ |
| 151 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 152 | 0x95, 0x01, /* Report Count (1), */ |
| 153 | 0x75, 0x04, /* Report Size (4), */ |
| 154 | 0x25, 0x07, /* Logical Maximum (7), */ |
| 155 | 0x46, 0x3B, 0x01, /* Physical Maximum (315), */ |
| 156 | 0x65, 0x14, /* Unit (Degrees), */ |
| 157 | 0x09, 0x39, /* Usage (Hat Switch), */ |
| 158 | 0x81, 0x42, /* Input (Variable, Nullstate), */ |
| 159 | 0x65, 0x00, /* Unit, */ |
| 160 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 161 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 162 | 0x75, 0x08, /* Report Size (8), */ |
| 163 | 0x81, 0x01, /* Input (Constant), */ |
| 164 | 0x09, 0x31, /* Usage (Y), */ |
| 165 | 0x81, 0x02, /* Input (Variable), */ |
| 166 | 0x09, 0x35, /* Usage (Rz), */ |
| 167 | 0x81, 0x02, /* Input (Variable), */ |
| 168 | 0x81, 0x01, /* Input (Constant), */ |
| 169 | 0xC0, /* End Collection, */ |
| 170 | 0xA1, 0x02, /* Collection (Logical), */ |
| 171 | 0x09, 0x02, /* Usage (02h), */ |
| 172 | 0x95, 0x07, /* Report Count (7), */ |
| 173 | 0x91, 0x02, /* Output (Variable), */ |
| 174 | 0xC0, /* End Collection, */ |
| 175 | 0xC0 /* End Collection */ |
| 176 | }; |
| 177 | |
Simon Wood | 7f50547 | 2013-10-10 08:20:12 -0600 | [diff] [blame] | 178 | static __u8 fv_rdesc_fixed[] = { |
| 179 | 0x05, 0x01, /* Usage Page (Desktop), */ |
Antonio Ospite | bfb61ab | 2016-02-09 13:55:04 +0100 | [diff] [blame] | 180 | 0x09, 0x04, /* Usage (Joystick), */ |
Simon Wood | 7f50547 | 2013-10-10 08:20:12 -0600 | [diff] [blame] | 181 | 0xA1, 0x01, /* Collection (Application), */ |
| 182 | 0xA1, 0x02, /* Collection (Logical), */ |
| 183 | 0x95, 0x01, /* Report Count (1), */ |
| 184 | 0x75, 0x0A, /* Report Size (10), */ |
| 185 | 0x15, 0x00, /* Logical Minimum (0), */ |
| 186 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
| 187 | 0x35, 0x00, /* Physical Minimum (0), */ |
| 188 | 0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ |
| 189 | 0x09, 0x30, /* Usage (X), */ |
| 190 | 0x81, 0x02, /* Input (Variable), */ |
| 191 | 0x95, 0x0C, /* Report Count (12), */ |
| 192 | 0x75, 0x01, /* Report Size (1), */ |
| 193 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 194 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 195 | 0x05, 0x09, /* Usage Page (Button), */ |
| 196 | 0x19, 0x01, /* Usage Minimum (01h), */ |
| 197 | 0x29, 0x0C, /* Usage Maximum (0Ch), */ |
| 198 | 0x81, 0x02, /* Input (Variable), */ |
| 199 | 0x95, 0x02, /* Report Count (2), */ |
| 200 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 201 | 0x09, 0x01, /* Usage (01h), */ |
| 202 | 0x81, 0x02, /* Input (Variable), */ |
| 203 | 0x09, 0x02, /* Usage (02h), */ |
| 204 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 205 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 206 | 0x95, 0x01, /* Report Count (1), */ |
| 207 | 0x75, 0x08, /* Report Size (8), */ |
| 208 | 0x81, 0x02, /* Input (Variable), */ |
| 209 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 210 | 0x25, 0x07, /* Logical Maximum (7), */ |
| 211 | 0x46, 0x3B, 0x01, /* Physical Maximum (315), */ |
| 212 | 0x75, 0x04, /* Report Size (4), */ |
| 213 | 0x65, 0x14, /* Unit (Degrees), */ |
| 214 | 0x09, 0x39, /* Usage (Hat Switch), */ |
| 215 | 0x81, 0x42, /* Input (Variable, Null State), */ |
| 216 | 0x75, 0x01, /* Report Size (1), */ |
| 217 | 0x95, 0x04, /* Report Count (4), */ |
| 218 | 0x65, 0x00, /* Unit, */ |
| 219 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 220 | 0x09, 0x01, /* Usage (01h), */ |
| 221 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 222 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 223 | 0x81, 0x02, /* Input (Variable), */ |
| 224 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 225 | 0x95, 0x01, /* Report Count (1), */ |
| 226 | 0x75, 0x08, /* Report Size (8), */ |
| 227 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 228 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 229 | 0x09, 0x31, /* Usage (Y), */ |
| 230 | 0x81, 0x02, /* Input (Variable), */ |
| 231 | 0x09, 0x32, /* Usage (Z), */ |
| 232 | 0x81, 0x02, /* Input (Variable), */ |
| 233 | 0xC0, /* End Collection, */ |
| 234 | 0xA1, 0x02, /* Collection (Logical), */ |
| 235 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 236 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 237 | 0x95, 0x07, /* Report Count (7), */ |
| 238 | 0x75, 0x08, /* Report Size (8), */ |
| 239 | 0x09, 0x03, /* Usage (03h), */ |
| 240 | 0x91, 0x02, /* Output (Variable), */ |
| 241 | 0xC0, /* End Collection, */ |
| 242 | 0xC0 /* End Collection */ |
| 243 | }; |
| 244 | |
Simon Wood | 270baef | 2013-02-19 20:25:10 -0700 | [diff] [blame] | 245 | static __u8 momo_rdesc_fixed[] = { |
| 246 | 0x05, 0x01, /* Usage Page (Desktop), */ |
Antonio Ospite | bfb61ab | 2016-02-09 13:55:04 +0100 | [diff] [blame] | 247 | 0x09, 0x04, /* Usage (Joystick), */ |
Simon Wood | 270baef | 2013-02-19 20:25:10 -0700 | [diff] [blame] | 248 | 0xA1, 0x01, /* Collection (Application), */ |
| 249 | 0xA1, 0x02, /* Collection (Logical), */ |
| 250 | 0x95, 0x01, /* Report Count (1), */ |
| 251 | 0x75, 0x0A, /* Report Size (10), */ |
| 252 | 0x15, 0x00, /* Logical Minimum (0), */ |
| 253 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
| 254 | 0x35, 0x00, /* Physical Minimum (0), */ |
| 255 | 0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ |
| 256 | 0x09, 0x30, /* Usage (X), */ |
| 257 | 0x81, 0x02, /* Input (Variable), */ |
| 258 | 0x95, 0x08, /* Report Count (8), */ |
| 259 | 0x75, 0x01, /* Report Size (1), */ |
| 260 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 261 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 262 | 0x05, 0x09, /* Usage Page (Button), */ |
| 263 | 0x19, 0x01, /* Usage Minimum (01h), */ |
| 264 | 0x29, 0x08, /* Usage Maximum (08h), */ |
| 265 | 0x81, 0x02, /* Input (Variable), */ |
| 266 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 267 | 0x75, 0x0E, /* Report Size (14), */ |
| 268 | 0x95, 0x01, /* Report Count (1), */ |
| 269 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 270 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 271 | 0x09, 0x00, /* Usage (00h), */ |
| 272 | 0x81, 0x02, /* Input (Variable), */ |
| 273 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 274 | 0x75, 0x08, /* Report Size (8), */ |
| 275 | 0x09, 0x31, /* Usage (Y), */ |
| 276 | 0x81, 0x02, /* Input (Variable), */ |
| 277 | 0x09, 0x32, /* Usage (Z), */ |
| 278 | 0x81, 0x02, /* Input (Variable), */ |
| 279 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 280 | 0x09, 0x01, /* Usage (01h), */ |
| 281 | 0x81, 0x02, /* Input (Variable), */ |
| 282 | 0xC0, /* End Collection, */ |
| 283 | 0xA1, 0x02, /* Collection (Logical), */ |
| 284 | 0x09, 0x02, /* Usage (02h), */ |
| 285 | 0x95, 0x07, /* Report Count (7), */ |
| 286 | 0x91, 0x02, /* Output (Variable), */ |
| 287 | 0xC0, /* End Collection, */ |
| 288 | 0xC0 /* End Collection */ |
| 289 | }; |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 290 | |
Simon Wood | 348cbaa | 2013-10-10 08:20:13 -0600 | [diff] [blame] | 291 | static __u8 momo2_rdesc_fixed[] = { |
| 292 | 0x05, 0x01, /* Usage Page (Desktop), */ |
Antonio Ospite | bfb61ab | 2016-02-09 13:55:04 +0100 | [diff] [blame] | 293 | 0x09, 0x04, /* Usage (Joystick), */ |
Simon Wood | 348cbaa | 2013-10-10 08:20:13 -0600 | [diff] [blame] | 294 | 0xA1, 0x01, /* Collection (Application), */ |
| 295 | 0xA1, 0x02, /* Collection (Logical), */ |
| 296 | 0x95, 0x01, /* Report Count (1), */ |
| 297 | 0x75, 0x0A, /* Report Size (10), */ |
| 298 | 0x15, 0x00, /* Logical Minimum (0), */ |
| 299 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
| 300 | 0x35, 0x00, /* Physical Minimum (0), */ |
| 301 | 0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ |
| 302 | 0x09, 0x30, /* Usage (X), */ |
| 303 | 0x81, 0x02, /* Input (Variable), */ |
| 304 | 0x95, 0x0A, /* Report Count (10), */ |
| 305 | 0x75, 0x01, /* Report Size (1), */ |
| 306 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 307 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 308 | 0x05, 0x09, /* Usage Page (Button), */ |
| 309 | 0x19, 0x01, /* Usage Minimum (01h), */ |
| 310 | 0x29, 0x0A, /* Usage Maximum (0Ah), */ |
| 311 | 0x81, 0x02, /* Input (Variable), */ |
| 312 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 313 | 0x09, 0x00, /* Usage (00h), */ |
| 314 | 0x95, 0x04, /* Report Count (4), */ |
| 315 | 0x81, 0x02, /* Input (Variable), */ |
| 316 | 0x95, 0x01, /* Report Count (1), */ |
| 317 | 0x75, 0x08, /* Report Size (8), */ |
| 318 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 319 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 320 | 0x09, 0x01, /* Usage (01h), */ |
| 321 | 0x81, 0x02, /* Input (Variable), */ |
| 322 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 323 | 0x09, 0x31, /* Usage (Y), */ |
| 324 | 0x81, 0x02, /* Input (Variable), */ |
| 325 | 0x09, 0x32, /* Usage (Z), */ |
| 326 | 0x81, 0x02, /* Input (Variable), */ |
| 327 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 328 | 0x09, 0x00, /* Usage (00h), */ |
| 329 | 0x81, 0x02, /* Input (Variable), */ |
| 330 | 0xC0, /* End Collection, */ |
| 331 | 0xA1, 0x02, /* Collection (Logical), */ |
| 332 | 0x09, 0x02, /* Usage (02h), */ |
| 333 | 0x95, 0x07, /* Report Count (7), */ |
| 334 | 0x91, 0x02, /* Output (Variable), */ |
| 335 | 0xC0, /* End Collection, */ |
| 336 | 0xC0 /* End Collection */ |
| 337 | }; |
| 338 | |
Simon Wood | 560bea3 | 2016-09-18 10:55:41 -0600 | [diff] [blame] | 339 | static __u8 ffg_rdesc_fixed[] = { |
| 340 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 341 | 0x09, 0x04, /* Usage (Joystik), */ |
| 342 | 0xA1, 0x01, /* Collection (Application), */ |
| 343 | 0xA1, 0x02, /* Collection (Logical), */ |
| 344 | 0x95, 0x01, /* Report Count (1), */ |
| 345 | 0x75, 0x0A, /* Report Size (10), */ |
| 346 | 0x15, 0x00, /* Logical Minimum (0), */ |
| 347 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
| 348 | 0x35, 0x00, /* Physical Minimum (0), */ |
| 349 | 0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ |
| 350 | 0x09, 0x30, /* Usage (X), */ |
| 351 | 0x81, 0x02, /* Input (Variable), */ |
| 352 | 0x95, 0x06, /* Report Count (6), */ |
| 353 | 0x75, 0x01, /* Report Size (1), */ |
| 354 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 355 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 356 | 0x05, 0x09, /* Usage Page (Button), */ |
| 357 | 0x19, 0x01, /* Usage Minimum (01h), */ |
| 358 | 0x29, 0x06, /* Usage Maximum (06h), */ |
| 359 | 0x81, 0x02, /* Input (Variable), */ |
| 360 | 0x95, 0x01, /* Report Count (1), */ |
| 361 | 0x75, 0x08, /* Report Size (8), */ |
| 362 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 363 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 364 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 365 | 0x09, 0x01, /* Usage (01h), */ |
| 366 | 0x81, 0x02, /* Input (Variable), */ |
| 367 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 368 | 0x81, 0x01, /* Input (Constant), */ |
| 369 | 0x09, 0x31, /* Usage (Y), */ |
| 370 | 0x81, 0x02, /* Input (Variable), */ |
| 371 | 0x09, 0x32, /* Usage (Z), */ |
| 372 | 0x81, 0x02, /* Input (Variable), */ |
| 373 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
| 374 | 0x09, 0x01, /* Usage (01h), */ |
| 375 | 0x81, 0x02, /* Input (Variable), */ |
| 376 | 0xC0, /* End Collection, */ |
| 377 | 0xA1, 0x02, /* Collection (Logical), */ |
| 378 | 0x09, 0x02, /* Usage (02h), */ |
| 379 | 0x95, 0x07, /* Report Count (7), */ |
| 380 | 0x91, 0x02, /* Output (Variable), */ |
| 381 | 0xC0, /* End Collection, */ |
| 382 | 0xC0 /* End Collection */ |
| 383 | }; |
| 384 | |
Jarrad Whitaker | e41b3cd | 2019-01-24 22:40:50 +1100 | [diff] [blame] | 385 | static __u8 fg_rdesc_fixed[] = { |
| 386 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 387 | 0x09, 0x04, /* Usage (Joystik), */ |
| 388 | 0xA1, 0x01, /* Collection (Application), */ |
| 389 | 0xA1, 0x02, /* Collection (Logical), */ |
| 390 | 0x15, 0x00, /* Logical Minimum (0), */ |
| 391 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 392 | 0x35, 0x00, /* Physical Minimum (0), */ |
| 393 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 394 | 0x75, 0x08, /* Report Size (8), */ |
| 395 | 0x95, 0x01, /* Report Count (1), */ |
| 396 | 0x09, 0x30, /* Usage (X), */ |
| 397 | 0x81, 0x02, /* Input (Variable), */ |
| 398 | 0xA4, /* Push, */ |
| 399 | 0x25, 0x01, /* Logical Maximum (1), */ |
| 400 | 0x45, 0x01, /* Physical Maximum (1), */ |
| 401 | 0x75, 0x01, /* Report Size (1), */ |
| 402 | 0x95, 0x02, /* Report Count (2), */ |
| 403 | 0x81, 0x01, /* Input (Constant), */ |
| 404 | 0x95, 0x06, /* Report Count (6), */ |
| 405 | 0x05, 0x09, /* Usage Page (Button), */ |
| 406 | 0x19, 0x01, /* Usage Minimum (01h), */ |
| 407 | 0x29, 0x06, /* Usage Maximum (06h), */ |
| 408 | 0x81, 0x02, /* Input (Variable), */ |
| 409 | 0x05, 0x01, /* Usage Page (Desktop), */ |
| 410 | 0xB4, /* Pop, */ |
| 411 | 0x81, 0x02, /* Input (Constant), */ |
| 412 | 0x09, 0x31, /* Usage (Y), */ |
| 413 | 0x81, 0x02, /* Input (Variable), */ |
| 414 | 0x09, 0x32, /* Usage (Z), */ |
| 415 | 0x81, 0x02, /* Input (Variable), */ |
| 416 | 0xC0, /* End Collection, */ |
| 417 | 0xA1, 0x02, /* Collection (Logical), */ |
| 418 | 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
| 419 | 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
| 420 | 0x75, 0x08, /* Report Size (8), */ |
| 421 | 0x95, 0x04, /* Report Count (4), */ |
| 422 | 0x09, 0x02, /* Usage (02h), */ |
| 423 | 0xB1, 0x02, /* Feature (Variable), */ |
| 424 | 0xC0, /* End Collection, */ |
| 425 | 0xC0 /* End Collection, */ |
| 426 | }; |
| 427 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 428 | /* |
| 429 | * Certain Logitech keyboards send in report #3 keys which are far |
| 430 | * above the logical maximum described in descriptor. This extends |
| 431 | * the original value of 0x28c of logical maximum to 0x104d |
| 432 | */ |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 433 | static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
| 434 | unsigned int *rsize) |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 435 | { |
Axel Lin | 2575155 | 2012-09-13 14:08:32 +0800 | [diff] [blame] | 436 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 437 | |
Jiri Kosina | 4ab2578 | 2014-08-21 09:57:48 -0500 | [diff] [blame] | 438 | if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 && |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 439 | rdesc[84] == 0x8c && rdesc[85] == 0x02) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 440 | hid_info(hdev, |
| 441 | "fixing up Logitech keyboard report descriptor\n"); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 442 | rdesc[84] = rdesc[89] = 0x4d; |
| 443 | rdesc[85] = rdesc[90] = 0x10; |
| 444 | } |
Jiri Kosina | 4ab2578 | 2014-08-21 09:57:48 -0500 | [diff] [blame] | 445 | if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 && |
Jiri Kosina | 24985cf | 2009-11-13 10:45:53 +0100 | [diff] [blame] | 446 | rdesc[32] == 0x81 && rdesc[33] == 0x06 && |
| 447 | rdesc[49] == 0x81 && rdesc[50] == 0x06) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 448 | hid_info(hdev, |
| 449 | "fixing up rel/abs in Logitech report descriptor\n"); |
Jiri Kosina | 24985cf | 2009-11-13 10:45:53 +0100 | [diff] [blame] | 450 | rdesc[33] = rdesc[50] = 0x02; |
| 451 | } |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 452 | |
| 453 | switch (hdev->product) { |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 454 | |
Jarrad Whitaker | e41b3cd | 2019-01-24 22:40:50 +1100 | [diff] [blame] | 455 | case USB_DEVICE_ID_LOGITECH_WINGMAN_FG: |
| 456 | if (*rsize == FG_RDESC_ORIG_SIZE) { |
| 457 | hid_info(hdev, |
| 458 | "fixing up Logitech Wingman Formula GP report descriptor\n"); |
| 459 | rdesc = fg_rdesc_fixed; |
| 460 | *rsize = sizeof(fg_rdesc_fixed); |
| 461 | } else { |
| 462 | hid_info(hdev, |
| 463 | "rdesc size test failed for formula gp\n"); |
| 464 | } |
| 465 | break; |
| 466 | |
| 467 | |
Simon Wood | 560bea3 | 2016-09-18 10:55:41 -0600 | [diff] [blame] | 468 | case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG: |
| 469 | if (*rsize == FFG_RDESC_ORIG_SIZE) { |
| 470 | hid_info(hdev, |
| 471 | "fixing up Logitech Wingman Formula Force GP report descriptor\n"); |
| 472 | rdesc = ffg_rdesc_fixed; |
| 473 | *rsize = sizeof(ffg_rdesc_fixed); |
| 474 | } |
| 475 | break; |
| 476 | |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 477 | /* Several wheels report as this id when operating in emulation mode. */ |
| 478 | case USB_DEVICE_ID_LOGITECH_WHEEL: |
Simon Wood | 7363b25 | 2016-09-18 10:55:40 -0600 | [diff] [blame] | 479 | if (*rsize == DF_RDESC_ORIG_SIZE) { |
Paul Sbarra | 54bfe3f | 2013-02-17 11:53:13 -0600 | [diff] [blame] | 480 | hid_info(hdev, |
| 481 | "fixing up Logitech Driving Force report descriptor\n"); |
| 482 | rdesc = df_rdesc_fixed; |
| 483 | *rsize = sizeof(df_rdesc_fixed); |
| 484 | } |
| 485 | break; |
| 486 | |
Simon Wood | 270baef | 2013-02-19 20:25:10 -0700 | [diff] [blame] | 487 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: |
| 488 | if (*rsize == MOMO_RDESC_ORIG_SIZE) { |
| 489 | hid_info(hdev, |
| 490 | "fixing up Logitech Momo Force (Red) report descriptor\n"); |
| 491 | rdesc = momo_rdesc_fixed; |
| 492 | *rsize = sizeof(momo_rdesc_fixed); |
| 493 | } |
| 494 | break; |
| 495 | |
Simon Wood | 348cbaa | 2013-10-10 08:20:13 -0600 | [diff] [blame] | 496 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: |
| 497 | if (*rsize == MOMO2_RDESC_ORIG_SIZE) { |
| 498 | hid_info(hdev, |
| 499 | "fixing up Logitech Momo Racing Force (Black) report descriptor\n"); |
| 500 | rdesc = momo2_rdesc_fixed; |
| 501 | *rsize = sizeof(momo2_rdesc_fixed); |
| 502 | } |
| 503 | break; |
| 504 | |
Simon Wood | 7f50547 | 2013-10-10 08:20:12 -0600 | [diff] [blame] | 505 | case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: |
| 506 | if (*rsize == FV_RDESC_ORIG_SIZE) { |
| 507 | hid_info(hdev, |
| 508 | "fixing up Logitech Formula Vibration report descriptor\n"); |
| 509 | rdesc = fv_rdesc_fixed; |
| 510 | *rsize = sizeof(fv_rdesc_fixed); |
| 511 | } |
| 512 | break; |
| 513 | |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 514 | case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: |
| 515 | if (*rsize == DFP_RDESC_ORIG_SIZE) { |
| 516 | hid_info(hdev, |
| 517 | "fixing up Logitech Driving Force Pro report descriptor\n"); |
| 518 | rdesc = dfp_rdesc_fixed; |
| 519 | *rsize = sizeof(dfp_rdesc_fixed); |
| 520 | } |
| 521 | break; |
Simon Wood | b5836246 | 2013-02-19 20:25:11 -0700 | [diff] [blame] | 522 | |
| 523 | case USB_DEVICE_ID_LOGITECH_WII_WHEEL: |
| 524 | if (*rsize >= 101 && rdesc[41] == 0x95 && rdesc[42] == 0x0B && |
| 525 | rdesc[47] == 0x05 && rdesc[48] == 0x09) { |
| 526 | hid_info(hdev, "fixing up Logitech Speed Force Wireless report descriptor\n"); |
| 527 | rdesc[41] = 0x05; |
| 528 | rdesc[42] = 0x09; |
| 529 | rdesc[47] = 0x95; |
| 530 | rdesc[48] = 0x0B; |
| 531 | } |
| 532 | break; |
Michael Bauer | dc0a4f0 | 2011-06-02 15:40:14 -0700 | [diff] [blame] | 533 | } |
| 534 | |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 535 | return rdesc; |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 536 | } |
| 537 | |
| 538 | #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ |
| 539 | EV_KEY, (c)) |
| 540 | |
| 541 | static int lg_ultrax_remote_mapping(struct hid_input *hi, |
| 542 | struct hid_usage *usage, unsigned long **bit, int *max) |
| 543 | { |
| 544 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) |
| 545 | return 0; |
| 546 | |
| 547 | set_bit(EV_REP, hi->input->evbit); |
| 548 | switch (usage->hid & HID_USAGE) { |
| 549 | /* Reported on Logitech Ultra X Media Remote */ |
| 550 | case 0x004: lg_map_key_clear(KEY_AGAIN); break; |
| 551 | case 0x00d: lg_map_key_clear(KEY_HOME); break; |
| 552 | case 0x024: lg_map_key_clear(KEY_SHUFFLE); break; |
| 553 | case 0x025: lg_map_key_clear(KEY_TV); break; |
| 554 | case 0x026: lg_map_key_clear(KEY_MENU); break; |
| 555 | case 0x031: lg_map_key_clear(KEY_AUDIO); break; |
| 556 | case 0x032: lg_map_key_clear(KEY_TEXT); break; |
| 557 | case 0x033: lg_map_key_clear(KEY_LAST); break; |
| 558 | case 0x047: lg_map_key_clear(KEY_MP3); break; |
| 559 | case 0x048: lg_map_key_clear(KEY_DVD); break; |
| 560 | case 0x049: lg_map_key_clear(KEY_MEDIA); break; |
| 561 | case 0x04a: lg_map_key_clear(KEY_VIDEO); break; |
| 562 | case 0x04b: lg_map_key_clear(KEY_ANGLE); break; |
| 563 | case 0x04c: lg_map_key_clear(KEY_LANGUAGE); break; |
| 564 | case 0x04d: lg_map_key_clear(KEY_SUBTITLE); break; |
| 565 | case 0x051: lg_map_key_clear(KEY_RED); break; |
| 566 | case 0x052: lg_map_key_clear(KEY_CLOSE); break; |
| 567 | |
| 568 | default: |
| 569 | return 0; |
| 570 | } |
| 571 | return 1; |
| 572 | } |
| 573 | |
Jiri Kosina | 66d61be | 2009-11-24 18:22:20 +0100 | [diff] [blame] | 574 | static int lg_dinovo_mapping(struct hid_input *hi, struct hid_usage *usage, |
| 575 | unsigned long **bit, int *max) |
| 576 | { |
| 577 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) |
| 578 | return 0; |
| 579 | |
| 580 | switch (usage->hid & HID_USAGE) { |
| 581 | |
| 582 | case 0x00d: lg_map_key_clear(KEY_MEDIA); break; |
| 583 | default: |
| 584 | return 0; |
| 585 | |
| 586 | } |
| 587 | return 1; |
| 588 | } |
| 589 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 590 | static int lg_wireless_mapping(struct hid_input *hi, struct hid_usage *usage, |
| 591 | unsigned long **bit, int *max) |
| 592 | { |
| 593 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) |
| 594 | return 0; |
| 595 | |
| 596 | switch (usage->hid & HID_USAGE) { |
| 597 | case 0x1001: lg_map_key_clear(KEY_MESSENGER); break; |
| 598 | case 0x1003: lg_map_key_clear(KEY_SOUND); break; |
| 599 | case 0x1004: lg_map_key_clear(KEY_VIDEO); break; |
| 600 | case 0x1005: lg_map_key_clear(KEY_AUDIO); break; |
| 601 | case 0x100a: lg_map_key_clear(KEY_DOCUMENTS); break; |
Lorenzo Castelli | 18392212 | 2010-04-16 19:00:31 +0200 | [diff] [blame] | 602 | /* The following two entries are Playlist 1 and 2 on the MX3200 */ |
| 603 | case 0x100f: lg_map_key_clear(KEY_FN_1); break; |
| 604 | case 0x1010: lg_map_key_clear(KEY_FN_2); break; |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 605 | case 0x1011: lg_map_key_clear(KEY_PREVIOUSSONG); break; |
| 606 | case 0x1012: lg_map_key_clear(KEY_NEXTSONG); break; |
| 607 | case 0x1013: lg_map_key_clear(KEY_CAMERA); break; |
| 608 | case 0x1014: lg_map_key_clear(KEY_MESSENGER); break; |
| 609 | case 0x1015: lg_map_key_clear(KEY_RECORD); break; |
| 610 | case 0x1016: lg_map_key_clear(KEY_PLAYER); break; |
| 611 | case 0x1017: lg_map_key_clear(KEY_EJECTCD); break; |
| 612 | case 0x1018: lg_map_key_clear(KEY_MEDIA); break; |
| 613 | case 0x1019: lg_map_key_clear(KEY_PROG1); break; |
| 614 | case 0x101a: lg_map_key_clear(KEY_PROG2); break; |
| 615 | case 0x101b: lg_map_key_clear(KEY_PROG3); break; |
Lorenzo Castelli | 18392212 | 2010-04-16 19:00:31 +0200 | [diff] [blame] | 616 | case 0x101c: lg_map_key_clear(KEY_CYCLEWINDOWS); break; |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 617 | case 0x101f: lg_map_key_clear(KEY_ZOOMIN); break; |
| 618 | case 0x1020: lg_map_key_clear(KEY_ZOOMOUT); break; |
| 619 | case 0x1021: lg_map_key_clear(KEY_ZOOMRESET); break; |
| 620 | case 0x1023: lg_map_key_clear(KEY_CLOSE); break; |
| 621 | case 0x1027: lg_map_key_clear(KEY_MENU); break; |
| 622 | /* this one is marked as 'Rotate' */ |
| 623 | case 0x1028: lg_map_key_clear(KEY_ANGLE); break; |
| 624 | case 0x1029: lg_map_key_clear(KEY_SHUFFLE); break; |
| 625 | case 0x102a: lg_map_key_clear(KEY_BACK); break; |
| 626 | case 0x102b: lg_map_key_clear(KEY_CYCLEWINDOWS); break; |
Lorenzo Castelli | 18392212 | 2010-04-16 19:00:31 +0200 | [diff] [blame] | 627 | case 0x102d: lg_map_key_clear(KEY_WWW); break; |
| 628 | /* The following two are 'Start/answer call' and 'End/reject call' |
| 629 | on the MX3200 */ |
| 630 | case 0x1031: lg_map_key_clear(KEY_OK); break; |
| 631 | case 0x1032: lg_map_key_clear(KEY_CANCEL); break; |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 632 | case 0x1041: lg_map_key_clear(KEY_BATTERY); break; |
| 633 | case 0x1042: lg_map_key_clear(KEY_WORDPROCESSOR); break; |
| 634 | case 0x1043: lg_map_key_clear(KEY_SPREADSHEET); break; |
| 635 | case 0x1044: lg_map_key_clear(KEY_PRESENTATION); break; |
| 636 | case 0x1045: lg_map_key_clear(KEY_UNDO); break; |
| 637 | case 0x1046: lg_map_key_clear(KEY_REDO); break; |
| 638 | case 0x1047: lg_map_key_clear(KEY_PRINT); break; |
| 639 | case 0x1048: lg_map_key_clear(KEY_SAVE); break; |
| 640 | case 0x1049: lg_map_key_clear(KEY_PROG1); break; |
| 641 | case 0x104a: lg_map_key_clear(KEY_PROG2); break; |
| 642 | case 0x104b: lg_map_key_clear(KEY_PROG3); break; |
| 643 | case 0x104c: lg_map_key_clear(KEY_PROG4); break; |
| 644 | |
| 645 | default: |
| 646 | return 0; |
| 647 | } |
| 648 | return 1; |
| 649 | } |
| 650 | |
| 651 | static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
| 652 | struct hid_field *field, struct hid_usage *usage, |
| 653 | unsigned long **bit, int *max) |
| 654 | { |
| 655 | /* extended mapping for certain Logitech hardware (Logitech cordless |
| 656 | desktop LX500) */ |
| 657 | static const u8 e_keymap[] = { |
| 658 | 0,216, 0,213,175,156, 0, 0, 0, 0, |
| 659 | 144, 0, 0, 0, 0, 0, 0, 0, 0,212, |
| 660 | 174,167,152,161,112, 0, 0, 0,154, 0, |
| 661 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 662 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 663 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 664 | 0, 0, 0, 0, 0,183,184,185,186,187, |
| 665 | 188,189,190,191,192,193,194, 0, 0, 0 |
| 666 | }; |
Axel Lin | 2575155 | 2012-09-13 14:08:32 +0800 | [diff] [blame] | 667 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 668 | unsigned int hid = usage->hid; |
| 669 | |
| 670 | if (hdev->product == USB_DEVICE_ID_LOGITECH_RECEIVER && |
| 671 | lg_ultrax_remote_mapping(hi, usage, bit, max)) |
| 672 | return 1; |
| 673 | |
Jiri Kosina | 66d61be | 2009-11-24 18:22:20 +0100 | [diff] [blame] | 674 | if (hdev->product == USB_DEVICE_ID_DINOVO_MINI && |
| 675 | lg_dinovo_mapping(hi, usage, bit, max)) |
| 676 | return 1; |
| 677 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 678 | if ((drv_data->quirks & LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max)) |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 679 | return 1; |
| 680 | |
| 681 | if ((hid & HID_USAGE_PAGE) != HID_UP_BUTTON) |
| 682 | return 0; |
| 683 | |
| 684 | hid &= HID_USAGE; |
| 685 | |
| 686 | /* Special handling for Logitech Cordless Desktop */ |
| 687 | if (field->application == HID_GD_MOUSE) { |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 688 | if ((drv_data->quirks & LG_IGNORE_DOUBLED_WHEEL) && |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 689 | (hid == 7 || hid == 8)) |
| 690 | return -1; |
| 691 | } else { |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 692 | if ((drv_data->quirks & LG_EXPANDED_KEYMAP) && |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 693 | hid < ARRAY_SIZE(e_keymap) && |
| 694 | e_keymap[hid] != 0) { |
| 695 | hid_map_usage(hi, usage, bit, max, EV_KEY, |
| 696 | e_keymap[hid]); |
| 697 | return 1; |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | return 0; |
| 702 | } |
| 703 | |
| 704 | static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
| 705 | struct hid_field *field, struct hid_usage *usage, |
| 706 | unsigned long **bit, int *max) |
| 707 | { |
Axel Lin | 2575155 | 2012-09-13 14:08:32 +0800 | [diff] [blame] | 708 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 709 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 710 | if ((drv_data->quirks & LG_BAD_RELATIVE_KEYS) && usage->type == EV_KEY && |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 711 | (field->flags & HID_MAIN_ITEM_RELATIVE)) |
| 712 | field->flags &= ~HID_MAIN_ITEM_RELATIVE; |
| 713 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 714 | if ((drv_data->quirks & LG_DUPLICATE_USAGES) && (usage->type == EV_KEY || |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 715 | usage->type == EV_REL || usage->type == EV_ABS)) |
| 716 | clear_bit(usage->code, *bit); |
| 717 | |
Simon Wood | 94b3f71 | 2013-02-19 20:25:12 -0700 | [diff] [blame] | 718 | /* Ensure that Logitech wheels are not given a default fuzz/flat value */ |
| 719 | if (usage->type == EV_ABS && (usage->code == ABS_X || |
| 720 | usage->code == ABS_Y || usage->code == ABS_Z || |
| 721 | usage->code == ABS_RZ)) { |
| 722 | switch (hdev->product) { |
Simon Wood | 29fae1c | 2015-11-02 07:56:52 -0700 | [diff] [blame] | 723 | case USB_DEVICE_ID_LOGITECH_G29_WHEEL: |
Jarrad Whitaker | e41b3cd | 2019-01-24 22:40:50 +1100 | [diff] [blame] | 724 | case USB_DEVICE_ID_LOGITECH_WINGMAN_FG: |
Simon Wood | 560bea3 | 2016-09-18 10:55:41 -0600 | [diff] [blame] | 725 | case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG: |
Simon Wood | 94b3f71 | 2013-02-19 20:25:12 -0700 | [diff] [blame] | 726 | case USB_DEVICE_ID_LOGITECH_WHEEL: |
| 727 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: |
| 728 | case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: |
| 729 | case USB_DEVICE_ID_LOGITECH_G25_WHEEL: |
| 730 | case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL: |
| 731 | case USB_DEVICE_ID_LOGITECH_G27_WHEEL: |
| 732 | case USB_DEVICE_ID_LOGITECH_WII_WHEEL: |
| 733 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: |
Elias Vanderstuyft | bd04363 | 2013-10-07 19:48:12 +0300 | [diff] [blame] | 734 | case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: |
Simon Wood | 94b3f71 | 2013-02-19 20:25:12 -0700 | [diff] [blame] | 735 | field->application = HID_GD_MULTIAXIS; |
| 736 | break; |
| 737 | default: |
| 738 | break; |
| 739 | } |
| 740 | } |
| 741 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 742 | return 0; |
| 743 | } |
| 744 | |
| 745 | static int lg_event(struct hid_device *hdev, struct hid_field *field, |
| 746 | struct hid_usage *usage, __s32 value) |
| 747 | { |
Axel Lin | 2575155 | 2012-09-13 14:08:32 +0800 | [diff] [blame] | 748 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 749 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 750 | if ((drv_data->quirks & LG_INVERT_HWHEEL) && usage->code == REL_HWHEEL) { |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 751 | input_event(field->hidinput->input, usage->type, usage->code, |
| 752 | -value); |
| 753 | return 1; |
| 754 | } |
Michal Malý | 2b24a96 | 2012-09-23 22:41:08 +0200 | [diff] [blame] | 755 | if (drv_data->quirks & LG_FF4) { |
| 756 | return lg4ff_adjust_input_event(hdev, field, usage, value, drv_data); |
| 757 | } |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 758 | |
| 759 | return 0; |
| 760 | } |
| 761 | |
Simon Wood | c832f86 | 2016-09-18 10:55:38 -0600 | [diff] [blame] | 762 | static int lg_raw_event(struct hid_device *hdev, struct hid_report *report, |
| 763 | u8 *rd, int size) |
| 764 | { |
| 765 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
| 766 | |
| 767 | if (drv_data->quirks & LG_FF4) |
| 768 | return lg4ff_raw_event(hdev, report, rd, size, drv_data); |
| 769 | |
| 770 | return 0; |
| 771 | } |
| 772 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 773 | static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) |
| 774 | { |
Simon Wood | 29fae1c | 2015-11-02 07:56:52 -0700 | [diff] [blame] | 775 | struct usb_interface *iface = to_usb_interface(hdev->dev.parent); |
| 776 | __u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 777 | unsigned int connect_mask = HID_CONNECT_DEFAULT; |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 778 | struct lg_drv_data *drv_data; |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 779 | int ret; |
| 780 | |
Benjamin Tissoires | 2078665 | 2015-12-01 10:26:24 +0100 | [diff] [blame] | 781 | /* G29 only work with the 1st interface */ |
| 782 | if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) && |
| 783 | (iface_num != 0)) { |
Simon Wood | 29fae1c | 2015-11-02 07:56:52 -0700 | [diff] [blame] | 784 | dbg_hid("%s: ignoring ifnum %d\n", __func__, iface_num); |
| 785 | return -ENODEV; |
| 786 | } |
| 787 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 788 | drv_data = kzalloc(sizeof(struct lg_drv_data), GFP_KERNEL); |
| 789 | if (!drv_data) { |
| 790 | hid_err(hdev, "Insufficient memory, cannot allocate driver data\n"); |
| 791 | return -ENOMEM; |
| 792 | } |
| 793 | drv_data->quirks = id->driver_data; |
Michal Malý | a80fe5d | 2012-09-24 01:13:17 +0200 | [diff] [blame] | 794 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 795 | hid_set_drvdata(hdev, (void *)drv_data); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 796 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 797 | if (drv_data->quirks & LG_NOGET) |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 798 | hdev->quirks |= HID_QUIRK_NOGET; |
| 799 | |
| 800 | ret = hid_parse(hdev); |
| 801 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 802 | hid_err(hdev, "parse failed\n"); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 803 | goto err_free; |
| 804 | } |
| 805 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 806 | if (drv_data->quirks & (LG_FF | LG_FF2 | LG_FF3 | LG_FF4)) |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 807 | connect_mask &= ~HID_CONNECT_FF; |
| 808 | |
| 809 | ret = hid_hw_start(hdev, connect_mask); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 810 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 811 | hid_err(hdev, "hw start failed\n"); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 812 | goto err_free; |
| 813 | } |
| 814 | |
Michal Malý | 7362cd2 | 2011-08-04 16:16:09 +0200 | [diff] [blame] | 815 | /* Setup wireless link with Logitech Wii wheel */ |
Michal Malý | a80fe5d | 2012-09-24 01:13:17 +0200 | [diff] [blame] | 816 | if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { |
Colin Ian King | 47af1cd | 2017-08-25 18:12:50 +0100 | [diff] [blame] | 817 | static const unsigned char cbuf[] = { |
| 818 | 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
| 819 | }; |
Benjamin Tissoires | 061232f | 2016-11-21 11:48:40 +0100 | [diff] [blame] | 820 | u8 *buf = kmemdup(cbuf, sizeof(cbuf), GFP_KERNEL); |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 821 | |
Benjamin Tissoires | 061232f | 2016-11-21 11:48:40 +0100 | [diff] [blame] | 822 | if (!buf) { |
| 823 | ret = -ENOMEM; |
| 824 | goto err_free; |
| 825 | } |
| 826 | |
| 827 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), |
Benjamin Tissoires | b0dd72a | 2014-02-10 12:58:54 -0500 | [diff] [blame] | 828 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 829 | if (ret >= 0) { |
| 830 | /* insert a little delay of 10 jiffies ~ 40ms */ |
| 831 | wait_queue_head_t wait; |
| 832 | init_waitqueue_head (&wait); |
Nicholas Mc Guire | e039306 | 2015-05-02 17:55:15 +0200 | [diff] [blame] | 833 | wait_event_interruptible_timeout(wait, 0, |
| 834 | msecs_to_jiffies(40)); |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 835 | |
| 836 | /* Select random Address */ |
| 837 | buf[1] = 0xB2; |
| 838 | get_random_bytes(&buf[2], 2); |
| 839 | |
Benjamin Tissoires | 061232f | 2016-11-21 11:48:40 +0100 | [diff] [blame] | 840 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), |
Benjamin Tissoires | b0dd72a | 2014-02-10 12:58:54 -0500 | [diff] [blame] | 841 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 842 | } |
Benjamin Tissoires | 061232f | 2016-11-21 11:48:40 +0100 | [diff] [blame] | 843 | kfree(buf); |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 844 | } |
| 845 | |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 846 | if (drv_data->quirks & LG_FF) |
Michal Malý | 2dbf635 | 2015-04-08 22:56:45 +0200 | [diff] [blame] | 847 | ret = lgff_init(hdev); |
Michal Malý | f4e1eb9 | 2015-04-08 22:56:53 +0200 | [diff] [blame] | 848 | else if (drv_data->quirks & LG_FF2) |
Michal Malý | 2dbf635 | 2015-04-08 22:56:45 +0200 | [diff] [blame] | 849 | ret = lg2ff_init(hdev); |
Michal Malý | f4e1eb9 | 2015-04-08 22:56:53 +0200 | [diff] [blame] | 850 | else if (drv_data->quirks & LG_FF3) |
Michal Malý | 2dbf635 | 2015-04-08 22:56:45 +0200 | [diff] [blame] | 851 | ret = lg3ff_init(hdev); |
Michal Malý | f4e1eb9 | 2015-04-08 22:56:53 +0200 | [diff] [blame] | 852 | else if (drv_data->quirks & LG_FF4) |
Michal Malý | 2dbf635 | 2015-04-08 22:56:45 +0200 | [diff] [blame] | 853 | ret = lg4ff_init(hdev); |
| 854 | |
| 855 | if (ret) |
| 856 | goto err_free; |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 857 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 858 | return 0; |
| 859 | err_free: |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 860 | kfree(drv_data); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 861 | return ret; |
| 862 | } |
| 863 | |
Michal Malý | 30bb75d | 2011-08-04 16:20:40 +0200 | [diff] [blame] | 864 | static void lg_remove(struct hid_device *hdev) |
| 865 | { |
Axel Lin | 2575155 | 2012-09-13 14:08:32 +0800 | [diff] [blame] | 866 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 867 | if (drv_data->quirks & LG_FF4) |
Michal Malý | 30bb75d | 2011-08-04 16:20:40 +0200 | [diff] [blame] | 868 | lg4ff_deinit(hdev); |
Michal Malý | b211a63 | 2015-04-08 22:56:47 +0200 | [diff] [blame] | 869 | else |
| 870 | hid_hw_stop(hdev); |
Michal Malý | 8577dbf | 2012-03-31 11:17:25 +0200 | [diff] [blame] | 871 | kfree(drv_data); |
Michal Malý | 30bb75d | 2011-08-04 16:20:40 +0200 | [diff] [blame] | 872 | } |
| 873 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 874 | static const struct hid_device_id lg_devices[] = { |
| 875 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER), |
| 876 | .driver_data = LG_RDESC | LG_WIRELESS }, |
| 877 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER), |
| 878 | .driver_data = LG_RDESC | LG_WIRELESS }, |
| 879 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2), |
| 880 | .driver_data = LG_RDESC | LG_WIRELESS }, |
| 881 | |
| 882 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER), |
| 883 | .driver_data = LG_BAD_RELATIVE_KEYS }, |
| 884 | |
| 885 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP), |
| 886 | .driver_data = LG_DUPLICATE_USAGES }, |
| 887 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE), |
| 888 | .driver_data = LG_DUPLICATE_USAGES }, |
| 889 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI), |
| 890 | .driver_data = LG_DUPLICATE_USAGES }, |
| 891 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 892 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD), |
| 893 | .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, |
| 894 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), |
| 895 | .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, |
| 896 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 897 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), |
| 898 | .driver_data = LG_NOGET }, |
Vitaly Katraew | 56d0c8b | 2013-11-30 13:51:28 +0400 | [diff] [blame] | 899 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DUAL_ACTION), |
| 900 | .driver_data = LG_NOGET }, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 901 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), |
Michal Malý | 7362cd2 | 2011-08-04 16:16:09 +0200 | [diff] [blame] | 902 | .driver_data = LG_NOGET | LG_FF4 }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 903 | |
Hendrik Iben | 2c6118e | 2010-10-04 15:39:49 +0200 | [diff] [blame] | 904 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD), |
| 905 | .driver_data = LG_FF2 }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 906 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD), |
| 907 | .driver_data = LG_FF }, |
| 908 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2), |
| 909 | .driver_data = LG_FF }, |
Simon Wood | c873d9a | 2015-07-23 19:10:03 -0600 | [diff] [blame] | 910 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL), |
| 911 | .driver_data = LG_FF4 }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 912 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D), |
| 913 | .driver_data = LG_FF }, |
| 914 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO), |
| 915 | .driver_data = LG_FF }, |
| 916 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL), |
Simon Wood | 270baef | 2013-02-19 20:25:10 -0700 | [diff] [blame] | 917 | .driver_data = LG_NOGET | LG_FF4 }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 918 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2), |
Michal Malý | 7362cd2 | 2011-08-04 16:16:09 +0200 | [diff] [blame] | 919 | .driver_data = LG_FF4 }, |
Elias Vanderstuyft | bd04363 | 2013-10-07 19:48:12 +0300 | [diff] [blame] | 920 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL), |
| 921 | .driver_data = LG_FF2 }, |
Christophe Borivant | 243b706 | 2009-04-17 11:39:39 +0200 | [diff] [blame] | 922 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL), |
Michal Malý | 7362cd2 | 2011-08-04 16:16:09 +0200 | [diff] [blame] | 923 | .driver_data = LG_FF4 }, |
| 924 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL), |
| 925 | .driver_data = LG_FF4 }, |
Peter Gundermann | fdc6807 | 2011-05-03 10:15:03 +0200 | [diff] [blame] | 926 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL), |
Michal Malý | 7362cd2 | 2011-08-04 16:16:09 +0200 | [diff] [blame] | 927 | .driver_data = LG_FF4 }, |
Jiri Kosina | 5623a24 | 2011-03-17 00:43:23 +0100 | [diff] [blame] | 928 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL), |
Michal Malý | 7362cd2 | 2011-08-04 16:16:09 +0200 | [diff] [blame] | 929 | .driver_data = LG_NOGET | LG_FF4 }, |
Simon Wood | 32c88cb | 2010-09-22 13:19:42 +0200 | [diff] [blame] | 930 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL), |
| 931 | .driver_data = LG_FF4 }, |
Jarrad Whitaker | e41b3cd | 2019-01-24 22:40:50 +1100 | [diff] [blame] | 932 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FG), |
| 933 | .driver_data = LG_NOGET }, |
Michal Malý | a80fe5d | 2012-09-24 01:13:17 +0200 | [diff] [blame] | 934 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG), |
Simon Wood | 560bea3 | 2016-09-18 10:55:41 -0600 | [diff] [blame] | 935 | .driver_data = LG_NOGET | LG_FF4 }, |
Jiri Slaby | 606bd0a | 2008-07-04 23:06:45 +0200 | [diff] [blame] | 936 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), |
Ardinartsev Nikita | 877a021 | 2017-01-26 16:54:42 +0300 | [diff] [blame] | 937 | .driver_data = LG_NOGET | LG_FF2 }, |
Gary Stein | 74f292c | 2010-01-13 00:25:58 +0100 | [diff] [blame] | 938 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), |
| 939 | .driver_data = LG_FF3 }, |
Jiri Kosina | 24985cf | 2009-11-13 10:45:53 +0100 | [diff] [blame] | 940 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), |
| 941 | .driver_data = LG_RDESC_REL_ABS }, |
| 942 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER), |
| 943 | .driver_data = LG_RDESC_REL_ABS }, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 944 | { } |
| 945 | }; |
Jiri Kosina | 24985cf | 2009-11-13 10:45:53 +0100 | [diff] [blame] | 946 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 947 | MODULE_DEVICE_TABLE(hid, lg_devices); |
| 948 | |
| 949 | static struct hid_driver lg_driver = { |
| 950 | .name = "logitech", |
| 951 | .id_table = lg_devices, |
| 952 | .report_fixup = lg_report_fixup, |
| 953 | .input_mapping = lg_input_mapping, |
| 954 | .input_mapped = lg_input_mapped, |
| 955 | .event = lg_event, |
Simon Wood | c832f86 | 2016-09-18 10:55:38 -0600 | [diff] [blame] | 956 | .raw_event = lg_raw_event, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 957 | .probe = lg_probe, |
Michal Malý | 30bb75d | 2011-08-04 16:20:40 +0200 | [diff] [blame] | 958 | .remove = lg_remove, |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 959 | }; |
H Hartley Sweeten | f425458 | 2012-12-17 15:28:26 -0700 | [diff] [blame] | 960 | module_hid_driver(lg_driver); |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 961 | |
Michal Malý | a54dc779 | 2015-02-18 17:59:22 +0100 | [diff] [blame] | 962 | #ifdef CONFIG_LOGIWHEELS_FF |
| 963 | int lg4ff_no_autoswitch = 0; |
| 964 | module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO); |
| 965 | MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically"); |
| 966 | #endif |
| 967 | |
Jiri Slaby | 5f22a79 | 2008-05-16 11:49:19 +0200 | [diff] [blame] | 968 | MODULE_LICENSE("GPL"); |