1 /* 2 * HID driver for some logitech "special" devices 3 * 4 * Copyright (c) 1999 Andreas Gal 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 7 * Copyright (c) 2006-2007 Jiri Kosina 8 * Copyright (c) 2008 Jiri Slaby 9 * Copyright (c) 2010 Hendrik Iben 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> 22 #include <linux/random.h> 23 #include <linux/sched.h> 24 #include <linux/usb.h> 25 #include <linux/wait.h> 26 27 #include "usbhid/usbhid.h" 28 #include "hid-ids.h" 29 #include "hid-lg.h" 30 #include "hid-lg4ff.h" 31 32 #define LG_RDESC 0x001 33 #define LG_BAD_RELATIVE_KEYS 0x002 34 #define LG_DUPLICATE_USAGES 0x004 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 40 #define LG_FF 0x200 41 #define LG_FF2 0x400 42 #define LG_RDESC_REL_ABS 0x800 43 #define LG_FF3 0x1000 44 #define LG_FF4 0x2000 45 46 /* Size of the original descriptors of the Driving Force (and Pro) wheels */ 47 #define DF_RDESC_ORIG_SIZE 130 48 #define DFP_RDESC_ORIG_SIZE 97 49 #define FV_RDESC_ORIG_SIZE 130 50 #define MOMO_RDESC_ORIG_SIZE 87 51 #define MOMO2_RDESC_ORIG_SIZE 87 52 #define FFG_RDESC_ORIG_SIZE 85 53 #define FG_RDESC_ORIG_SIZE 82 54 55 /* Fixed report descriptors for Logitech Driving Force (and Pro) 56 * wheel controllers 57 * 58 * The original descriptors hide the separate throttle and brake axes in 59 * a custom vendor usage page, providing only a combined value as 60 * GenericDesktop.Y. 61 * These descriptors remove the combined Y axis and instead report 62 * separate throttle (Y) and brake (RZ). 63 */ 64 static __u8 df_rdesc_fixed[] = { 65 0x05, 0x01, /* Usage Page (Desktop), */ 66 0x09, 0x04, /* Usage (Joystick), */ 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), */ 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), */ 109 0x05, 0x01, /* Usage Page (Desktop), */ 110 0x95, 0x01, /* Report Count (1), */ 111 0x75, 0x08, /* Report Size (8), */ 112 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ 113 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ 114 0x09, 0x31, /* Usage (Y), */ 115 0x81, 0x02, /* Input (Variable), */ 116 0x09, 0x35, /* Usage (Rz), */ 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 130 static __u8 dfp_rdesc_fixed[] = { 131 0x05, 0x01, /* Usage Page (Desktop), */ 132 0x09, 0x04, /* Usage (Joystick), */ 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 178 static __u8 fv_rdesc_fixed[] = { 179 0x05, 0x01, /* Usage Page (Desktop), */ 180 0x09, 0x04, /* Usage (Joystick), */ 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 245 static __u8 momo_rdesc_fixed[] = { 246 0x05, 0x01, /* Usage Page (Desktop), */ 247 0x09, 0x04, /* Usage (Joystick), */ 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 }; 290 291 static __u8 momo2_rdesc_fixed[] = { 292 0x05, 0x01, /* Usage Page (Desktop), */ 293 0x09, 0x04, /* Usage (Joystick), */ 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 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 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 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 */ 433 static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, 434 unsigned int *rsize) 435 { 436 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); 437 438 if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 && 439 rdesc[84] == 0x8c && rdesc[85] == 0x02) { 440 hid_info(hdev, 441 "fixing up Logitech keyboard report descriptor\n"); 442 rdesc[84] = rdesc[89] = 0x4d; 443 rdesc[85] = rdesc[90] = 0x10; 444 } 445 if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 && 446 rdesc[32] == 0x81 && rdesc[33] == 0x06 && 447 rdesc[49] == 0x81 && rdesc[50] == 0x06) { 448 hid_info(hdev, 449 "fixing up rel/abs in Logitech report descriptor\n"); 450 rdesc[33] = rdesc[50] = 0x02; 451 } 452 453 switch (hdev->product) { 454 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 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 477 /* Several wheels report as this id when operating in emulation mode. */ 478 case USB_DEVICE_ID_LOGITECH_WHEEL: 479 if (*rsize == DF_RDESC_ORIG_SIZE) { 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 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 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 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 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; 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; 533 } 534 535 return rdesc; 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 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 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; 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; 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; 616 case 0x101c: lg_map_key_clear(KEY_CYCLEWINDOWS); break; 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; 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; 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 }; 667 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); 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 674 if (hdev->product == USB_DEVICE_ID_DINOVO_MINI && 675 lg_dinovo_mapping(hi, usage, bit, max)) 676 return 1; 677 678 if ((drv_data->quirks & LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max)) 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) { 688 if ((drv_data->quirks & LG_IGNORE_DOUBLED_WHEEL) && 689 (hid == 7 || hid == 8)) 690 return -1; 691 } else { 692 if ((drv_data->quirks & LG_EXPANDED_KEYMAP) && 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 { 708 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); 709 710 if ((drv_data->quirks & LG_BAD_RELATIVE_KEYS) && usage->type == EV_KEY && 711 (field->flags & HID_MAIN_ITEM_RELATIVE)) 712 field->flags &= ~HID_MAIN_ITEM_RELATIVE; 713 714 if ((drv_data->quirks & LG_DUPLICATE_USAGES) && (usage->type == EV_KEY || 715 usage->type == EV_REL || usage->type == EV_ABS)) 716 clear_bit(usage->code, *bit); 717 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) { 723 case USB_DEVICE_ID_LOGITECH_G29_WHEEL: 724 case USB_DEVICE_ID_LOGITECH_WINGMAN_FG: 725 case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG: 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: 734 case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: 735 field->application = HID_GD_MULTIAXIS; 736 break; 737 default: 738 break; 739 } 740 } 741 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 { 748 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); 749 750 if ((drv_data->quirks & LG_INVERT_HWHEEL) && usage->code == REL_HWHEEL) { 751 input_event(field->hidinput->input, usage->type, usage->code, 752 -value); 753 return 1; 754 } 755 if (drv_data->quirks & LG_FF4) { 756 return lg4ff_adjust_input_event(hdev, field, usage, value, drv_data); 757 } 758 759 return 0; 760 } 761 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 773 static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) 774 { 775 struct usb_interface *iface = to_usb_interface(hdev->dev.parent); 776 __u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 777 unsigned int connect_mask = HID_CONNECT_DEFAULT; 778 struct lg_drv_data *drv_data; 779 int ret; 780 781 /* G29 only work with the 1st interface */ 782 if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) && 783 (iface_num != 0)) { 784 dbg_hid("%s: ignoring ifnum %d\n", __func__, iface_num); 785 return -ENODEV; 786 } 787 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; 794 795 hid_set_drvdata(hdev, (void *)drv_data); 796 797 if (drv_data->quirks & LG_NOGET) 798 hdev->quirks |= HID_QUIRK_NOGET; 799 800 ret = hid_parse(hdev); 801 if (ret) { 802 hid_err(hdev, "parse failed\n"); 803 goto err_free; 804 } 805 806 if (drv_data->quirks & (LG_FF | LG_FF2 | LG_FF3 | LG_FF4)) 807 connect_mask &= ~HID_CONNECT_FF; 808 809 ret = hid_hw_start(hdev, connect_mask); 810 if (ret) { 811 hid_err(hdev, "hw start failed\n"); 812 goto err_free; 813 } 814 815 /* Setup wireless link with Logitech Wii wheel */ 816 if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { 817 static const unsigned char cbuf[] = { 818 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 819 }; 820 u8 *buf = kmemdup(cbuf, sizeof(cbuf), GFP_KERNEL); 821 822 if (!buf) { 823 ret = -ENOMEM; 824 goto err_free; 825 } 826 827 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), 828 HID_FEATURE_REPORT, HID_REQ_SET_REPORT); 829 if (ret >= 0) { 830 /* insert a little delay of 10 jiffies ~ 40ms */ 831 wait_queue_head_t wait; 832 init_waitqueue_head (&wait); 833 wait_event_interruptible_timeout(wait, 0, 834 msecs_to_jiffies(40)); 835 836 /* Select random Address */ 837 buf[1] = 0xB2; 838 get_random_bytes(&buf[2], 2); 839 840 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), 841 HID_FEATURE_REPORT, HID_REQ_SET_REPORT); 842 } 843 kfree(buf); 844 } 845 846 if (drv_data->quirks & LG_FF) 847 ret = lgff_init(hdev); 848 else if (drv_data->quirks & LG_FF2) 849 ret = lg2ff_init(hdev); 850 else if (drv_data->quirks & LG_FF3) 851 ret = lg3ff_init(hdev); 852 else if (drv_data->quirks & LG_FF4) 853 ret = lg4ff_init(hdev); 854 855 if (ret) 856 goto err_free; 857 858 return 0; 859 err_free: 860 kfree(drv_data); 861 return ret; 862 } 863 864 static void lg_remove(struct hid_device *hdev) 865 { 866 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); 867 if (drv_data->quirks & LG_FF4) 868 lg4ff_deinit(hdev); 869 else 870 hid_hw_stop(hdev); 871 kfree(drv_data); 872 } 873 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 880 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER), 881 .driver_data = LG_BAD_RELATIVE_KEYS }, 882 883 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP), 884 .driver_data = LG_DUPLICATE_USAGES }, 885 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE), 886 .driver_data = LG_DUPLICATE_USAGES }, 887 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI), 888 .driver_data = LG_DUPLICATE_USAGES }, 889 890 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD), 891 .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, 892 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), 893 .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, 894 895 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), 896 .driver_data = LG_NOGET }, 897 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DUAL_ACTION), 898 .driver_data = LG_NOGET }, 899 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), 900 .driver_data = LG_NOGET | LG_FF4 }, 901 902 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD), 903 .driver_data = LG_FF2 }, 904 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD), 905 .driver_data = LG_FF }, 906 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2), 907 .driver_data = LG_FF }, 908 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL), 909 .driver_data = LG_FF4 }, 910 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D), 911 .driver_data = LG_FF }, 912 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO), 913 .driver_data = LG_FF }, 914 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL), 915 .driver_data = LG_NOGET | LG_FF4 }, 916 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2), 917 .driver_data = LG_FF4 }, 918 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL), 919 .driver_data = LG_FF2 }, 920 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL), 921 .driver_data = LG_FF4 }, 922 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL), 923 .driver_data = LG_FF4 }, 924 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL), 925 .driver_data = LG_FF4 }, 926 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL), 927 .driver_data = LG_NOGET | LG_FF4 }, 928 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL), 929 .driver_data = LG_FF4 }, 930 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FG), 931 .driver_data = LG_NOGET }, 932 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG), 933 .driver_data = LG_NOGET | LG_FF4 }, 934 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), 935 .driver_data = LG_NOGET | LG_FF2 }, 936 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), 937 .driver_data = LG_FF3 }, 938 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), 939 .driver_data = LG_RDESC_REL_ABS }, 940 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER), 941 .driver_data = LG_RDESC_REL_ABS }, 942 { } 943 }; 944 945 MODULE_DEVICE_TABLE(hid, lg_devices); 946 947 static struct hid_driver lg_driver = { 948 .name = "logitech", 949 .id_table = lg_devices, 950 .report_fixup = lg_report_fixup, 951 .input_mapping = lg_input_mapping, 952 .input_mapped = lg_input_mapped, 953 .event = lg_event, 954 .raw_event = lg_raw_event, 955 .probe = lg_probe, 956 .remove = lg_remove, 957 }; 958 module_hid_driver(lg_driver); 959 960 #ifdef CONFIG_LOGIWHEELS_FF 961 int lg4ff_no_autoswitch = 0; 962 module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO); 963 MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically"); 964 #endif 965 966 MODULE_LICENSE("GPL"); 967