hid-lg.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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) 2007 Paul Walmsley
  9. * Copyright (c) 2008 Jiri Slaby
  10. * Copyright (c) 2010 Hendrik Iben
  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. #include <linux/device.h>
  19. #include <linux/hid.h>
  20. #include <linux/module.h>
  21. #include <linux/random.h>
  22. #include <linux/sched.h>
  23. #include <linux/wait.h>
  24. #include "hid-ids.h"
  25. #include "hid-lg.h"
  26. #define LG_RDESC 0x001
  27. #define LG_BAD_RELATIVE_KEYS 0x002
  28. #define LG_DUPLICATE_USAGES 0x004
  29. #define LG_EXPANDED_KEYMAP 0x010
  30. #define LG_IGNORE_DOUBLED_WHEEL 0x020
  31. #define LG_WIRELESS 0x040
  32. #define LG_INVERT_HWHEEL 0x080
  33. #define LG_NOGET 0x100
  34. #define LG_FF 0x200
  35. #define LG_FF2 0x400
  36. #define LG_RDESC_REL_ABS 0x800
  37. #define LG_FF3 0x1000
  38. #define LG_FF4 0x2000
  39. /* Size of the original descriptor of the Driving Force Pro wheel */
  40. #define DFP_RDESC_ORIG_SIZE 97
  41. /* Fixed report descriptor for Logitech Driving Force Pro wheel controller
  42. *
  43. * The original descriptor hides the separate throttle and brake axes in
  44. * a custom vendor usage page, providing only a combined value as
  45. * GenericDesktop.Y.
  46. * This descriptor removes the combined Y axis and instead reports
  47. * separate throttle (Y) and brake (RZ).
  48. */
  49. static __u8 dfp_rdesc_fixed[] = {
  50. 0x05, 0x01, /* Usage Page (Desktop), */
  51. 0x09, 0x04, /* Usage (Joystik), */
  52. 0xA1, 0x01, /* Collection (Application), */
  53. 0xA1, 0x02, /* Collection (Logical), */
  54. 0x95, 0x01, /* Report Count (1), */
  55. 0x75, 0x0E, /* Report Size (14), */
  56. 0x14, /* Logical Minimum (0), */
  57. 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
  58. 0x34, /* Physical Minimum (0), */
  59. 0x46, 0xFF, 0x3F, /* Physical Maximum (16383), */
  60. 0x09, 0x30, /* Usage (X), */
  61. 0x81, 0x02, /* Input (Variable), */
  62. 0x95, 0x0E, /* Report Count (14), */
  63. 0x75, 0x01, /* Report Size (1), */
  64. 0x25, 0x01, /* Logical Maximum (1), */
  65. 0x45, 0x01, /* Physical Maximum (1), */
  66. 0x05, 0x09, /* Usage Page (Button), */
  67. 0x19, 0x01, /* Usage Minimum (01h), */
  68. 0x29, 0x0E, /* Usage Maximum (0Eh), */
  69. 0x81, 0x02, /* Input (Variable), */
  70. 0x05, 0x01, /* Usage Page (Desktop), */
  71. 0x95, 0x01, /* Report Count (1), */
  72. 0x75, 0x04, /* Report Size (4), */
  73. 0x25, 0x07, /* Logical Maximum (7), */
  74. 0x46, 0x3B, 0x01, /* Physical Maximum (315), */
  75. 0x65, 0x14, /* Unit (Degrees), */
  76. 0x09, 0x39, /* Usage (Hat Switch), */
  77. 0x81, 0x42, /* Input (Variable, Nullstate), */
  78. 0x65, 0x00, /* Unit, */
  79. 0x26, 0xFF, 0x00, /* Logical Maximum (255), */
  80. 0x46, 0xFF, 0x00, /* Physical Maximum (255), */
  81. 0x75, 0x08, /* Report Size (8), */
  82. 0x81, 0x01, /* Input (Constant), */
  83. 0x09, 0x31, /* Usage (Y), */
  84. 0x81, 0x02, /* Input (Variable), */
  85. 0x09, 0x35, /* Usage (Rz), */
  86. 0x81, 0x02, /* Input (Variable), */
  87. 0x81, 0x01, /* Input (Constant), */
  88. 0xC0, /* End Collection, */
  89. 0xA1, 0x02, /* Collection (Logical), */
  90. 0x09, 0x02, /* Usage (02h), */
  91. 0x95, 0x07, /* Report Count (7), */
  92. 0x91, 0x02, /* Output (Variable), */
  93. 0xC0, /* End Collection, */
  94. 0xC0 /* End Collection */
  95. };
  96. /*
  97. * Certain Logitech keyboards send in report #3 keys which are far
  98. * above the logical maximum described in descriptor. This extends
  99. * the original value of 0x28c of logical maximum to 0x104d
  100. */
  101. static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  102. unsigned int *rsize)
  103. {
  104. unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
  105. if ((quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
  106. rdesc[84] == 0x8c && rdesc[85] == 0x02) {
  107. hid_info(hdev,
  108. "fixing up Logitech keyboard report descriptor\n");
  109. rdesc[84] = rdesc[89] = 0x4d;
  110. rdesc[85] = rdesc[90] = 0x10;
  111. }
  112. if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 51 &&
  113. rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
  114. rdesc[49] == 0x81 && rdesc[51] == 0x06) {
  115. hid_info(hdev,
  116. "fixing up rel/abs in Logitech report descriptor\n");
  117. rdesc[33] = rdesc[50] = 0x02;
  118. }
  119. if ((quirks & LG_FF4) && *rsize >= 101 &&
  120. rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
  121. rdesc[47] == 0x05 && rdesc[48] == 0x09) {
  122. hid_info(hdev, "fixing up Logitech Speed Force Wireless button descriptor\n");
  123. rdesc[41] = 0x05;
  124. rdesc[42] = 0x09;
  125. rdesc[47] = 0x95;
  126. rdesc[48] = 0x0B;
  127. }
  128. switch (hdev->product) {
  129. case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
  130. if (*rsize == DFP_RDESC_ORIG_SIZE) {
  131. hid_info(hdev,
  132. "fixing up Logitech Driving Force Pro report descriptor\n");
  133. rdesc = dfp_rdesc_fixed;
  134. *rsize = sizeof(dfp_rdesc_fixed);
  135. }
  136. break;
  137. }
  138. return rdesc;
  139. }
  140. #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
  141. EV_KEY, (c))
  142. static int lg_ultrax_remote_mapping(struct hid_input *hi,
  143. struct hid_usage *usage, unsigned long **bit, int *max)
  144. {
  145. if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
  146. return 0;
  147. set_bit(EV_REP, hi->input->evbit);
  148. switch (usage->hid & HID_USAGE) {
  149. /* Reported on Logitech Ultra X Media Remote */
  150. case 0x004: lg_map_key_clear(KEY_AGAIN); break;
  151. case 0x00d: lg_map_key_clear(KEY_HOME); break;
  152. case 0x024: lg_map_key_clear(KEY_SHUFFLE); break;
  153. case 0x025: lg_map_key_clear(KEY_TV); break;
  154. case 0x026: lg_map_key_clear(KEY_MENU); break;
  155. case 0x031: lg_map_key_clear(KEY_AUDIO); break;
  156. case 0x032: lg_map_key_clear(KEY_TEXT); break;
  157. case 0x033: lg_map_key_clear(KEY_LAST); break;
  158. case 0x047: lg_map_key_clear(KEY_MP3); break;
  159. case 0x048: lg_map_key_clear(KEY_DVD); break;
  160. case 0x049: lg_map_key_clear(KEY_MEDIA); break;
  161. case 0x04a: lg_map_key_clear(KEY_VIDEO); break;
  162. case 0x04b: lg_map_key_clear(KEY_ANGLE); break;
  163. case 0x04c: lg_map_key_clear(KEY_LANGUAGE); break;
  164. case 0x04d: lg_map_key_clear(KEY_SUBTITLE); break;
  165. case 0x051: lg_map_key_clear(KEY_RED); break;
  166. case 0x052: lg_map_key_clear(KEY_CLOSE); break;
  167. default:
  168. return 0;
  169. }
  170. return 1;
  171. }
  172. static int lg_dinovo_mapping(struct hid_input *hi, struct hid_usage *usage,
  173. unsigned long **bit, int *max)
  174. {
  175. if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
  176. return 0;
  177. switch (usage->hid & HID_USAGE) {
  178. case 0x00d: lg_map_key_clear(KEY_MEDIA); break;
  179. default:
  180. return 0;
  181. }
  182. return 1;
  183. }
  184. static int lg_wireless_mapping(struct hid_input *hi, struct hid_usage *usage,
  185. unsigned long **bit, int *max)
  186. {
  187. if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
  188. return 0;
  189. switch (usage->hid & HID_USAGE) {
  190. case 0x1001: lg_map_key_clear(KEY_MESSENGER); break;
  191. case 0x1003: lg_map_key_clear(KEY_SOUND); break;
  192. case 0x1004: lg_map_key_clear(KEY_VIDEO); break;
  193. case 0x1005: lg_map_key_clear(KEY_AUDIO); break;
  194. case 0x100a: lg_map_key_clear(KEY_DOCUMENTS); break;
  195. /* The following two entries are Playlist 1 and 2 on the MX3200 */
  196. case 0x100f: lg_map_key_clear(KEY_FN_1); break;
  197. case 0x1010: lg_map_key_clear(KEY_FN_2); break;
  198. case 0x1011: lg_map_key_clear(KEY_PREVIOUSSONG); break;
  199. case 0x1012: lg_map_key_clear(KEY_NEXTSONG); break;
  200. case 0x1013: lg_map_key_clear(KEY_CAMERA); break;
  201. case 0x1014: lg_map_key_clear(KEY_MESSENGER); break;
  202. case 0x1015: lg_map_key_clear(KEY_RECORD); break;
  203. case 0x1016: lg_map_key_clear(KEY_PLAYER); break;
  204. case 0x1017: lg_map_key_clear(KEY_EJECTCD); break;
  205. case 0x1018: lg_map_key_clear(KEY_MEDIA); break;
  206. case 0x1019: lg_map_key_clear(KEY_PROG1); break;
  207. case 0x101a: lg_map_key_clear(KEY_PROG2); break;
  208. case 0x101b: lg_map_key_clear(KEY_PROG3); break;
  209. case 0x101c: lg_map_key_clear(KEY_CYCLEWINDOWS); break;
  210. case 0x101f: lg_map_key_clear(KEY_ZOOMIN); break;
  211. case 0x1020: lg_map_key_clear(KEY_ZOOMOUT); break;
  212. case 0x1021: lg_map_key_clear(KEY_ZOOMRESET); break;
  213. case 0x1023: lg_map_key_clear(KEY_CLOSE); break;
  214. case 0x1027: lg_map_key_clear(KEY_MENU); break;
  215. /* this one is marked as 'Rotate' */
  216. case 0x1028: lg_map_key_clear(KEY_ANGLE); break;
  217. case 0x1029: lg_map_key_clear(KEY_SHUFFLE); break;
  218. case 0x102a: lg_map_key_clear(KEY_BACK); break;
  219. case 0x102b: lg_map_key_clear(KEY_CYCLEWINDOWS); break;
  220. case 0x102d: lg_map_key_clear(KEY_WWW); break;
  221. /* The following two are 'Start/answer call' and 'End/reject call'
  222. on the MX3200 */
  223. case 0x1031: lg_map_key_clear(KEY_OK); break;
  224. case 0x1032: lg_map_key_clear(KEY_CANCEL); break;
  225. case 0x1041: lg_map_key_clear(KEY_BATTERY); break;
  226. case 0x1042: lg_map_key_clear(KEY_WORDPROCESSOR); break;
  227. case 0x1043: lg_map_key_clear(KEY_SPREADSHEET); break;
  228. case 0x1044: lg_map_key_clear(KEY_PRESENTATION); break;
  229. case 0x1045: lg_map_key_clear(KEY_UNDO); break;
  230. case 0x1046: lg_map_key_clear(KEY_REDO); break;
  231. case 0x1047: lg_map_key_clear(KEY_PRINT); break;
  232. case 0x1048: lg_map_key_clear(KEY_SAVE); break;
  233. case 0x1049: lg_map_key_clear(KEY_PROG1); break;
  234. case 0x104a: lg_map_key_clear(KEY_PROG2); break;
  235. case 0x104b: lg_map_key_clear(KEY_PROG3); break;
  236. case 0x104c: lg_map_key_clear(KEY_PROG4); break;
  237. default:
  238. return 0;
  239. }
  240. return 1;
  241. }
  242. static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi,
  243. struct hid_field *field, struct hid_usage *usage,
  244. unsigned long **bit, int *max)
  245. {
  246. /* extended mapping for certain Logitech hardware (Logitech cordless
  247. desktop LX500) */
  248. static const u8 e_keymap[] = {
  249. 0,216, 0,213,175,156, 0, 0, 0, 0,
  250. 144, 0, 0, 0, 0, 0, 0, 0, 0,212,
  251. 174,167,152,161,112, 0, 0, 0,154, 0,
  252. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  253. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  254. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  255. 0, 0, 0, 0, 0,183,184,185,186,187,
  256. 188,189,190,191,192,193,194, 0, 0, 0
  257. };
  258. unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
  259. unsigned int hid = usage->hid;
  260. if (hdev->product == USB_DEVICE_ID_LOGITECH_RECEIVER &&
  261. lg_ultrax_remote_mapping(hi, usage, bit, max))
  262. return 1;
  263. if (hdev->product == USB_DEVICE_ID_DINOVO_MINI &&
  264. lg_dinovo_mapping(hi, usage, bit, max))
  265. return 1;
  266. if ((quirks & LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max))
  267. return 1;
  268. if ((hid & HID_USAGE_PAGE) != HID_UP_BUTTON)
  269. return 0;
  270. hid &= HID_USAGE;
  271. /* Special handling for Logitech Cordless Desktop */
  272. if (field->application == HID_GD_MOUSE) {
  273. if ((quirks & LG_IGNORE_DOUBLED_WHEEL) &&
  274. (hid == 7 || hid == 8))
  275. return -1;
  276. } else {
  277. if ((quirks & LG_EXPANDED_KEYMAP) &&
  278. hid < ARRAY_SIZE(e_keymap) &&
  279. e_keymap[hid] != 0) {
  280. hid_map_usage(hi, usage, bit, max, EV_KEY,
  281. e_keymap[hid]);
  282. return 1;
  283. }
  284. }
  285. return 0;
  286. }
  287. static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
  288. struct hid_field *field, struct hid_usage *usage,
  289. unsigned long **bit, int *max)
  290. {
  291. unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
  292. if ((quirks & LG_BAD_RELATIVE_KEYS) && usage->type == EV_KEY &&
  293. (field->flags & HID_MAIN_ITEM_RELATIVE))
  294. field->flags &= ~HID_MAIN_ITEM_RELATIVE;
  295. if ((quirks & LG_DUPLICATE_USAGES) && (usage->type == EV_KEY ||
  296. usage->type == EV_REL || usage->type == EV_ABS))
  297. clear_bit(usage->code, *bit);
  298. return 0;
  299. }
  300. static int lg_event(struct hid_device *hdev, struct hid_field *field,
  301. struct hid_usage *usage, __s32 value)
  302. {
  303. unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
  304. if ((quirks & LG_INVERT_HWHEEL) && usage->code == REL_HWHEEL) {
  305. input_event(field->hidinput->input, usage->type, usage->code,
  306. -value);
  307. return 1;
  308. }
  309. return 0;
  310. }
  311. static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
  312. {
  313. unsigned long quirks = id->driver_data;
  314. unsigned int connect_mask = HID_CONNECT_DEFAULT;
  315. int ret;
  316. hid_set_drvdata(hdev, (void *)quirks);
  317. if (quirks & LG_NOGET)
  318. hdev->quirks |= HID_QUIRK_NOGET;
  319. ret = hid_parse(hdev);
  320. if (ret) {
  321. hid_err(hdev, "parse failed\n");
  322. goto err_free;
  323. }
  324. if (quirks & (LG_FF | LG_FF2 | LG_FF3 | LG_FF4))
  325. connect_mask &= ~HID_CONNECT_FF;
  326. ret = hid_hw_start(hdev, connect_mask);
  327. if (ret) {
  328. hid_err(hdev, "hw start failed\n");
  329. goto err_free;
  330. }
  331. /* Setup wireless link with Logitech Wii wheel */
  332. if(hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) {
  333. unsigned char buf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  334. ret = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
  335. if (ret >= 0) {
  336. /* insert a little delay of 10 jiffies ~ 40ms */
  337. wait_queue_head_t wait;
  338. init_waitqueue_head (&wait);
  339. wait_event_interruptible_timeout(wait, 0, 10);
  340. /* Select random Address */
  341. buf[1] = 0xB2;
  342. get_random_bytes(&buf[2], 2);
  343. ret = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
  344. }
  345. }
  346. if (quirks & LG_FF)
  347. lgff_init(hdev);
  348. if (quirks & LG_FF2)
  349. lg2ff_init(hdev);
  350. if (quirks & LG_FF3)
  351. lg3ff_init(hdev);
  352. if (quirks & LG_FF4)
  353. lg4ff_init(hdev);
  354. return 0;
  355. err_free:
  356. return ret;
  357. }
  358. static void lg_remove(struct hid_device *hdev)
  359. {
  360. unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
  361. if(quirks & LG_FF4)
  362. lg4ff_deinit(hdev);
  363. hid_hw_stop(hdev);
  364. }
  365. static const struct hid_device_id lg_devices[] = {
  366. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER),
  367. .driver_data = LG_RDESC | LG_WIRELESS },
  368. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER),
  369. .driver_data = LG_RDESC | LG_WIRELESS },
  370. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2),
  371. .driver_data = LG_RDESC | LG_WIRELESS },
  372. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER),
  373. .driver_data = LG_BAD_RELATIVE_KEYS },
  374. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP),
  375. .driver_data = LG_DUPLICATE_USAGES },
  376. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE),
  377. .driver_data = LG_DUPLICATE_USAGES },
  378. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI),
  379. .driver_data = LG_DUPLICATE_USAGES },
  380. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD),
  381. .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
  382. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500),
  383. .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
  384. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D),
  385. .driver_data = LG_NOGET },
  386. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL),
  387. .driver_data = LG_NOGET | LG_FF4 },
  388. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD),
  389. .driver_data = LG_FF2 },
  390. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD),
  391. .driver_data = LG_FF },
  392. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2),
  393. .driver_data = LG_FF },
  394. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D),
  395. .driver_data = LG_FF },
  396. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO),
  397. .driver_data = LG_FF },
  398. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL),
  399. .driver_data = LG_FF4 },
  400. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2),
  401. .driver_data = LG_FF4 },
  402. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL),
  403. .driver_data = LG_FF4 },
  404. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL),
  405. .driver_data = LG_FF4 },
  406. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL),
  407. .driver_data = LG_FF4 },
  408. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL),
  409. .driver_data = LG_NOGET | LG_FF4 },
  410. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL),
  411. .driver_data = LG_FF4 },
  412. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ),
  413. .driver_data = LG_FF },
  414. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
  415. .driver_data = LG_FF2 },
  416. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
  417. .driver_data = LG_FF3 },
  418. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
  419. .driver_data = LG_RDESC_REL_ABS },
  420. { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER),
  421. .driver_data = LG_RDESC_REL_ABS },
  422. { }
  423. };
  424. MODULE_DEVICE_TABLE(hid, lg_devices);
  425. static struct hid_driver lg_driver = {
  426. .name = "logitech",
  427. .id_table = lg_devices,
  428. .report_fixup = lg_report_fixup,
  429. .input_mapping = lg_input_mapping,
  430. .input_mapped = lg_input_mapped,
  431. .event = lg_event,
  432. .probe = lg_probe,
  433. .remove = lg_remove,
  434. };
  435. static int __init lg_init(void)
  436. {
  437. return hid_register_driver(&lg_driver);
  438. }
  439. static void __exit lg_exit(void)
  440. {
  441. hid_unregister_driver(&lg_driver);
  442. }
  443. module_init(lg_init);
  444. module_exit(lg_exit);
  445. MODULE_LICENSE("GPL");