hid-waltop.c 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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 Media Tablet 10.6 inch report descriptor.
  417. *
  418. * There are at least two versions of this model in the wild. They are
  419. * represented by Genius G-Pen M609 (older version) and Genius G-Pen M609X
  420. * (newer version).
  421. *
  422. * Both versions have the usual pen with two barrel buttons and two
  423. * identical wheels with center buttons in the top corners of the tablet
  424. * base. They also have buttons on the top, between the wheels, for
  425. * selecting the wheels' functions and wide/standard mode. In the wide mode
  426. * the whole working surface is sensed, in the standard mode a narrower area
  427. * is sensed, but the logical report extents remain the same. These modes
  428. * correspond roughly to 16:9 and 4:3 aspect ratios respectively.
  429. *
  430. * The older version has three wheel function buttons ("scroll", "zoom" and
  431. * "volume") and two separate buttons for wide and standard mode. The newer
  432. * version has four wheel function buttons (plus "brush") and only one
  433. * button is used for selecting wide/standard mode. So, the total number of
  434. * buttons remains the same, but one of the mode buttons is repurposed as a
  435. * wheels' function button in the newer version.
  436. *
  437. * The wheel functions are:
  438. * scroll - the wheels act as scroll wheels, the center buttons switch
  439. * between vertical and horizontal scrolling;
  440. * zoom - the wheels zoom in/out, the buttons supposedly reset to 100%;
  441. * volume - the wheels control the sound volume, the buttons mute;
  442. * brush - the wheels are supposed to control brush width in a graphics
  443. * editor, the buttons do nothing.
  444. *
  445. * Below is the newer version's report descriptor. It may very well be that
  446. * the older version's descriptor is different and thus it won't be
  447. * supported.
  448. *
  449. * The mouse report (ID 1) only uses the wheel field for reporting the tablet
  450. * wheels' scroll mode. The keyboard report (ID 13) is used to report the
  451. * wheels' zoom and brush control functions as key presses. The report ID 12
  452. * is used to report the wheels' volume control functions. The stylus report
  453. * (ID 16) has the same problems as the Slim Tablet 5.8 inch report has.
  454. *
  455. * The rest of the reports are unused, at least in the default configuration.
  456. * The purpose of the features is unknown.
  457. *
  458. * Usage Page (Desktop),
  459. * Usage (Mouse),
  460. * Collection (Application),
  461. * Report ID (1),
  462. * Usage (Pointer),
  463. * Collection (Physical),
  464. * Usage Page (Button),
  465. * Usage Minimum (01h),
  466. * Usage Maximum (05h),
  467. * Logical Minimum (0),
  468. * Logical Maximum (1),
  469. * Report Size (1),
  470. * Report Count (5),
  471. * Input (Variable),
  472. * Report Size (3),
  473. * Report Count (1),
  474. * Input (Constant, Variable),
  475. * Usage Page (Desktop),
  476. * Usage (X),
  477. * Usage (Y),
  478. * Usage (Wheel),
  479. * Logical Minimum (-127),
  480. * Logical Maximum (127),
  481. * Report Size (8),
  482. * Report Count (3),
  483. * Input (Variable, Relative),
  484. * End Collection,
  485. * End Collection,
  486. * Usage Page (Digitizer),
  487. * Usage (Pen),
  488. * Collection (Application),
  489. * Report ID (2),
  490. * Usage (Stylus),
  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. * Usage (Azimuth),
  499. * Usage (Altitude),
  500. * Logical Minimum (0),
  501. * Logical Maximum (255),
  502. * Report Size (8),
  503. * Report Count (2),
  504. * Feature (Variable),
  505. * End Collection,
  506. * Report ID (5),
  507. * Usage Page (Digitizer),
  508. * Usage (Stylus),
  509. * Collection (Physical),
  510. * Usage (00h),
  511. * Logical Minimum (0),
  512. * Logical Maximum (255),
  513. * Report Size (8),
  514. * Report Count (7),
  515. * Input (Variable),
  516. * End Collection,
  517. * Report ID (10),
  518. * Usage Page (Digitizer),
  519. * Usage (Stylus),
  520. * Collection (Physical),
  521. * Usage (00h),
  522. * Logical Minimum (0),
  523. * Logical Maximum (255),
  524. * Report Size (8),
  525. * Report Count (7),
  526. * Input (Variable),
  527. * End Collection,
  528. * Report ID (16),
  529. * Usage (Stylus),
  530. * Collection (Physical),
  531. * Usage (Tip Switch),
  532. * Usage (Barrel Switch),
  533. * Usage (Invert),
  534. * Usage (Eraser),
  535. * Usage (In Range),
  536. * Logical Minimum (0),
  537. * Logical Maximum (1),
  538. * Report Size (1),
  539. * Report Count (5),
  540. * Input (Variable),
  541. * Report Count (3),
  542. * Input (Constant, Variable),
  543. * Usage Page (Desktop),
  544. * Usage (X),
  545. * Report Size (16),
  546. * Report Count (1),
  547. * Push,
  548. * Unit Exponent (13),
  549. * Unit (Inch^3),
  550. * Logical Minimum (0),
  551. * Logical Maximum (18000),
  552. * Physical Minimum (0),
  553. * Physical Maximum (18000),
  554. * Input (Variable),
  555. * Usage (Y),
  556. * Logical Maximum (11000),
  557. * Physical Maximum (11000),
  558. * Input (Variable),
  559. * Usage Page (Digitizer),
  560. * Usage (Tip Pressure),
  561. * Logical Minimum (0),
  562. * Logical Maximum (1023),
  563. * Physical Minimum (0),
  564. * Physical Maximum (1023),
  565. * Input (Variable),
  566. * End Collection,
  567. * End Collection,
  568. * Usage Page (Desktop),
  569. * Usage (Keyboard),
  570. * Collection (Application),
  571. * Report ID (13),
  572. * Usage Page (Keyboard),
  573. * Usage Minimum (KB Leftcontrol),
  574. * Usage Maximum (KB Right GUI),
  575. * Logical Minimum (0),
  576. * Logical Maximum (1),
  577. * Report Size (1),
  578. * Report Count (8),
  579. * Input (Variable),
  580. * Report Size (8),
  581. * Report Count (1),
  582. * Input (Constant),
  583. * Usage Page (Keyboard),
  584. * Usage Minimum (None),
  585. * Usage Maximum (KB Application),
  586. * Logical Minimum (0),
  587. * Logical Maximum (101),
  588. * Report Size (8),
  589. * Report Count (5),
  590. * Input,
  591. * End Collection,
  592. * Usage Page (Consumer),
  593. * Usage (Consumer Control),
  594. * Collection (Application),
  595. * Report ID (12),
  596. * Usage (Volume Inc),
  597. * Usage (Volume Dec),
  598. * Usage (Mute),
  599. * Logical Minimum (0),
  600. * Logical Maximum (1),
  601. * Report Size (1),
  602. * Report Count (3),
  603. * Input (Variable, Relative),
  604. * Report Size (5),
  605. * Report Count (1),
  606. * Input (Constant, Variable, Relative),
  607. * End Collection
  608. */
  609. /* Size of the original report descriptor of Media Tablet 10.6 inch */
  610. #define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
  611. /*
  612. * Fixed Media Tablet 10.6 inch descriptor.
  613. *
  614. * The descriptions of reports unused in the default configuration are
  615. * removed. The stylus report (ID 16) is fixed similarly to Slim Tablet 5.8
  616. * inch. The unused mouse report (ID 1) fields are replaced with constant
  617. * padding.
  618. *
  619. * The keyboard report (ID 13) is hacked to instead have an "array" field
  620. * reporting consumer page controls, and all the unused bits are masked out
  621. * with constant padding. The "brush" wheels' function is represented as "Scan
  622. * Previous/Next Track" controls due to the lack of brush controls in the
  623. * usage tables specification.
  624. */
  625. static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
  626. 0x05, 0x0D, /* Usage Page (Digitizer), */
  627. 0x09, 0x02, /* Usage (Pen), */
  628. 0xA1, 0x01, /* Collection (Application), */
  629. 0x85, 0x10, /* Report ID (16), */
  630. 0x09, 0x20, /* Usage (Stylus), */
  631. 0xA0, /* Collection (Physical), */
  632. 0x09, 0x42, /* Usage (Tip Switch), */
  633. 0x09, 0x44, /* Usage (Barrel Switch), */
  634. 0x09, 0x46, /* Usage (Tablet Pick), */
  635. 0x15, 0x01, /* Logical Minimum (1), */
  636. 0x25, 0x03, /* Logical Maximum (3), */
  637. 0x75, 0x04, /* Report Size (4), */
  638. 0x95, 0x01, /* Report Count (1), */
  639. 0x80, /* Input, */
  640. 0x75, 0x01, /* Report Size (1), */
  641. 0x09, 0x32, /* Usage (In Range), */
  642. 0x14, /* Logical Minimum (0), */
  643. 0x25, 0x01, /* Logical Maximum (1), */
  644. 0x95, 0x01, /* Report Count (1), */
  645. 0x81, 0x02, /* Input (Variable), */
  646. 0x95, 0x03, /* Report Count (3), */
  647. 0x81, 0x03, /* Input (Constant, Variable), */
  648. 0x75, 0x10, /* Report Size (16), */
  649. 0x95, 0x01, /* Report Count (1), */
  650. 0x14, /* Logical Minimum (0), */
  651. 0xA4, /* Push, */
  652. 0x05, 0x01, /* Usage Page (Desktop), */
  653. 0x65, 0x13, /* Unit (Inch), */
  654. 0x55, 0xFD, /* Unit Exponent (-3), */
  655. 0x34, /* Physical Minimum (0), */
  656. 0x09, 0x30, /* Usage (X), */
  657. 0x46, 0x28, 0x23, /* Physical Maximum (9000), */
  658. 0x26, 0x50, 0x46, /* Logical Maximum (18000), */
  659. 0x81, 0x02, /* Input (Variable), */
  660. 0x09, 0x31, /* Usage (Y), */
  661. 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */
  662. 0x26, 0xF8, 0x2A, /* Logical Maximum (11000), */
  663. 0x81, 0x02, /* Input (Variable), */
  664. 0xB4, /* Pop, */
  665. 0x09, 0x30, /* Usage (Tip Pressure), */
  666. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  667. 0x81, 0x02, /* Input (Variable), */
  668. 0xC0, /* End Collection, */
  669. 0xC0, /* End Collection, */
  670. 0x05, 0x01, /* Usage Page (Desktop), */
  671. 0x09, 0x02, /* Usage (Mouse), */
  672. 0xA1, 0x01, /* Collection (Application), */
  673. 0x85, 0x01, /* Report ID (1), */
  674. 0x09, 0x01, /* Usage (Pointer), */
  675. 0xA0, /* Collection (Physical), */
  676. 0x75, 0x08, /* Report Size (8), */
  677. 0x95, 0x03, /* Report Count (3), */
  678. 0x81, 0x03, /* Input (Constant, Variable), */
  679. 0x95, 0x02, /* Report Count (2), */
  680. 0x15, 0xFF, /* Logical Minimum (-1), */
  681. 0x25, 0x01, /* Logical Maximum (1), */
  682. 0x09, 0x38, /* Usage (Wheel), */
  683. 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
  684. 0x0C, 0x00,
  685. 0x81, 0x06, /* Input (Variable, Relative), */
  686. 0x95, 0x02, /* Report Count (2), */
  687. 0x81, 0x03, /* Input (Constant, Variable), */
  688. 0xC0, /* End Collection, */
  689. 0xC0, /* End Collection, */
  690. 0x05, 0x0C, /* Usage Page (Consumer), */
  691. 0x09, 0x01, /* Usage (Consumer Control), */
  692. 0xA1, 0x01, /* Collection (Application), */
  693. 0x85, 0x0D, /* Report ID (13), */
  694. 0x95, 0x01, /* Report Count (1), */
  695. 0x75, 0x10, /* Report Size (16), */
  696. 0x81, 0x03, /* Input (Constant, Variable), */
  697. 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
  698. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  699. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  700. 0x09, 0xB6, /* Usage (Scan Previous Track), */
  701. 0x09, 0xB5, /* Usage (Scan Next Track), */
  702. 0x08, /* Usage (00h), */
  703. 0x08, /* Usage (00h), */
  704. 0x08, /* Usage (00h), */
  705. 0x08, /* Usage (00h), */
  706. 0x08, /* Usage (00h), */
  707. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  708. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  709. 0x15, 0x0C, /* Logical Minimum (12), */
  710. 0x25, 0x17, /* Logical Maximum (23), */
  711. 0x75, 0x05, /* Report Size (5), */
  712. 0x80, /* Input, */
  713. 0x75, 0x03, /* Report Size (3), */
  714. 0x81, 0x03, /* Input (Constant, Variable), */
  715. 0x75, 0x20, /* Report Size (32), */
  716. 0x81, 0x03, /* Input (Constant, Variable), */
  717. 0xC0, /* End Collection, */
  718. 0x09, 0x01, /* Usage (Consumer Control), */
  719. 0xA1, 0x01, /* Collection (Application), */
  720. 0x85, 0x0C, /* Report ID (12), */
  721. 0x75, 0x01, /* Report Size (1), */
  722. 0x09, 0xE9, /* Usage (Volume Inc), */
  723. 0x09, 0xEA, /* Usage (Volume Dec), */
  724. 0x09, 0xE2, /* Usage (Mute), */
  725. 0x14, /* Logical Minimum (0), */
  726. 0x25, 0x01, /* Logical Maximum (1), */
  727. 0x95, 0x03, /* Report Count (3), */
  728. 0x81, 0x06, /* Input (Variable, Relative), */
  729. 0x95, 0x35, /* Report Count (53), */
  730. 0x81, 0x03, /* Input (Constant, Variable), */
  731. 0xC0 /* End Collection */
  732. };
  733. /*
  734. * Original Media Tablet 14.1 inch report descriptor.
  735. *
  736. * There are at least two versions of this model in the wild. They are
  737. * represented by Genius G-Pen M712 (older version) and Genius G-Pen M712X
  738. * (newer version). The hardware difference between these versions is the same
  739. * as between older and newer versions of Media Tablet 10.6 inch. The report
  740. * descriptors are identical for both versions.
  741. *
  742. * The function, behavior and report descriptor of this tablet is similar to
  743. * that of Media Tablet 10.6 inch. However, there is one more field (with
  744. * Consumer AC Pan usage) in the mouse description. Then the tablet X and Y
  745. * logical extents both get scaled to 0..16383 range (a hardware limit?),
  746. * which kind of defeats the advertised 4000 LPI resolution, considering the
  747. * physical extents of 12x7.25 inches. Plus, reports 5, 10 and 255 are used
  748. * sometimes (while moving the pen) with unknown purpose. Also, the key codes
  749. * generated for zoom in/out are different.
  750. *
  751. * Usage Page (Desktop),
  752. * Usage (Mouse),
  753. * Collection (Application),
  754. * Report ID (1),
  755. * Usage (Pointer),
  756. * Collection (Physical),
  757. * Usage Page (Button),
  758. * Usage Minimum (01h),
  759. * Usage Maximum (05h),
  760. * Logical Minimum (0),
  761. * Logical Maximum (1),
  762. * Report Size (1),
  763. * Report Count (5),
  764. * Input (Variable),
  765. * Report Size (3),
  766. * Report Count (1),
  767. * Input (Constant, Variable),
  768. * Usage Page (Desktop),
  769. * Usage (X),
  770. * Usage (Y),
  771. * Usage (Wheel),
  772. * Logical Minimum (-127),
  773. * Logical Maximum (127),
  774. * Report Size (8),
  775. * Report Count (3),
  776. * Input (Variable, Relative),
  777. * Usage Page (Consumer),
  778. * Logical Minimum (-127),
  779. * Logical Maximum (127),
  780. * Report Size (8),
  781. * Report Count (1),
  782. * Usage (AC Pan),
  783. * Input (Variable, Relative),
  784. * End Collection,
  785. * End Collection,
  786. * Usage Page (Digitizer),
  787. * Usage (Pen),
  788. * Collection (Application),
  789. * Report ID (2),
  790. * Usage (Stylus),
  791. * Collection (Physical),
  792. * Usage (00h),
  793. * Logical Minimum (0),
  794. * Logical Maximum (255),
  795. * Report Size (8),
  796. * Report Count (7),
  797. * Input (Variable),
  798. * Usage (Azimuth),
  799. * Usage (Altitude),
  800. * Logical Minimum (0),
  801. * Logical Maximum (255),
  802. * Report Size (8),
  803. * Report Count (2),
  804. * Feature (Variable),
  805. * End Collection,
  806. * Report ID (5),
  807. * Usage Page (Digitizer),
  808. * Usage (Stylus),
  809. * Collection (Physical),
  810. * Usage (00h),
  811. * Logical Minimum (0),
  812. * Logical Maximum (255),
  813. * Report Size (8),
  814. * Report Count (7),
  815. * Input (Variable),
  816. * End Collection,
  817. * Report ID (10),
  818. * Usage Page (Digitizer),
  819. * Usage (Stylus),
  820. * Collection (Physical),
  821. * Usage (00h),
  822. * Logical Minimum (0),
  823. * Logical Maximum (255),
  824. * Report Size (8),
  825. * Report Count (7),
  826. * Input (Variable),
  827. * End Collection,
  828. * Report ID (16),
  829. * Usage (Stylus),
  830. * Collection (Physical),
  831. * Usage (Tip Switch),
  832. * Usage (Barrel Switch),
  833. * Usage (Invert),
  834. * Usage (Eraser),
  835. * Usage (In Range),
  836. * Logical Minimum (0),
  837. * Logical Maximum (1),
  838. * Report Size (1),
  839. * Report Count (5),
  840. * Input (Variable),
  841. * Report Count (3),
  842. * Input (Constant, Variable),
  843. * Usage Page (Desktop),
  844. * Usage (X),
  845. * Report Size (16),
  846. * Report Count (1),
  847. * Push,
  848. * Unit Exponent (13),
  849. * Unit (Inch^3),
  850. * Logical Minimum (0),
  851. * Logical Maximum (16383),
  852. * Physical Minimum (0),
  853. * Physical Maximum (16383),
  854. * Input (Variable),
  855. * Usage (Y),
  856. * Input (Variable),
  857. * Usage Page (Digitizer),
  858. * Usage (Tip Pressure),
  859. * Logical Minimum (0),
  860. * Logical Maximum (1023),
  861. * Physical Minimum (0),
  862. * Physical Maximum (1023),
  863. * Input (Variable),
  864. * End Collection,
  865. * End Collection,
  866. * Usage Page (Desktop),
  867. * Usage (Keyboard),
  868. * Collection (Application),
  869. * Report ID (13),
  870. * Usage Page (Keyboard),
  871. * Usage Minimum (KB Leftcontrol),
  872. * Usage Maximum (KB Right GUI),
  873. * Logical Minimum (0),
  874. * Logical Maximum (1),
  875. * Report Size (1),
  876. * Report Count (8),
  877. * Input (Variable),
  878. * Report Size (8),
  879. * Report Count (1),
  880. * Input (Constant),
  881. * Usage Page (Keyboard),
  882. * Usage Minimum (None),
  883. * Usage Maximum (KB Application),
  884. * Logical Minimum (0),
  885. * Logical Maximum (101),
  886. * Report Size (8),
  887. * Report Count (5),
  888. * Input,
  889. * End Collection,
  890. * Usage Page (Consumer),
  891. * Usage (Consumer Control),
  892. * Collection (Application),
  893. * Report ID (12),
  894. * Usage (Volume Inc),
  895. * Usage (Volume Dec),
  896. * Usage (Mute),
  897. * Logical Minimum (0),
  898. * Logical Maximum (1),
  899. * Report Size (1),
  900. * Report Count (3),
  901. * Input (Variable, Relative),
  902. * Report Size (5),
  903. * Report Count (1),
  904. * Input (Constant, Variable, Relative),
  905. * End Collection
  906. */
  907. /* Size of the original report descriptor of Media Tablet 14.1 inch */
  908. #define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
  909. /*
  910. * Fixed Media Tablet 14.1 inch descriptor.
  911. * It is fixed similarly to the Media Tablet 10.6 inch descriptor.
  912. */
  913. static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
  914. 0x05, 0x0D, /* Usage Page (Digitizer), */
  915. 0x09, 0x02, /* Usage (Pen), */
  916. 0xA1, 0x01, /* Collection (Application), */
  917. 0x85, 0x10, /* Report ID (16), */
  918. 0x09, 0x20, /* Usage (Stylus), */
  919. 0xA0, /* Collection (Physical), */
  920. 0x09, 0x42, /* Usage (Tip Switch), */
  921. 0x09, 0x44, /* Usage (Barrel Switch), */
  922. 0x09, 0x46, /* Usage (Tablet Pick), */
  923. 0x15, 0x01, /* Logical Minimum (1), */
  924. 0x25, 0x03, /* Logical Maximum (3), */
  925. 0x75, 0x04, /* Report Size (4), */
  926. 0x95, 0x01, /* Report Count (1), */
  927. 0x80, /* Input, */
  928. 0x75, 0x01, /* Report Size (1), */
  929. 0x09, 0x32, /* Usage (In Range), */
  930. 0x14, /* Logical Minimum (0), */
  931. 0x25, 0x01, /* Logical Maximum (1), */
  932. 0x95, 0x01, /* Report Count (1), */
  933. 0x81, 0x02, /* Input (Variable), */
  934. 0x95, 0x03, /* Report Count (3), */
  935. 0x81, 0x03, /* Input (Constant, Variable), */
  936. 0x75, 0x10, /* Report Size (16), */
  937. 0x95, 0x01, /* Report Count (1), */
  938. 0x14, /* Logical Minimum (0), */
  939. 0xA4, /* Push, */
  940. 0x05, 0x01, /* Usage Page (Desktop), */
  941. 0x65, 0x13, /* Unit (Inch), */
  942. 0x55, 0xFD, /* Unit Exponent (-3), */
  943. 0x34, /* Physical Minimum (0), */
  944. 0x09, 0x30, /* Usage (X), */
  945. 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */
  946. 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
  947. 0x81, 0x02, /* Input (Variable), */
  948. 0x09, 0x31, /* Usage (Y), */
  949. 0x46, 0x52, 0x1C, /* Physical Maximum (7250), */
  950. 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
  951. 0x81, 0x02, /* Input (Variable), */
  952. 0xB4, /* Pop, */
  953. 0x09, 0x30, /* Usage (Tip Pressure), */
  954. 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
  955. 0x81, 0x02, /* Input (Variable), */
  956. 0xC0, /* End Collection, */
  957. 0xC0, /* End Collection, */
  958. 0x05, 0x01, /* Usage Page (Desktop), */
  959. 0x09, 0x02, /* Usage (Mouse), */
  960. 0xA1, 0x01, /* Collection (Application), */
  961. 0x85, 0x01, /* Report ID (1), */
  962. 0x09, 0x01, /* Usage (Pointer), */
  963. 0xA0, /* Collection (Physical), */
  964. 0x75, 0x08, /* Report Size (8), */
  965. 0x95, 0x03, /* Report Count (3), */
  966. 0x81, 0x03, /* Input (Constant, Variable), */
  967. 0x95, 0x02, /* Report Count (2), */
  968. 0x15, 0xFF, /* Logical Minimum (-1), */
  969. 0x25, 0x01, /* Logical Maximum (1), */
  970. 0x09, 0x38, /* Usage (Wheel), */
  971. 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
  972. 0x0C, 0x00,
  973. 0x81, 0x06, /* Input (Variable, Relative), */
  974. 0xC0, /* End Collection, */
  975. 0xC0, /* End Collection, */
  976. 0x05, 0x0C, /* Usage Page (Consumer), */
  977. 0x09, 0x01, /* Usage (Consumer Control), */
  978. 0xA1, 0x01, /* Collection (Application), */
  979. 0x85, 0x0D, /* Report ID (13), */
  980. 0x95, 0x01, /* Report Count (1), */
  981. 0x75, 0x10, /* Report Size (16), */
  982. 0x81, 0x03, /* Input (Constant, Variable), */
  983. 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
  984. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  985. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  986. 0x09, 0xB6, /* Usage (Scan Previous Track), */
  987. 0x09, 0xB5, /* Usage (Scan Next Track), */
  988. 0x08, /* Usage (00h), */
  989. 0x08, /* Usage (00h), */
  990. 0x08, /* Usage (00h), */
  991. 0x08, /* Usage (00h), */
  992. 0x08, /* Usage (00h), */
  993. 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
  994. 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
  995. 0x15, 0x0C, /* Logical Minimum (12), */
  996. 0x25, 0x17, /* Logical Maximum (23), */
  997. 0x75, 0x05, /* Report Size (5), */
  998. 0x80, /* Input, */
  999. 0x75, 0x03, /* Report Size (3), */
  1000. 0x81, 0x03, /* Input (Constant, Variable), */
  1001. 0x75, 0x20, /* Report Size (32), */
  1002. 0x81, 0x03, /* Input (Constant, Variable), */
  1003. 0xC0, /* End Collection, */
  1004. 0x09, 0x01, /* Usage (Consumer Control), */
  1005. 0xA1, 0x01, /* Collection (Application), */
  1006. 0x85, 0x0C, /* Report ID (12), */
  1007. 0x75, 0x01, /* Report Size (1), */
  1008. 0x09, 0xE9, /* Usage (Volume Inc), */
  1009. 0x09, 0xEA, /* Usage (Volume Dec), */
  1010. 0x09, 0xE2, /* Usage (Mute), */
  1011. 0x14, /* Logical Minimum (0), */
  1012. 0x25, 0x01, /* Logical Maximum (1), */
  1013. 0x95, 0x03, /* Report Count (3), */
  1014. 0x81, 0x06, /* Input (Variable, Relative), */
  1015. 0x75, 0x05, /* Report Size (5), */
  1016. 0x81, 0x03, /* Input (Constant, Variable), */
  1017. 0xC0 /* End Collection */
  1018. };
  1019. static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  1020. unsigned int *rsize)
  1021. {
  1022. switch (hdev->product) {
  1023. case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
  1024. if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
  1025. rdesc = slim_tablet_5_8_inch_rdesc_fixed;
  1026. *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
  1027. }
  1028. break;
  1029. case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH:
  1030. if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) {
  1031. rdesc = slim_tablet_12_1_inch_rdesc_fixed;
  1032. *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
  1033. }
  1034. break;
  1035. case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
  1036. if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
  1037. rdesc = media_tablet_10_6_inch_rdesc_fixed;
  1038. *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
  1039. }
  1040. break;
  1041. case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
  1042. if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
  1043. rdesc = media_tablet_14_1_inch_rdesc_fixed;
  1044. *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
  1045. }
  1046. break;
  1047. }
  1048. return rdesc;
  1049. }
  1050. static const struct hid_device_id waltop_devices[] = {
  1051. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1052. USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
  1053. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1054. USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
  1055. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1056. USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
  1057. { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
  1058. USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
  1059. { }
  1060. };
  1061. MODULE_DEVICE_TABLE(hid, waltop_devices);
  1062. static struct hid_driver waltop_driver = {
  1063. .name = "waltop",
  1064. .id_table = waltop_devices,
  1065. .report_fixup = waltop_report_fixup,
  1066. };
  1067. static int __init waltop_init(void)
  1068. {
  1069. return hid_register_driver(&waltop_driver);
  1070. }
  1071. static void __exit waltop_exit(void)
  1072. {
  1073. hid_unregister_driver(&waltop_driver);
  1074. }
  1075. module_init(waltop_init);
  1076. module_exit(waltop_exit);
  1077. MODULE_LICENSE("GPL");