hid-lg.c 38 KB

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