hid-waltop.c 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  1. /*
  2. * HID driver for Waltop devices not fully compliant with HID standard
  3. *
  4. * Copyright (c) 2010 Nikolai Kondrashov
  5. */
  6. /*
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. */
  12. #include <linux/device.h>
  13. #include <linux/hid.h>
  14. #include <linux/module.h>
  15. #include "hid-ids.h"
  16. /*
  17. * There exists an official driver on the manufacturer's website, which
  18. * wasn't submitted to the kernel, for some reason. The official driver
  19. * doesn't seem to support extra features of some tablets, like wheels.
  20. *
  21. * It shows that the feature report ID 2 could be used to control any waltop
  22. * tablet input mode, switching it between "default", "tablet" and "ink".
  23. *
  24. * This driver only uses "default" mode for all the supported tablets. This
  25. * mode tries to be HID-compatible (not very successfully), but cripples the
  26. * resolution of some tablets.
  27. *
  28. * The "tablet" mode uses some proprietary, yet decipherable protocol, which
  29. * represents the correct resolution, but is possibly HID-incompatible (i.e.
  30. * indescribable by a report descriptor).
  31. *
  32. * The purpose of the "ink" mode is unknown.
  33. *
  34. * The feature reports needed for switching to each mode are these:
  35. *
  36. * 02 16 00 default
  37. * 02 16 01 tablet
  38. * 02 16 02 ink
  39. */
  40. /*
  41. * Original Slim Tablet 5.8 inch report descriptor.
  42. *
  43. * All the reports except the report with ID 16 (the stylus) are unused,
  44. * possibly because the tablet is not configured to, or because they were
  45. * just copied from a more capable model. The full purpose of features
  46. * described for report ID 2 is unknown.
  47. *
  48. * The stylus buttons are described as three bit fields, whereas actually
  49. * it's an "array", i.e. they're reported as button numbers (1, 2 and 3).
  50. * The "eraser" field is not used. There is also a "push" without a "pop" in
  51. * the stylus description.
  52. *
  53. * Usage Page (Desktop), ; Generic desktop controls (01h)
  54. * Usage (Mouse), ; Mouse (02h, application collection)
  55. * Collection (Application),
  56. * Report ID (1),
  57. * Usage (Pointer), ; Pointer (01h, physical collection)
  58. * Collection (Physical),
  59. * Usage Page (Button), ; Button (09h)
  60. * Usage Minimum (01h),
  61. * Usage Maximum (05h),
  62. * Logical Minimum (0),
  63. * Logical Maximum (1),
  64. * Report Size (1),
  65. * Report Count (5),
  66. * Input (Variable),
  67. * Report Size (3),
  68. * Report Count (1),
  69. * Input (Constant, Variable),
  70. * Usage Page (Desktop), ; Generic desktop controls (01h)
  71. * Usage (X), ; X (30h, dynamic value)
  72. * Usage (Y), ; Y (31h, dynamic value)
  73. * Usage (Wheel), ; Wheel (38h, dynamic value)
  74. * Logical Minimum (-127),
  75. * Logical Maximum (127),
  76. * Report Size (8),
  77. * Report Count (3),
  78. * Input (Variable, Relative),
  79. * End Collection,
  80. * End Collection,
  81. * Usage Page (Digitizer), ; Digitizer (0Dh)
  82. * Usage (Pen), ; Pen (02h, application collection)
  83. * Collection (Application),
  84. * Report ID (2),
  85. * Usage (Stylus), ; Stylus (20h, logical collection)
  86. * Collection (Physical),
  87. * Usage (00h),
  88. * Logical Minimum (0),
  89. * Logical Maximum (255),
  90. * Report Size (8),
  91. * Report Count (7),
  92. * Input (Variable),
  93. * Usage (Azimuth), ; Azimuth (3Fh, dynamic value)
  94. * Usage (Altitude), ; Altitude (40h, dynamic value)
  95. * Logical Minimum (0),
  96. * Logical Maximum (255),
  97. * Report Size (8),
  98. * Report Count (2),
  99. * Feature (Variable),
  100. * End Collection,
  101. * Report ID (5),
  102. * Usage Page (Digitizer), ; Digitizer (0Dh)
  103. * Usage (Stylus), ; Stylus (20h, logical collection)
  104. * Collection (Physical),
  105. * Usage (00h),
  106. * Logical Minimum (0),
  107. * Logical Maximum (255),
  108. * Report Size (8),
  109. * Report Count (7),
  110. * Input (Variable),
  111. * End Collection,
  112. * Report ID (10),
  113. * Usage Page (Digitizer), ; Digitizer (0Dh)
  114. * Usage (Stylus), ; Stylus (20h, logical collection)
  115. * Collection (Physical),
  116. * Usage (00h),
  117. * Logical Minimum (0),
  118. * Logical Maximum (255),
  119. * Report Size (8),
  120. * Report Count (3),
  121. * Input (Variable),
  122. * End Collection,
  123. * Report ID (16),
  124. * Usage (Stylus), ; Stylus (20h, logical collection)
  125. * Collection (Physical),
  126. * Usage (Tip Switch), ; Tip switch (42h, momentary control)
  127. * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
  128. * Usage (Invert), ; Invert (3Ch, momentary control)
  129. * Usage (Eraser), ; Eraser (45h, momentary control)
  130. * Usage (In Range), ; In range (32h, momentary control)
  131. * Logical Minimum (0),
  132. * Logical Maximum (1),
  133. * Report Size (1),
  134. * Report Count (5),
  135. * Input (Variable),
  136. * Report Count (3),
  137. * Input (Constant, Variable),
  138. * Usage Page (Desktop), ; Generic desktop controls (01h)
  139. * Usage (X), ; X (30h, dynamic value)
  140. * Report Size (16),
  141. * Report Count (1),
  142. * Push,
  143. * Unit Exponent (13),
  144. * Unit (Inch^3),
  145. * Logical Minimum (0),
  146. * Logical Maximum (10000),
  147. * Physical Minimum (0),
  148. * Physical Maximum (10000),
  149. * Input (Variable),
  150. * Usage (Y), ; Y (31h, dynamic value)
  151. * Logical Maximum (6000),
  152. * Physical Maximum (6000),
  153. * Input (Variable),
  154. * Usage Page (Digitizer), ; Digitizer (0Dh)
  155. * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
  156. * Logical Minimum (0),
  157. * Logical Maximum (1023),
  158. * Physical Minimum (0),
  159. * Physical Maximum (1023),
  160. * Input (Variable),
  161. * End Collection,
  162. * End Collection
  163. */
  164. /* Size of the original report descriptor of Slim Tablet 5.8 inch */
  165. #define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222
  166. /*
  167. * Fixed Slim Tablet 5.8 inch descriptor.
  168. *
  169. * All the reports except the stylus report (ID 16) were removed as unused.
  170. * The stylus buttons description was fixed.
  171. */
  172. static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
  173. 0x05, 0x0D, /* Usage Page (Digitizer), */
  174. 0x09, 0x02, /* Usage (Pen), */
  175. 0xA1, 0x01, /* Collection (Application), */
  176. 0x85, 0x10, /* Report ID (16), */
  177. 0x09, 0x20, /* Usage (Stylus), */
  178. 0xA0, /* Collection (Physical), */
  179. 0x09, 0x42, /* Usage (Tip Switch), */
  180. 0x09, 0x44, /* Usage (Barrel Switch), */
  181. 0x09, 0x46, /* Usage (Tablet Pick), */
  182. 0x15, 0x01, /* Logical Minimum (1), */
  183. 0x25, 0x03, /* Logical Maximum (3), */
  184. 0x75, 0x04, /* Report Size (4), */
  185. 0x95, 0x01, /* Report Count (1), */
  186. 0x80, /* Input, */
  187. 0x09, 0x32, /* Usage (In Range), */
  188. 0x14, /* Logical Minimum (0), */
  189. 0x25, 0x01, /* Logical Maximum (1), */
  190. 0x75, 0x01, /* Report Size (1), */
  191. 0x95, 0x01, /* Report Count (1), */
  192. 0x81, 0x02, /* Input (Variable), */
  193. 0x95, 0x03, /* Report Count (3), */
  194. 0x81, 0x03, /* Input (Constant, Variable), */
  195. 0x75, 0x10, /* Report Size (16), */
  196. 0x95, 0x01, /* Report Count (1), */
  197. 0x14, /* Logical Minimum (0), */
  198. 0xA4, /* Push, */
  199. 0x05, 0x01, /* Usage Page (Desktop), */
  200. 0x65, 0x13, /* Unit (Inch), */
  201. 0x55, 0xFD, /* Unit Exponent (-3), */
  202. 0x34, /* Physical Minimum (0), */
  203. 0x09, 0x30, /* Usage (X), */
  204. 0x46, 0x88, 0x13, /* Physical Maximum (5000), */
  205. 0x26, 0x10, 0x27, /* Logical Maximum (10000), */
  206. 0x81, 0x02, /* Input (Variable), */
  207. 0x09, 0x31, /* Usage (Y), */
  208. 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */
  209. 0x26, 0x70, 0x17, /* Logical Maximum (6000), */
  210. 0x81, 0x02, /* Input (Variable), */
  211. 0xB4, /* Pop, */
  212. 0x09, 0x30, /* Usage (Tip Pressure), */
  213. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  214. 0x81, 0x02, /* Input (Variable), */
  215. 0xC0, /* End Collection, */
  216. 0xC0 /* End Collection */
  217. };
  218. /*
  219. * Original Slim Tablet 12.1 inch report descriptor.
  220. *
  221. * The descriptor is similar to the Slim Tablet 5.8 inch descriptor with the
  222. * addition of a keyboard report, seemingly unused. It may have get here
  223. * from a Media Tablet - probably an unimplemented feature.
  224. *
  225. * Usage Page (Desktop), ; Generic desktop controls (01h)
  226. * Usage (Mouse), ; Mouse (02h, application collection)
  227. * Collection (Application),
  228. * Report ID (1),
  229. * Usage (Pointer), ; Pointer (01h, physical collection)
  230. * Collection (Physical),
  231. * Usage Page (Button), ; Button (09h)
  232. * Usage Minimum (01h),
  233. * Usage Maximum (05h),
  234. * Logical Minimum (0),
  235. * Logical Maximum (1),
  236. * Report Size (1),
  237. * Report Count (5),
  238. * Input (Variable),
  239. * Report Size (3),
  240. * Report Count (1),
  241. * Input (Constant, Variable),
  242. * Usage Page (Desktop), ; Generic desktop controls (01h)
  243. * Usage (X), ; X (30h, dynamic value)
  244. * Usage (Y), ; Y (31h, dynamic value)
  245. * Usage (Wheel), ; Wheel (38h, dynamic value)
  246. * Logical Minimum (-127),
  247. * Logical Maximum (127),
  248. * Report Size (8),
  249. * Report Count (3),
  250. * Input (Variable, Relative),
  251. * End Collection,
  252. * End Collection,
  253. * Usage Page (Digitizer), ; Digitizer (0Dh)
  254. * Usage (Pen), ; Pen (02h, application collection)
  255. * Collection (Application),
  256. * Report ID (2),
  257. * Usage (Stylus), ; Stylus (20h, logical collection)
  258. * Collection (Physical),
  259. * Usage (00h),
  260. * Logical Minimum (0),
  261. * Logical Maximum (255),
  262. * Report Size (8),
  263. * Report Count (7),
  264. * Input (Variable),
  265. * Usage (Azimuth), ; Azimuth (3Fh, dynamic value)
  266. * Usage (Altitude), ; Altitude (40h, dynamic value)
  267. * Logical Minimum (0),
  268. * Logical Maximum (255),
  269. * Report Size (8),
  270. * Report Count (2),
  271. * Feature (Variable),
  272. * End Collection,
  273. * Report ID (5),
  274. * Usage Page (Digitizer), ; Digitizer (0Dh)
  275. * Usage (Stylus), ; Stylus (20h, logical collection)
  276. * Collection (Physical),
  277. * Usage (00h),
  278. * Logical Minimum (0),
  279. * Logical Maximum (255),
  280. * Report Size (8),
  281. * Report Count (7),
  282. * Input (Variable),
  283. * End Collection,
  284. * Report ID (10),
  285. * Usage Page (Digitizer), ; Digitizer (0Dh)
  286. * Usage (Stylus), ; Stylus (20h, logical collection)
  287. * Collection (Physical),
  288. * Usage (00h),
  289. * Logical Minimum (0),
  290. * Logical Maximum (255),
  291. * Report Size (8),
  292. * Report Count (3),
  293. * Input (Variable),
  294. * End Collection,
  295. * Report ID (16),
  296. * Usage (Stylus), ; Stylus (20h, logical collection)
  297. * Collection (Physical),
  298. * Usage (Tip Switch), ; Tip switch (42h, momentary control)
  299. * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
  300. * Usage (Invert), ; Invert (3Ch, momentary control)
  301. * Usage (Eraser), ; Eraser (45h, momentary control)
  302. * Usage (In Range), ; In range (32h, momentary control)
  303. * Logical Minimum (0),
  304. * Logical Maximum (1),
  305. * Report Size (1),
  306. * Report Count (5),
  307. * Input (Variable),
  308. * Report Count (3),
  309. * Input (Constant, Variable),
  310. * Usage Page (Desktop), ; Generic desktop controls (01h)
  311. * Usage (X), ; X (30h, dynamic value)
  312. * Report Size (16),
  313. * Report Count (1),
  314. * Push,
  315. * Unit Exponent (13),
  316. * Unit (Inch^3),
  317. * Logical Minimum (0),
  318. * Logical Maximum (20000),
  319. * Physical Minimum (0),
  320. * Physical Maximum (20000),
  321. * Input (Variable),
  322. * Usage (Y), ; Y (31h, dynamic value)
  323. * Logical Maximum (12500),
  324. * Physical Maximum (12500),
  325. * Input (Variable),
  326. * Usage Page (Digitizer), ; Digitizer (0Dh)
  327. * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
  328. * Logical Minimum (0),
  329. * Logical Maximum (1023),
  330. * Physical Minimum (0),
  331. * Physical Maximum (1023),
  332. * Input (Variable),
  333. * End Collection,
  334. * End Collection,
  335. * Usage Page (Desktop), ; Generic desktop controls (01h)
  336. * Usage (Keyboard), ; Keyboard (06h, application collection)
  337. * Collection (Application),
  338. * Report ID (13),
  339. * Usage Page (Keyboard), ; Keyboard/keypad (07h)
  340. * Usage Minimum (KB Leftcontrol), ; Keyboard left control
  341. * ; (E0h, dynamic value)
  342. * Usage Maximum (KB Right GUI), ; Keyboard right GUI (E7h, dynamic value)
  343. * Logical Minimum (0),
  344. * Logical Maximum (1),
  345. * Report Size (1),
  346. * Report Count (8),
  347. * Input (Variable),
  348. * Report Size (8),
  349. * Report Count (1),
  350. * Input (Constant),
  351. * Usage Page (Keyboard), ; Keyboard/keypad (07h)
  352. * Usage Minimum (None), ; No event (00h, selector)
  353. * Usage Maximum (KB Application), ; Keyboard Application (65h, selector)
  354. * Logical Minimum (0),
  355. * Logical Maximum (101),
  356. * Report Size (8),
  357. * Report Count (5),
  358. * Input,
  359. * End Collection
  360. */
  361. /* Size of the original report descriptor of Slim Tablet 12.1 inch */
  362. #define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE 269
  363. /*
  364. * Fixed Slim Tablet 12.1 inch descriptor.
  365. *
  366. * All the reports except the stylus report (ID 16) were removed as unused.
  367. * The stylus buttons description was fixed.
  368. */
  369. static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
  370. 0x05, 0x0D, /* Usage Page (Digitizer), */
  371. 0x09, 0x02, /* Usage (Pen), */
  372. 0xA1, 0x01, /* Collection (Application), */
  373. 0x85, 0x10, /* Report ID (16), */
  374. 0x09, 0x20, /* Usage (Stylus), */
  375. 0xA0, /* Collection (Physical), */
  376. 0x09, 0x42, /* Usage (Tip Switch), */
  377. 0x09, 0x44, /* Usage (Barrel Switch), */
  378. 0x09, 0x46, /* Usage (Tablet Pick), */
  379. 0x15, 0x01, /* Logical Minimum (1), */
  380. 0x25, 0x03, /* Logical Maximum (3), */
  381. 0x75, 0x04, /* Report Size (4), */
  382. 0x95, 0x01, /* Report Count (1), */
  383. 0x80, /* Input, */
  384. 0x09, 0x32, /* Usage (In Range), */
  385. 0x14, /* Logical Minimum (0), */
  386. 0x25, 0x01, /* Logical Maximum (1), */
  387. 0x75, 0x01, /* Report Size (1), */
  388. 0x95, 0x01, /* Report Count (1), */
  389. 0x81, 0x02, /* Input (Variable), */
  390. 0x95, 0x03, /* Report Count (3), */
  391. 0x81, 0x03, /* Input (Constant, Variable), */
  392. 0x75, 0x10, /* Report Size (16), */
  393. 0x95, 0x01, /* Report Count (1), */
  394. 0x14, /* Logical Minimum (0), */
  395. 0xA4, /* Push, */
  396. 0x05, 0x01, /* Usage Page (Desktop), */
  397. 0x65, 0x13, /* Unit (Inch), */
  398. 0x55, 0xFD, /* Unit Exponent (-3), */
  399. 0x34, /* Physical Minimum (0), */
  400. 0x09, 0x30, /* Usage (X), */
  401. 0x46, 0x10, 0x27, /* Physical Maximum (10000), */
  402. 0x26, 0x20, 0x4E, /* Logical Maximum (20000), */
  403. 0x81, 0x02, /* Input (Variable), */
  404. 0x09, 0x31, /* Usage (Y), */
  405. 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */
  406. 0x26, 0xD4, 0x30, /* Logical Maximum (12500), */
  407. 0x81, 0x02, /* Input (Variable), */
  408. 0xB4, /* Pop, */
  409. 0x09, 0x30, /* Usage (Tip Pressure), */
  410. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  411. 0x81, 0x02, /* Input (Variable), */
  412. 0xC0, /* End Collection, */
  413. 0xC0 /* End Collection */
  414. };
  415. /*
  416. * Original Q Pad report descriptor.
  417. *
  418. * The descriptor is similar to the Slim Tablet 5.8 inch descriptor with the
  419. * addition of consumer AC Pan field to the report ID 1, which seems to be
  420. * unused in the default mode. However, this tablet has resolution of 2048 LPI.
  421. *
  422. * Usage Page (Desktop), ; Generic desktop controls (01h)
  423. * Usage (Mouse), ; Mouse (02h, application collection)
  424. * Collection (Application),
  425. * Report ID (1),
  426. * Usage (Pointer), ; Pointer (01h, physical collection)
  427. * Collection (Physical),
  428. * Usage Page (Button), ; Button (09h)
  429. * Usage Minimum (01h),
  430. * Usage Maximum (05h),
  431. * Logical Minimum (0),
  432. * Logical Maximum (1),
  433. * Report Size (1),
  434. * Report Count (5),
  435. * Input (Variable),
  436. * Report Size (3),
  437. * Report Count (1),
  438. * Input (Constant, Variable),
  439. * Usage Page (Desktop), ; Generic desktop controls (01h)
  440. * Usage (X), ; X (30h, dynamic value)
  441. * Usage (Y), ; Y (31h, dynamic value)
  442. * Usage (Wheel), ; Wheel (38h, dynamic value)
  443. * Logical Minimum (-127),
  444. * Logical Maximum (127),
  445. * Report Size (8),
  446. * Report Count (3),
  447. * Input (Variable, Relative),
  448. * Usage Page (Consumer), ; Consumer (0Ch)
  449. * Logical Minimum (-127),
  450. * Logical Maximum (127),
  451. * Report Size (8),
  452. * Report Count (1),
  453. * Usage (AC Pan), ; AC pan (0238h, linear control)
  454. * Input (Variable, Relative),
  455. * End Collection,
  456. * End Collection,
  457. * Usage Page (Digitizer), ; Digitizer (0Dh)
  458. * Usage (Pen), ; Pen (02h, application collection)
  459. * Collection (Application),
  460. * Report ID (2),
  461. * Usage (Stylus), ; Stylus (20h, logical collection)
  462. * Collection (Physical),
  463. * Usage (00h),
  464. * Logical Minimum (0),
  465. * Logical Maximum (255),
  466. * Report Size (8),
  467. * Report Count (7),
  468. * Input (Variable),
  469. * Usage (Azimuth), ; Azimuth (3Fh, dynamic value)
  470. * Usage (Altitude), ; Altitude (40h, dynamic value)
  471. * Logical Minimum (0),
  472. * Logical Maximum (255),
  473. * Report Size (8),
  474. * Report Count (2),
  475. * Feature (Variable),
  476. * End Collection,
  477. * Report ID (5),
  478. * Usage Page (Digitizer), ; Digitizer (0Dh)
  479. * Usage (Stylus), ; Stylus (20h, logical collection)
  480. * Collection (Physical),
  481. * Usage (00h),
  482. * Logical Minimum (0),
  483. * Logical Maximum (255),
  484. * Report Size (8),
  485. * Report Count (7),
  486. * Input (Variable),
  487. * End Collection,
  488. * Report ID (10),
  489. * Usage Page (Digitizer), ; Digitizer (0Dh)
  490. * Usage (Stylus), ; Stylus (20h, logical collection)
  491. * Collection (Physical),
  492. * Usage (00h),
  493. * Logical Minimum (0),
  494. * Logical Maximum (255),
  495. * Report Size (8),
  496. * Report Count (7),
  497. * Input (Variable),
  498. * End Collection,
  499. * Report ID (16),
  500. * Usage (Stylus), ; Stylus (20h, logical collection)
  501. * Collection (Physical),
  502. * Usage (Tip Switch), ; Tip switch (42h, momentary control)
  503. * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
  504. * Usage (Invert), ; Invert (3Ch, momentary control)
  505. * Usage (Eraser), ; Eraser (45h, momentary control)
  506. * Usage (In Range), ; In range (32h, momentary control)
  507. * Logical Minimum (0),
  508. * Logical Maximum (1),
  509. * Report Size (1),
  510. * Report Count (5),
  511. * Input (Variable),
  512. * Report Count (3),
  513. * Input (Constant, Variable),
  514. * Usage Page (Desktop), ; Generic desktop controls (01h)
  515. * Usage (X), ; X (30h, dynamic value)
  516. * Report Size (16),
  517. * Report Count (1),
  518. * Push,
  519. * Unit Exponent (13),
  520. * Unit (Inch^3),
  521. * Logical Minimum (0),
  522. * Logical Maximum (12288),
  523. * Physical Minimum (0),
  524. * Physical Maximum (12288),
  525. * Input (Variable),
  526. * Usage (Y), ; Y (31h, dynamic value)
  527. * Logical Minimum (0),
  528. * Logical Maximum (9216),
  529. * Physical Minimum (0),
  530. * Physical Maximum (9216),
  531. * Input (Variable),
  532. * Usage Page (Digitizer), ; Digitizer (0Dh)
  533. * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
  534. * Logical Minimum (0),
  535. * Logical Maximum (1023),
  536. * Physical Minimum (0),
  537. * Physical Maximum (1023),
  538. * Input (Variable),
  539. * End Collection,
  540. * End Collection
  541. */
  542. /* Size of the original report descriptor of Q Pad */
  543. #define Q_PAD_RDESC_ORIG_SIZE 241
  544. /*
  545. * Fixed Q Pad descriptor.
  546. *
  547. * All the reports except the stylus report (ID 16) were removed as unused.
  548. * The stylus buttons description was fixed.
  549. */
  550. static __u8 q_pad_rdesc_fixed[] = {
  551. 0x05, 0x0D, /* Usage Page (Digitizer), */
  552. 0x09, 0x02, /* Usage (Pen), */
  553. 0xA1, 0x01, /* Collection (Application), */
  554. 0x85, 0x10, /* Report ID (16), */
  555. 0x09, 0x20, /* Usage (Stylus), */
  556. 0xA0, /* Collection (Physical), */
  557. 0x09, 0x42, /* Usage (Tip Switch), */
  558. 0x09, 0x44, /* Usage (Barrel Switch), */
  559. 0x09, 0x46, /* Usage (Tablet Pick), */
  560. 0x15, 0x01, /* Logical Minimum (1), */
  561. 0x25, 0x03, /* Logical Maximum (3), */
  562. 0x75, 0x04, /* Report Size (4), */
  563. 0x95, 0x01, /* Report Count (1), */
  564. 0x80, /* Input, */
  565. 0x09, 0x32, /* Usage (In Range), */
  566. 0x14, /* Logical Minimum (0), */
  567. 0x25, 0x01, /* Logical Maximum (1), */
  568. 0x75, 0x01, /* Report Size (1), */
  569. 0x95, 0x01, /* Report Count (1), */
  570. 0x81, 0x02, /* Input (Variable), */
  571. 0x95, 0x03, /* Report Count (3), */
  572. 0x81, 0x03, /* Input (Constant, Variable), */
  573. 0x75, 0x10, /* Report Size (16), */
  574. 0x95, 0x01, /* Report Count (1), */
  575. 0x14, /* Logical Minimum (0), */
  576. 0xA4, /* Push, */
  577. 0x05, 0x01, /* Usage Page (Desktop), */
  578. 0x65, 0x13, /* Unit (Inch), */
  579. 0x55, 0xFD, /* Unit Exponent (-3), */
  580. 0x34, /* Physical Minimum (0), */
  581. 0x09, 0x30, /* Usage (X), */
  582. 0x46, 0x70, 0x17, /* Physical Maximum (6000), */
  583. 0x26, 0x00, 0x30, /* Logical Maximum (12288), */
  584. 0x81, 0x02, /* Input (Variable), */
  585. 0x09, 0x31, /* Usage (Y), */
  586. 0x46, 0x94, 0x11, /* Physical Maximum (4500), */
  587. 0x26, 0x00, 0x24, /* Logical Maximum (9216), */
  588. 0x81, 0x02, /* Input (Variable), */
  589. 0xB4, /* Pop, */
  590. 0x09, 0x30, /* Usage (Tip Pressure), */
  591. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  592. 0x81, 0x02, /* Input (Variable), */
  593. 0xC0, /* End Collection, */
  594. 0xC0 /* End Collection */
  595. };
  596. /*
  597. * Original Media Tablet 10.6 inch report descriptor.
  598. *
  599. * There are at least two versions of this model in the wild. They are
  600. * represented by Genius G-Pen M609 (older version) and Genius G-Pen M609X
  601. * (newer version).
  602. *
  603. * Both versions have the usual pen with two barrel buttons and two
  604. * identical wheels with center buttons in the top corners of the tablet
  605. * base. They also have buttons on the top, between the wheels, for
  606. * selecting the wheels' functions and wide/standard mode. In the wide mode
  607. * the whole working surface is sensed, in the standard mode a narrower area
  608. * is sensed, but the logical report extents remain the same. These modes
  609. * correspond roughly to 16:9 and 4:3 aspect ratios respectively.
  610. *
  611. * The older version has three wheel function buttons ("scroll", "zoom" and
  612. * "volume") and two separate buttons for wide and standard mode. The newer
  613. * version has four wheel function buttons (plus "brush") and only one
  614. * button is used for selecting wide/standard mode. So, the total number of
  615. * buttons remains the same, but one of the mode buttons is repurposed as a
  616. * wheels' function button in the newer version.
  617. *
  618. * The wheel functions are:
  619. * scroll - the wheels act as scroll wheels, the center buttons switch
  620. * between vertical and horizontal scrolling;
  621. * zoom - the wheels zoom in/out, the buttons supposedly reset to 100%;
  622. * volume - the wheels control the sound volume, the buttons mute;
  623. * brush - the wheels are supposed to control brush width in a graphics
  624. * editor, the buttons do nothing.
  625. *
  626. * Below is the newer version's report descriptor. It may very well be that
  627. * the older version's descriptor is different and thus it won't be
  628. * supported.
  629. *
  630. * The mouse report (ID 1) only uses the wheel field for reporting the tablet
  631. * wheels' scroll mode. The keyboard report (ID 13) is used to report the
  632. * wheels' zoom and brush control functions as key presses. The report ID 12
  633. * is used to report the wheels' volume control functions. The stylus report
  634. * (ID 16) has the same problems as the Slim Tablet 5.8 inch report has.
  635. *
  636. * The rest of the reports are unused, at least in the default configuration.
  637. * The purpose of the features is unknown.
  638. *
  639. * Usage Page (Desktop),
  640. * Usage (Mouse),
  641. * Collection (Application),
  642. * Report ID (1),
  643. * Usage (Pointer),
  644. * Collection (Physical),
  645. * Usage Page (Button),
  646. * Usage Minimum (01h),
  647. * Usage Maximum (05h),
  648. * Logical Minimum (0),
  649. * Logical Maximum (1),
  650. * Report Size (1),
  651. * Report Count (5),
  652. * Input (Variable),
  653. * Report Size (3),
  654. * Report Count (1),
  655. * Input (Constant, Variable),
  656. * Usage Page (Desktop),
  657. * Usage (X),
  658. * Usage (Y),
  659. * Usage (Wheel),
  660. * Logical Minimum (-127),
  661. * Logical Maximum (127),
  662. * Report Size (8),
  663. * Report Count (3),
  664. * Input (Variable, Relative),
  665. * End Collection,
  666. * End Collection,
  667. * Usage Page (Digitizer),
  668. * Usage (Pen),
  669. * Collection (Application),
  670. * Report ID (2),
  671. * Usage (Stylus),
  672. * Collection (Physical),
  673. * Usage (00h),
  674. * Logical Minimum (0),
  675. * Logical Maximum (255),
  676. * Report Size (8),
  677. * Report Count (7),
  678. * Input (Variable),
  679. * Usage (Azimuth),
  680. * Usage (Altitude),
  681. * Logical Minimum (0),
  682. * Logical Maximum (255),
  683. * Report Size (8),
  684. * Report Count (2),
  685. * Feature (Variable),
  686. * End Collection,
  687. * Report ID (5),
  688. * Usage Page (Digitizer),
  689. * Usage (Stylus),
  690. * Collection (Physical),
  691. * Usage (00h),
  692. * Logical Minimum (0),
  693. * Logical Maximum (255),
  694. * Report Size (8),
  695. * Report Count (7),
  696. * Input (Variable),
  697. * End Collection,
  698. * Report ID (10),
  699. * Usage Page (Digitizer),
  700. * Usage (Stylus),
  701. * Collection (Physical),
  702. * Usage (00h),
  703. * Logical Minimum (0),
  704. * Logical Maximum (255),
  705. * Report Size (8),
  706. * Report Count (7),
  707. * Input (Variable),
  708. * End Collection,
  709. * Report ID (16),
  710. * Usage (Stylus),
  711. * Collection (Physical),
  712. * Usage (Tip Switch),
  713. * Usage (Barrel Switch),
  714. * Usage (Invert),
  715. * Usage (Eraser),
  716. * Usage (In Range),
  717. * Logical Minimum (0),
  718. * Logical Maximum (1),
  719. * Report Size (1),
  720. * Report Count (5),
  721. * Input (Variable),
  722. * Report Count (3),
  723. * Input (Constant, Variable),
  724. * Usage Page (Desktop),
  725. * Usage (X),
  726. * Report Size (16),
  727. * Report Count (1),
  728. * Push,
  729. * Unit Exponent (13),
  730. * Unit (Inch^3),
  731. * Logical Minimum (0),
  732. * Logical Maximum (18000),
  733. * Physical Minimum (0),
  734. * Physical Maximum (18000),
  735. * Input (Variable),
  736. * Usage (Y),
  737. * Logical Maximum (11000),
  738. * Physical Maximum (11000),
  739. * Input (Variable),
  740. * Usage Page (Digitizer),
  741. * Usage (Tip Pressure),
  742. * Logical Minimum (0),
  743. * Logical Maximum (1023),
  744. * Physical Minimum (0),
  745. * Physical Maximum (1023),
  746. * Input (Variable),
  747. * End Collection,
  748. * End Collection,
  749. * Usage Page (Desktop),
  750. * Usage (Keyboard),
  751. * Collection (Application),
  752. * Report ID (13),
  753. * Usage Page (Keyboard),
  754. * Usage Minimum (KB Leftcontrol),
  755. * Usage Maximum (KB Right GUI),
  756. * Logical Minimum (0),
  757. * Logical Maximum (1),
  758. * Report Size (1),
  759. * Report Count (8),
  760. * Input (Variable),
  761. * Report Size (8),
  762. * Report Count (1),
  763. * Input (Constant),
  764. * Usage Page (Keyboard),
  765. * Usage Minimum (None),
  766. * Usage Maximum (KB Application),
  767. * Logical Minimum (0),
  768. * Logical Maximum (101),
  769. * Report Size (8),
  770. * Report Count (5),
  771. * Input,
  772. * End Collection,
  773. * Usage Page (Consumer),
  774. * Usage (Consumer Control),
  775. * Collection (Application),
  776. * Report ID (12),
  777. * Usage (Volume Inc),
  778. * Usage (Volume Dec),
  779. * Usage (Mute),
  780. * Logical Minimum (0),
  781. * Logical Maximum (1),
  782. * Report Size (1),
  783. * Report Count (3),
  784. * Input (Variable, Relative),
  785. * Report Size (5),
  786. * Report Count (1),
  787. * Input (Constant, Variable, Relative),
  788. * End Collection
  789. */
  790. /* Size of the original report descriptor of Media Tablet 10.6 inch */
  791. #define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
  792. /*
  793. * Fixed Media Tablet 10.6 inch descriptor.
  794. *
  795. * The descriptions of reports unused in the default configuration are
  796. * removed. The stylus report (ID 16) is fixed similarly to Slim Tablet 5.8
  797. * inch. The unused mouse report (ID 1) fields are replaced with constant
  798. * padding.
  799. *
  800. * The keyboard report (ID 13) is hacked to instead have an "array" field
  801. * reporting consumer page controls, and all the unused bits are masked out
  802. * with constant padding. The "brush" wheels' function is represented as "Scan
  803. * Previous/Next Track" controls due to the lack of brush controls in the
  804. * usage tables specification.
  805. */
  806. static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
  807. 0x05, 0x0D, /* Usage Page (Digitizer), */
  808. 0x09, 0x02, /* Usage (Pen), */
  809. 0xA1, 0x01, /* Collection (Application), */
  810. 0x85, 0x10, /* Report ID (16), */
  811. 0x09, 0x20, /* Usage (Stylus), */
  812. 0xA0, /* Collection (Physical), */
  813. 0x09, 0x42, /* Usage (Tip Switch), */
  814. 0x09, 0x44, /* Usage (Barrel Switch), */
  815. 0x09, 0x46, /* Usage (Tablet Pick), */
  816. 0x15, 0x01, /* Logical Minimum (1), */
  817. 0x25, 0x03, /* Logical Maximum (3), */
  818. 0x75, 0x04, /* Report Size (4), */
  819. 0x95, 0x01, /* Report Count (1), */
  820. 0x80, /* Input, */
  821. 0x75, 0x01, /* Report Size (1), */
  822. 0x09, 0x32, /* Usage (In Range), */
  823. 0x14, /* Logical Minimum (0), */
  824. 0x25, 0x01, /* Logical Maximum (1), */
  825. 0x95, 0x01, /* Report Count (1), */
  826. 0x81, 0x02, /* Input (Variable), */
  827. 0x95, 0x03, /* Report Count (3), */
  828. 0x81, 0x03, /* Input (Constant, Variable), */
  829. 0x75, 0x10, /* Report Size (16), */
  830. 0x95, 0x01, /* Report Count (1), */
  831. 0x14, /* Logical Minimum (0), */
  832. 0xA4, /* Push, */
  833. 0x05, 0x01, /* Usage Page (Desktop), */
  834. 0x65, 0x13, /* Unit (Inch), */
  835. 0x55, 0xFD, /* Unit Exponent (-3), */
  836. 0x34, /* Physical Minimum (0), */
  837. 0x09, 0x30, /* Usage (X), */
  838. 0x46, 0x28, 0x23, /* Physical Maximum (9000), */
  839. 0x26, 0x50, 0x46, /* Logical Maximum (18000), */
  840. 0x81, 0x02, /* Input (Variable), */
  841. 0x09, 0x31, /* Usage (Y), */
  842. 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */
  843. 0x26, 0xF8, 0x2A, /* Logical Maximum (11000), */
  844. 0x81, 0x02, /* Input (Variable), */
  845. 0xB4, /* Pop, */
  846. 0x09, 0x30, /* Usage (Tip Pressure), */
  847. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  848. 0x81, 0x02, /* Input (Variable), */
  849. 0xC0, /* End Collection, */
  850. 0xC0, /* End Collection, */
  851. 0x05, 0x01, /* Usage Page (Desktop), */
  852. 0x09, 0x02, /* Usage (Mouse), */
  853. 0xA1, 0x01, /* Collection (Application), */
  854. 0x85, 0x01, /* Report ID (1), */
  855. 0x09, 0x01, /* Usage (Pointer), */
  856. 0xA0, /* Collection (Physical), */
  857. 0x75, 0x08, /* Report Size (8), */
  858. 0x95, 0x03, /* Report Count (3), */
  859. 0x81, 0x03, /* Input (Constant, Variable), */
  860. 0x95, 0x02, /* Report Count (2), */
  861. 0x15, 0xFF, /* Logical Minimum (-1), */
  862. 0x25, 0x01, /* Logical Maximum (1), */
  863. 0x09, 0x38, /* Usage (Wheel), */
  864. 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
  865. 0x0C, 0x00,
  866. 0x81, 0x06, /* Input (Variable, Relative), */
  867. 0x95, 0x02, /* Report Count (2), */
  868. 0x81, 0x03, /* Input (Constant, Variable), */
  869. 0xC0, /* End Collection, */
  870. 0xC0, /* End Collection, */
  871. 0x05, 0x0C, /* Usage Page (Consumer), */
  872. 0x09, 0x01, /* Usage (Consumer Control), */
  873. 0xA1, 0x01, /* Collection (Application), */
  874. 0x85, 0x0D, /* Report ID (13), */
  875. 0x95, 0x01, /* Report Count (1), */
  876. 0x75, 0x10, /* Report Size (16), */
  877. 0x81, 0x03, /* Input (Constant, Variable), */
  878. 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
  879. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  880. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  881. 0x09, 0xB6, /* Usage (Scan Previous Track), */
  882. 0x09, 0xB5, /* Usage (Scan Next Track), */
  883. 0x08, /* Usage (00h), */
  884. 0x08, /* Usage (00h), */
  885. 0x08, /* Usage (00h), */
  886. 0x08, /* Usage (00h), */
  887. 0x08, /* Usage (00h), */
  888. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  889. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  890. 0x15, 0x0C, /* Logical Minimum (12), */
  891. 0x25, 0x17, /* Logical Maximum (23), */
  892. 0x75, 0x05, /* Report Size (5), */
  893. 0x80, /* Input, */
  894. 0x75, 0x03, /* Report Size (3), */
  895. 0x81, 0x03, /* Input (Constant, Variable), */
  896. 0x75, 0x20, /* Report Size (32), */
  897. 0x81, 0x03, /* Input (Constant, Variable), */
  898. 0xC0, /* End Collection, */
  899. 0x09, 0x01, /* Usage (Consumer Control), */
  900. 0xA1, 0x01, /* Collection (Application), */
  901. 0x85, 0x0C, /* Report ID (12), */
  902. 0x75, 0x01, /* Report Size (1), */
  903. 0x09, 0xE9, /* Usage (Volume Inc), */
  904. 0x09, 0xEA, /* Usage (Volume Dec), */
  905. 0x09, 0xE2, /* Usage (Mute), */
  906. 0x14, /* Logical Minimum (0), */
  907. 0x25, 0x01, /* Logical Maximum (1), */
  908. 0x95, 0x03, /* Report Count (3), */
  909. 0x81, 0x06, /* Input (Variable, Relative), */
  910. 0x95, 0x35, /* Report Count (53), */
  911. 0x81, 0x03, /* Input (Constant, Variable), */
  912. 0xC0 /* End Collection */
  913. };
  914. /*
  915. * Original Media Tablet 14.1 inch report descriptor.
  916. *
  917. * There are at least two versions of this model in the wild. They are
  918. * represented by Genius G-Pen M712 (older version) and Genius G-Pen M712X
  919. * (newer version). The hardware difference between these versions is the same
  920. * as between older and newer versions of Media Tablet 10.6 inch. The report
  921. * descriptors are identical for both versions.
  922. *
  923. * The function, behavior and report descriptor of this tablet is similar to
  924. * that of Media Tablet 10.6 inch. However, there is one more field (with
  925. * Consumer AC Pan usage) in the mouse description. Then the tablet X and Y
  926. * logical extents both get scaled to 0..16383 range (a hardware limit?),
  927. * which kind of defeats the advertised 4000 LPI resolution, considering the
  928. * physical extents of 12x7.25 inches. Plus, reports 5, 10 and 255 are used
  929. * sometimes (while moving the pen) with unknown purpose. Also, the key codes
  930. * generated for zoom in/out are different.
  931. *
  932. * Usage Page (Desktop),
  933. * Usage (Mouse),
  934. * Collection (Application),
  935. * Report ID (1),
  936. * Usage (Pointer),
  937. * Collection (Physical),
  938. * Usage Page (Button),
  939. * Usage Minimum (01h),
  940. * Usage Maximum (05h),
  941. * Logical Minimum (0),
  942. * Logical Maximum (1),
  943. * Report Size (1),
  944. * Report Count (5),
  945. * Input (Variable),
  946. * Report Size (3),
  947. * Report Count (1),
  948. * Input (Constant, Variable),
  949. * Usage Page (Desktop),
  950. * Usage (X),
  951. * Usage (Y),
  952. * Usage (Wheel),
  953. * Logical Minimum (-127),
  954. * Logical Maximum (127),
  955. * Report Size (8),
  956. * Report Count (3),
  957. * Input (Variable, Relative),
  958. * Usage Page (Consumer),
  959. * Logical Minimum (-127),
  960. * Logical Maximum (127),
  961. * Report Size (8),
  962. * Report Count (1),
  963. * Usage (AC Pan),
  964. * Input (Variable, Relative),
  965. * End Collection,
  966. * End Collection,
  967. * Usage Page (Digitizer),
  968. * Usage (Pen),
  969. * Collection (Application),
  970. * Report ID (2),
  971. * Usage (Stylus),
  972. * Collection (Physical),
  973. * Usage (00h),
  974. * Logical Minimum (0),
  975. * Logical Maximum (255),
  976. * Report Size (8),
  977. * Report Count (7),
  978. * Input (Variable),
  979. * Usage (Azimuth),
  980. * Usage (Altitude),
  981. * Logical Minimum (0),
  982. * Logical Maximum (255),
  983. * Report Size (8),
  984. * Report Count (2),
  985. * Feature (Variable),
  986. * End Collection,
  987. * Report ID (5),
  988. * Usage Page (Digitizer),
  989. * Usage (Stylus),
  990. * Collection (Physical),
  991. * Usage (00h),
  992. * Logical Minimum (0),
  993. * Logical Maximum (255),
  994. * Report Size (8),
  995. * Report Count (7),
  996. * Input (Variable),
  997. * End Collection,
  998. * Report ID (10),
  999. * Usage Page (Digitizer),
  1000. * Usage (Stylus),
  1001. * Collection (Physical),
  1002. * Usage (00h),
  1003. * Logical Minimum (0),
  1004. * Logical Maximum (255),
  1005. * Report Size (8),
  1006. * Report Count (7),
  1007. * Input (Variable),
  1008. * End Collection,
  1009. * Report ID (16),
  1010. * Usage (Stylus),
  1011. * Collection (Physical),
  1012. * Usage (Tip Switch),
  1013. * Usage (Barrel Switch),
  1014. * Usage (Invert),
  1015. * Usage (Eraser),
  1016. * Usage (In Range),
  1017. * Logical Minimum (0),
  1018. * Logical Maximum (1),
  1019. * Report Size (1),
  1020. * Report Count (5),
  1021. * Input (Variable),
  1022. * Report Count (3),
  1023. * Input (Constant, Variable),
  1024. * Usage Page (Desktop),
  1025. * Usage (X),
  1026. * Report Size (16),
  1027. * Report Count (1),
  1028. * Push,
  1029. * Unit Exponent (13),
  1030. * Unit (Inch^3),
  1031. * Logical Minimum (0),
  1032. * Logical Maximum (16383),
  1033. * Physical Minimum (0),
  1034. * Physical Maximum (16383),
  1035. * Input (Variable),
  1036. * Usage (Y),
  1037. * Input (Variable),
  1038. * Usage Page (Digitizer),
  1039. * Usage (Tip Pressure),
  1040. * Logical Minimum (0),
  1041. * Logical Maximum (1023),
  1042. * Physical Minimum (0),
  1043. * Physical Maximum (1023),
  1044. * Input (Variable),
  1045. * End Collection,
  1046. * End Collection,
  1047. * Usage Page (Desktop),
  1048. * Usage (Keyboard),
  1049. * Collection (Application),
  1050. * Report ID (13),
  1051. * Usage Page (Keyboard),
  1052. * Usage Minimum (KB Leftcontrol),
  1053. * Usage Maximum (KB Right GUI),
  1054. * Logical Minimum (0),
  1055. * Logical Maximum (1),
  1056. * Report Size (1),
  1057. * Report Count (8),
  1058. * Input (Variable),
  1059. * Report Size (8),
  1060. * Report Count (1),
  1061. * Input (Constant),
  1062. * Usage Page (Keyboard),
  1063. * Usage Minimum (None),
  1064. * Usage Maximum (KB Application),
  1065. * Logical Minimum (0),
  1066. * Logical Maximum (101),
  1067. * Report Size (8),
  1068. * Report Count (5),
  1069. * Input,
  1070. * End Collection,
  1071. * Usage Page (Consumer),
  1072. * Usage (Consumer Control),
  1073. * Collection (Application),
  1074. * Report ID (12),
  1075. * Usage (Volume Inc),
  1076. * Usage (Volume Dec),
  1077. * Usage (Mute),
  1078. * Logical Minimum (0),
  1079. * Logical Maximum (1),
  1080. * Report Size (1),
  1081. * Report Count (3),
  1082. * Input (Variable, Relative),
  1083. * Report Size (5),
  1084. * Report Count (1),
  1085. * Input (Constant, Variable, Relative),
  1086. * End Collection
  1087. */
  1088. /* Size of the original report descriptor of Media Tablet 14.1 inch */
  1089. #define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
  1090. /*
  1091. * Fixed Media Tablet 14.1 inch descriptor.
  1092. * It is fixed similarly to the Media Tablet 10.6 inch descriptor.
  1093. */
  1094. static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
  1095. 0x05, 0x0D, /* Usage Page (Digitizer), */
  1096. 0x09, 0x02, /* Usage (Pen), */
  1097. 0xA1, 0x01, /* Collection (Application), */
  1098. 0x85, 0x10, /* Report ID (16), */
  1099. 0x09, 0x20, /* Usage (Stylus), */
  1100. 0xA0, /* Collection (Physical), */
  1101. 0x09, 0x42, /* Usage (Tip Switch), */
  1102. 0x09, 0x44, /* Usage (Barrel Switch), */
  1103. 0x09, 0x46, /* Usage (Tablet Pick), */
  1104. 0x15, 0x01, /* Logical Minimum (1), */
  1105. 0x25, 0x03, /* Logical Maximum (3), */
  1106. 0x75, 0x04, /* Report Size (4), */
  1107. 0x95, 0x01, /* Report Count (1), */
  1108. 0x80, /* Input, */
  1109. 0x75, 0x01, /* Report Size (1), */
  1110. 0x09, 0x32, /* Usage (In Range), */
  1111. 0x14, /* Logical Minimum (0), */
  1112. 0x25, 0x01, /* Logical Maximum (1), */
  1113. 0x95, 0x01, /* Report Count (1), */
  1114. 0x81, 0x02, /* Input (Variable), */
  1115. 0x95, 0x03, /* Report Count (3), */
  1116. 0x81, 0x03, /* Input (Constant, Variable), */
  1117. 0x75, 0x10, /* Report Size (16), */
  1118. 0x95, 0x01, /* Report Count (1), */
  1119. 0x14, /* Logical Minimum (0), */
  1120. 0xA4, /* Push, */
  1121. 0x05, 0x01, /* Usage Page (Desktop), */
  1122. 0x65, 0x13, /* Unit (Inch), */
  1123. 0x55, 0xFD, /* Unit Exponent (-3), */
  1124. 0x34, /* Physical Minimum (0), */
  1125. 0x09, 0x30, /* Usage (X), */
  1126. 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */
  1127. 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
  1128. 0x81, 0x02, /* Input (Variable), */
  1129. 0x09, 0x31, /* Usage (Y), */
  1130. 0x46, 0x52, 0x1C, /* Physical Maximum (7250), */
  1131. 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
  1132. 0x81, 0x02, /* Input (Variable), */
  1133. 0xB4, /* Pop, */
  1134. 0x09, 0x30, /* Usage (Tip Pressure), */
  1135. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  1136. 0x81, 0x02, /* Input (Variable), */
  1137. 0xC0, /* End Collection, */
  1138. 0xC0, /* End Collection, */
  1139. 0x05, 0x01, /* Usage Page (Desktop), */
  1140. 0x09, 0x02, /* Usage (Mouse), */
  1141. 0xA1, 0x01, /* Collection (Application), */
  1142. 0x85, 0x01, /* Report ID (1), */
  1143. 0x09, 0x01, /* Usage (Pointer), */
  1144. 0xA0, /* Collection (Physical), */
  1145. 0x75, 0x08, /* Report Size (8), */
  1146. 0x95, 0x03, /* Report Count (3), */
  1147. 0x81, 0x03, /* Input (Constant, Variable), */
  1148. 0x95, 0x02, /* Report Count (2), */
  1149. 0x15, 0xFF, /* Logical Minimum (-1), */
  1150. 0x25, 0x01, /* Logical Maximum (1), */
  1151. 0x09, 0x38, /* Usage (Wheel), */
  1152. 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
  1153. 0x0C, 0x00,
  1154. 0x81, 0x06, /* Input (Variable, Relative), */
  1155. 0xC0, /* End Collection, */
  1156. 0xC0, /* End Collection, */
  1157. 0x05, 0x0C, /* Usage Page (Consumer), */
  1158. 0x09, 0x01, /* Usage (Consumer Control), */
  1159. 0xA1, 0x01, /* Collection (Application), */
  1160. 0x85, 0x0D, /* Report ID (13), */
  1161. 0x95, 0x01, /* Report Count (1), */
  1162. 0x75, 0x10, /* Report Size (16), */
  1163. 0x81, 0x03, /* Input (Constant, Variable), */
  1164. 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
  1165. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  1166. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  1167. 0x09, 0xB6, /* Usage (Scan Previous Track), */
  1168. 0x09, 0xB5, /* Usage (Scan Next Track), */
  1169. 0x08, /* Usage (00h), */
  1170. 0x08, /* Usage (00h), */
  1171. 0x08, /* Usage (00h), */
  1172. 0x08, /* Usage (00h), */
  1173. 0x08, /* Usage (00h), */
  1174. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  1175. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  1176. 0x15, 0x0C, /* Logical Minimum (12), */
  1177. 0x25, 0x17, /* Logical Maximum (23), */
  1178. 0x75, 0x05, /* Report Size (5), */
  1179. 0x80, /* Input, */
  1180. 0x75, 0x03, /* Report Size (3), */
  1181. 0x81, 0x03, /* Input (Constant, Variable), */
  1182. 0x75, 0x20, /* Report Size (32), */
  1183. 0x81, 0x03, /* Input (Constant, Variable), */
  1184. 0xC0, /* End Collection, */
  1185. 0x09, 0x01, /* Usage (Consumer Control), */
  1186. 0xA1, 0x01, /* Collection (Application), */
  1187. 0x85, 0x0C, /* Report ID (12), */
  1188. 0x75, 0x01, /* Report Size (1), */
  1189. 0x09, 0xE9, /* Usage (Volume Inc), */
  1190. 0x09, 0xEA, /* Usage (Volume Dec), */
  1191. 0x09, 0xE2, /* Usage (Mute), */
  1192. 0x14, /* Logical Minimum (0), */
  1193. 0x25, 0x01, /* Logical Maximum (1), */
  1194. 0x95, 0x03, /* Report Count (3), */
  1195. 0x81, 0x06, /* Input (Variable, Relative), */
  1196. 0x75, 0x05, /* Report Size (5), */
  1197. 0x81, 0x03, /* Input (Constant, Variable), */
  1198. 0xC0 /* End Collection */
  1199. };
  1200. static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  1201. unsigned int *rsize)
  1202. {
  1203. switch (hdev->product) {
  1204. case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
  1205. if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
  1206. rdesc = slim_tablet_5_8_inch_rdesc_fixed;
  1207. *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
  1208. }
  1209. break;
  1210. case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH:
  1211. if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) {
  1212. rdesc = slim_tablet_12_1_inch_rdesc_fixed;
  1213. *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
  1214. }
  1215. break;
  1216. case USB_DEVICE_ID_WALTOP_Q_PAD:
  1217. if (*rsize == Q_PAD_RDESC_ORIG_SIZE) {
  1218. rdesc = q_pad_rdesc_fixed;
  1219. *rsize = sizeof(q_pad_rdesc_fixed);
  1220. }
  1221. break;
  1222. case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
  1223. if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
  1224. rdesc = media_tablet_10_6_inch_rdesc_fixed;
  1225. *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
  1226. }
  1227. break;
  1228. case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
  1229. if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
  1230. rdesc = media_tablet_14_1_inch_rdesc_fixed;
  1231. *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
  1232. }
  1233. break;
  1234. }
  1235. return rdesc;
  1236. }
  1237. static const struct hid_device_id waltop_devices[] = {
  1238. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1239. USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
  1240. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1241. USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
  1242. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1243. USB_DEVICE_ID_WALTOP_Q_PAD) },
  1244. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1245. USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
  1246. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1247. USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
  1248. { }
  1249. };
  1250. MODULE_DEVICE_TABLE(hid, waltop_devices);
  1251. static struct hid_driver waltop_driver = {
  1252. .name = "waltop",
  1253. .id_table = waltop_devices,
  1254. .report_fixup = waltop_report_fixup,
  1255. };
  1256. static int __init waltop_init(void)
  1257. {
  1258. return hid_register_driver(&waltop_driver);
  1259. }
  1260. static void __exit waltop_exit(void)
  1261. {
  1262. hid_unregister_driver(&waltop_driver);
  1263. }
  1264. module_init(waltop_init);
  1265. module_exit(waltop_exit);
  1266. MODULE_LICENSE("GPL");