hid-lg.c 40 KB

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