hid-wacom.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. * Bluetooth Wacom Tablet support
  3. *
  4. * Copyright (c) 1999 Andreas Gal
  5. * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
  6. * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
  7. * Copyright (c) 2006-2007 Jiri Kosina
  8. * Copyright (c) 2007 Paul Walmsley
  9. * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com>
  10. * Copyright (c) 2006 Andrew Zabolotny <zap@homelink.ru>
  11. * Copyright (c) 2009 Bastien Nocera <hadess@hadess.net>
  12. * Copyright (c) 2011 Przemysław Firszt <przemo@firszt.eu>
  13. */
  14. /*
  15. * This program is free software; you can redistribute it and/or modify it
  16. * under the terms of the GNU General Public License as published by the Free
  17. * Software Foundation; either version 2 of the License, or (at your option)
  18. * any later version.
  19. */
  20. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  21. #include <linux/device.h>
  22. #include <linux/hid.h>
  23. #include <linux/module.h>
  24. #include <linux/slab.h>
  25. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  26. #include <linux/power_supply.h>
  27. #endif
  28. #include "hid-ids.h"
  29. struct wacom_data {
  30. __u16 tool;
  31. unsigned char butstate;
  32. __u8 features;
  33. __u32 id;
  34. __u32 serial;
  35. unsigned char high_speed;
  36. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  37. int battery_capacity;
  38. struct power_supply battery;
  39. struct power_supply ac;
  40. #endif
  41. };
  42. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  43. /*percent of battery capacity, 0 means AC online*/
  44. static unsigned short batcap[8] = { 1, 15, 25, 35, 50, 70, 100, 0 };
  45. static enum power_supply_property wacom_battery_props[] = {
  46. POWER_SUPPLY_PROP_PRESENT,
  47. POWER_SUPPLY_PROP_CAPACITY,
  48. POWER_SUPPLY_PROP_SCOPE,
  49. };
  50. static enum power_supply_property wacom_ac_props[] = {
  51. POWER_SUPPLY_PROP_PRESENT,
  52. POWER_SUPPLY_PROP_ONLINE,
  53. POWER_SUPPLY_PROP_SCOPE,
  54. };
  55. static int wacom_battery_get_property(struct power_supply *psy,
  56. enum power_supply_property psp,
  57. union power_supply_propval *val)
  58. {
  59. struct wacom_data *wdata = container_of(psy,
  60. struct wacom_data, battery);
  61. int power_state = batcap[wdata->battery_capacity];
  62. int ret = 0;
  63. switch (psp) {
  64. case POWER_SUPPLY_PROP_PRESENT:
  65. val->intval = 1;
  66. break;
  67. case POWER_SUPPLY_PROP_SCOPE:
  68. val->intval = POWER_SUPPLY_SCOPE_DEVICE;
  69. break;
  70. case POWER_SUPPLY_PROP_CAPACITY:
  71. /* show 100% battery capacity when charging */
  72. if (power_state == 0)
  73. val->intval = 100;
  74. else
  75. val->intval = power_state;
  76. break;
  77. default:
  78. ret = -EINVAL;
  79. break;
  80. }
  81. return ret;
  82. }
  83. static int wacom_ac_get_property(struct power_supply *psy,
  84. enum power_supply_property psp,
  85. union power_supply_propval *val)
  86. {
  87. struct wacom_data *wdata = container_of(psy, struct wacom_data, ac);
  88. int power_state = batcap[wdata->battery_capacity];
  89. int ret = 0;
  90. switch (psp) {
  91. case POWER_SUPPLY_PROP_PRESENT:
  92. /* fall through */
  93. case POWER_SUPPLY_PROP_ONLINE:
  94. if (power_state == 0)
  95. val->intval = 1;
  96. else
  97. val->intval = 0;
  98. break;
  99. case POWER_SUPPLY_PROP_SCOPE:
  100. val->intval = POWER_SUPPLY_SCOPE_DEVICE;
  101. break;
  102. default:
  103. ret = -EINVAL;
  104. break;
  105. }
  106. return ret;
  107. }
  108. #endif
  109. static void wacom_set_features(struct hid_device *hdev)
  110. {
  111. int ret;
  112. __u8 rep_data[2];
  113. /*set high speed, tablet mode*/
  114. rep_data[0] = 0x03;
  115. rep_data[1] = 0x20;
  116. ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
  117. HID_FEATURE_REPORT);
  118. return;
  119. }
  120. static void wacom_poke(struct hid_device *hdev, u8 speed)
  121. {
  122. struct wacom_data *wdata = hid_get_drvdata(hdev);
  123. int limit, ret;
  124. char rep_data[2];
  125. rep_data[0] = 0x03 ; rep_data[1] = 0x00;
  126. limit = 3;
  127. do {
  128. ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
  129. HID_FEATURE_REPORT);
  130. } while (ret < 0 && limit-- > 0);
  131. if (ret >= 0) {
  132. if (speed == 0)
  133. rep_data[0] = 0x05;
  134. else
  135. rep_data[0] = 0x06;
  136. rep_data[1] = 0x00;
  137. limit = 3;
  138. do {
  139. ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
  140. HID_FEATURE_REPORT);
  141. } while (ret < 0 && limit-- > 0);
  142. if (ret >= 0) {
  143. wdata->high_speed = speed;
  144. return;
  145. }
  146. }
  147. /*
  148. * Note that if the raw queries fail, it's not a hard failure and it
  149. * is safe to continue
  150. */
  151. hid_warn(hdev, "failed to poke device, command %d, err %d\n",
  152. rep_data[0], ret);
  153. return;
  154. }
  155. static ssize_t wacom_show_speed(struct device *dev,
  156. struct device_attribute
  157. *attr, char *buf)
  158. {
  159. struct wacom_data *wdata = dev_get_drvdata(dev);
  160. return snprintf(buf, PAGE_SIZE, "%i\n", wdata->high_speed);
  161. }
  162. static ssize_t wacom_store_speed(struct device *dev,
  163. struct device_attribute *attr,
  164. const char *buf, size_t count)
  165. {
  166. struct hid_device *hdev = container_of(dev, struct hid_device, dev);
  167. int new_speed;
  168. if (sscanf(buf, "%1d", &new_speed ) != 1)
  169. return -EINVAL;
  170. if (new_speed == 0 || new_speed == 1) {
  171. wacom_poke(hdev, new_speed);
  172. return strnlen(buf, PAGE_SIZE);
  173. } else
  174. return -EINVAL;
  175. }
  176. static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP,
  177. wacom_show_speed, wacom_store_speed);
  178. static int wacom_gr_parse_report(struct hid_device *hdev,
  179. struct wacom_data *wdata,
  180. struct input_dev *input, unsigned char *data)
  181. {
  182. int tool, x, y, rw;
  183. tool = 0;
  184. /* Get X & Y positions */
  185. x = le16_to_cpu(*(__le16 *) &data[2]);
  186. y = le16_to_cpu(*(__le16 *) &data[4]);
  187. /* Get current tool identifier */
  188. if (data[1] & 0x90) { /* If pen is in the in/active area */
  189. switch ((data[1] >> 5) & 3) {
  190. case 0: /* Pen */
  191. tool = BTN_TOOL_PEN;
  192. break;
  193. case 1: /* Rubber */
  194. tool = BTN_TOOL_RUBBER;
  195. break;
  196. case 2: /* Mouse with wheel */
  197. case 3: /* Mouse without wheel */
  198. tool = BTN_TOOL_MOUSE;
  199. break;
  200. }
  201. /* Reset tool if out of active tablet area */
  202. if (!(data[1] & 0x10))
  203. tool = 0;
  204. }
  205. /* If tool changed, notify input subsystem */
  206. if (wdata->tool != tool) {
  207. if (wdata->tool) {
  208. /* Completely reset old tool state */
  209. if (wdata->tool == BTN_TOOL_MOUSE) {
  210. input_report_key(input, BTN_LEFT, 0);
  211. input_report_key(input, BTN_RIGHT, 0);
  212. input_report_key(input, BTN_MIDDLE, 0);
  213. input_report_abs(input, ABS_DISTANCE,
  214. input_abs_get_max(input, ABS_DISTANCE));
  215. } else {
  216. input_report_key(input, BTN_TOUCH, 0);
  217. input_report_key(input, BTN_STYLUS, 0);
  218. input_report_key(input, BTN_STYLUS2, 0);
  219. input_report_abs(input, ABS_PRESSURE, 0);
  220. }
  221. input_report_key(input, wdata->tool, 0);
  222. input_sync(input);
  223. }
  224. wdata->tool = tool;
  225. if (tool)
  226. input_report_key(input, tool, 1);
  227. }
  228. if (tool) {
  229. input_report_abs(input, ABS_X, x);
  230. input_report_abs(input, ABS_Y, y);
  231. switch ((data[1] >> 5) & 3) {
  232. case 2: /* Mouse with wheel */
  233. input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
  234. rw = (data[6] & 0x01) ? -1 :
  235. (data[6] & 0x02) ? 1 : 0;
  236. input_report_rel(input, REL_WHEEL, rw);
  237. /* fall through */
  238. case 3: /* Mouse without wheel */
  239. input_report_key(input, BTN_LEFT, data[1] & 0x01);
  240. input_report_key(input, BTN_RIGHT, data[1] & 0x02);
  241. /* Compute distance between mouse and tablet */
  242. rw = 44 - (data[6] >> 2);
  243. if (rw < 0)
  244. rw = 0;
  245. else if (rw > 31)
  246. rw = 31;
  247. input_report_abs(input, ABS_DISTANCE, rw);
  248. break;
  249. default:
  250. input_report_abs(input, ABS_PRESSURE,
  251. data[6] | (((__u16) (data[1] & 0x08)) << 5));
  252. input_report_key(input, BTN_TOUCH, data[1] & 0x01);
  253. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  254. input_report_key(input, BTN_STYLUS2, (tool == BTN_TOOL_PEN) && data[1] & 0x04);
  255. break;
  256. }
  257. input_sync(input);
  258. }
  259. /* Report the state of the two buttons at the top of the tablet
  260. * as two extra fingerpad keys (buttons 4 & 5). */
  261. rw = data[7] & 0x03;
  262. if (rw != wdata->butstate) {
  263. wdata->butstate = rw;
  264. input_report_key(input, BTN_0, rw & 0x02);
  265. input_report_key(input, BTN_1, rw & 0x01);
  266. input_report_key(input, BTN_TOOL_FINGER, 0xf0);
  267. input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
  268. input_sync(input);
  269. }
  270. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  271. /* Store current battery capacity */
  272. rw = (data[7] >> 2 & 0x07);
  273. if (rw != wdata->battery_capacity)
  274. wdata->battery_capacity = rw;
  275. #endif
  276. return 1;
  277. }
  278. static void wacom_i4_parse_pen_report(struct wacom_data *wdata,
  279. struct input_dev *input, unsigned char *data)
  280. {
  281. __u16 x, y, pressure;
  282. __u8 distance;
  283. switch (data[1]) {
  284. case 0x80: /* Out of proximity report */
  285. input_report_key(input, BTN_TOUCH, 0);
  286. input_report_abs(input, ABS_PRESSURE, 0);
  287. input_report_key(input, wdata->tool, 0);
  288. input_report_abs(input, ABS_MISC, 0);
  289. input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
  290. wdata->tool = 0;
  291. input_sync(input);
  292. break;
  293. case 0xC2: /* Tool report */
  294. wdata->id = ((data[2] << 4) | (data[3] >> 4) |
  295. ((data[7] & 0x0f) << 20) |
  296. ((data[8] & 0xf0) << 12));
  297. wdata->serial = ((data[3] & 0x0f) << 28) +
  298. (data[4] << 20) + (data[5] << 12) +
  299. (data[6] << 4) + (data[7] >> 4);
  300. switch (wdata->id) {
  301. case 0x100802:
  302. wdata->tool = BTN_TOOL_PEN;
  303. break;
  304. case 0x10080A:
  305. wdata->tool = BTN_TOOL_RUBBER;
  306. break;
  307. }
  308. break;
  309. default: /* Position/pressure report */
  310. x = data[2] << 9 | data[3] << 1 | ((data[9] & 0x02) >> 1);
  311. y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01);
  312. pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5)
  313. | (data[1] & 0x01);
  314. distance = (data[9] >> 2) & 0x3f;
  315. input_report_key(input, BTN_TOUCH, pressure > 1);
  316. input_report_key(input, BTN_STYLUS, data[1] & 0x02);
  317. input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
  318. input_report_key(input, wdata->tool, 1);
  319. input_report_abs(input, ABS_X, x);
  320. input_report_abs(input, ABS_Y, y);
  321. input_report_abs(input, ABS_PRESSURE, pressure);
  322. input_report_abs(input, ABS_DISTANCE, distance);
  323. input_report_abs(input, ABS_MISC, wdata->id);
  324. input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
  325. input_report_key(input, wdata->tool, 1);
  326. input_sync(input);
  327. break;
  328. }
  329. return;
  330. }
  331. static void wacom_i4_parse_report(struct hid_device *hdev,
  332. struct wacom_data *wdata,
  333. struct input_dev *input, unsigned char *data)
  334. {
  335. switch (data[0]) {
  336. case 0x00: /* Empty report */
  337. break;
  338. case 0x02: /* Pen report */
  339. wacom_i4_parse_pen_report(wdata, input, data);
  340. break;
  341. case 0x03: /* Features Report */
  342. wdata->features = data[2];
  343. break;
  344. case 0x0C: /* Button report */
  345. break;
  346. default:
  347. hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]);
  348. break;
  349. }
  350. }
  351. static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
  352. u8 *raw_data, int size)
  353. {
  354. struct wacom_data *wdata = hid_get_drvdata(hdev);
  355. struct hid_input *hidinput;
  356. struct input_dev *input;
  357. unsigned char *data = (unsigned char *) raw_data;
  358. int i;
  359. if (!(hdev->claimed & HID_CLAIMED_INPUT))
  360. return 0;
  361. hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
  362. input = hidinput->input;
  363. /* Check if this is a tablet report */
  364. if (data[0] != 0x03)
  365. return 0;
  366. switch (hdev->product) {
  367. case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
  368. return wacom_gr_parse_report(hdev, wdata, input, data);
  369. break;
  370. case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
  371. i = 1;
  372. switch (data[0]) {
  373. case 0x04:
  374. wacom_i4_parse_report(hdev, wdata, input, data + i);
  375. i += 10;
  376. /* fall through */
  377. case 0x03:
  378. wacom_i4_parse_report(hdev, wdata, input, data + i);
  379. i += 10;
  380. wacom_i4_parse_report(hdev, wdata, input, data + i);
  381. break;
  382. default:
  383. hid_err(hdev, "Unknown report: %d,%d size:%d\n",
  384. data[0], data[1], size);
  385. return 0;
  386. }
  387. }
  388. return 1;
  389. }
  390. static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
  391. struct hid_field *field, struct hid_usage *usage, unsigned long **bit,
  392. int *max)
  393. {
  394. struct input_dev *input = hi->input;
  395. __set_bit(INPUT_PROP_POINTER, input->propbit);
  396. /* Basics */
  397. input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
  398. __set_bit(REL_WHEEL, input->relbit);
  399. __set_bit(BTN_TOOL_PEN, input->keybit);
  400. __set_bit(BTN_TOUCH, input->keybit);
  401. __set_bit(BTN_STYLUS, input->keybit);
  402. __set_bit(BTN_STYLUS2, input->keybit);
  403. __set_bit(BTN_LEFT, input->keybit);
  404. __set_bit(BTN_RIGHT, input->keybit);
  405. __set_bit(BTN_MIDDLE, input->keybit);
  406. /* Pad */
  407. input->evbit[0] |= BIT(EV_MSC);
  408. __set_bit(MSC_SERIAL, input->mscbit);
  409. __set_bit(BTN_0, input->keybit);
  410. __set_bit(BTN_1, input->keybit);
  411. __set_bit(BTN_TOOL_FINGER, input->keybit);
  412. /* Distance, rubber and mouse */
  413. __set_bit(BTN_TOOL_RUBBER, input->keybit);
  414. __set_bit(BTN_TOOL_MOUSE, input->keybit);
  415. switch (hdev->product) {
  416. case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
  417. input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
  418. input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
  419. input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
  420. input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
  421. break;
  422. case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
  423. __set_bit(ABS_MISC, input->absbit);
  424. input_set_abs_params(input, ABS_X, 0, 40640, 4, 0);
  425. input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0);
  426. input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0);
  427. input_set_abs_params(input, ABS_DISTANCE, 0, 63, 0, 0);
  428. break;
  429. }
  430. return 0;
  431. }
  432. static int wacom_probe(struct hid_device *hdev,
  433. const struct hid_device_id *id)
  434. {
  435. struct wacom_data *wdata;
  436. int ret;
  437. wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
  438. if (wdata == NULL) {
  439. hid_err(hdev, "can't alloc wacom descriptor\n");
  440. return -ENOMEM;
  441. }
  442. hid_set_drvdata(hdev, wdata);
  443. /* Parse the HID report now */
  444. ret = hid_parse(hdev);
  445. if (ret) {
  446. hid_err(hdev, "parse failed\n");
  447. goto err_free;
  448. }
  449. ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
  450. if (ret) {
  451. hid_err(hdev, "hw start failed\n");
  452. goto err_free;
  453. }
  454. ret = device_create_file(&hdev->dev, &dev_attr_speed);
  455. if (ret)
  456. hid_warn(hdev,
  457. "can't create sysfs speed attribute err: %d\n", ret);
  458. switch (hdev->product) {
  459. case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
  460. /* Set Wacom mode 2 with high reporting speed */
  461. wacom_poke(hdev, 1);
  462. break;
  463. case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
  464. wdata->features = 0;
  465. wacom_set_features(hdev);
  466. break;
  467. }
  468. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  469. wdata->battery.properties = wacom_battery_props;
  470. wdata->battery.num_properties = ARRAY_SIZE(wacom_battery_props);
  471. wdata->battery.get_property = wacom_battery_get_property;
  472. wdata->battery.name = "wacom_battery";
  473. wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY;
  474. wdata->battery.use_for_apm = 0;
  475. ret = power_supply_register(&hdev->dev, &wdata->battery);
  476. if (ret) {
  477. hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n",
  478. ret);
  479. goto err_battery;
  480. }
  481. power_supply_powers(&wdata->battery, &hdev->dev);
  482. wdata->ac.properties = wacom_ac_props;
  483. wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props);
  484. wdata->ac.get_property = wacom_ac_get_property;
  485. wdata->ac.name = "wacom_ac";
  486. wdata->ac.type = POWER_SUPPLY_TYPE_MAINS;
  487. wdata->ac.use_for_apm = 0;
  488. ret = power_supply_register(&hdev->dev, &wdata->ac);
  489. if (ret) {
  490. hid_warn(hdev,
  491. "can't create ac battery attribute, err: %d\n", ret);
  492. goto err_ac;
  493. }
  494. power_supply_powers(&wdata->ac, &hdev->dev);
  495. #endif
  496. return 0;
  497. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  498. err_ac:
  499. power_supply_unregister(&wdata->battery);
  500. err_battery:
  501. device_remove_file(&hdev->dev, &dev_attr_speed);
  502. hid_hw_stop(hdev);
  503. #endif
  504. err_free:
  505. kfree(wdata);
  506. return ret;
  507. }
  508. static void wacom_remove(struct hid_device *hdev)
  509. {
  510. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  511. struct wacom_data *wdata = hid_get_drvdata(hdev);
  512. #endif
  513. device_remove_file(&hdev->dev, &dev_attr_speed);
  514. hid_hw_stop(hdev);
  515. #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
  516. power_supply_unregister(&wdata->battery);
  517. power_supply_unregister(&wdata->ac);
  518. #endif
  519. kfree(hid_get_drvdata(hdev));
  520. }
  521. static const struct hid_device_id wacom_devices[] = {
  522. { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
  523. { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
  524. { }
  525. };
  526. MODULE_DEVICE_TABLE(hid, wacom_devices);
  527. static struct hid_driver wacom_driver = {
  528. .name = "wacom",
  529. .id_table = wacom_devices,
  530. .probe = wacom_probe,
  531. .remove = wacom_remove,
  532. .raw_event = wacom_raw_event,
  533. .input_mapped = wacom_input_mapped,
  534. };
  535. static int __init wacom_init(void)
  536. {
  537. int ret;
  538. ret = hid_register_driver(&wacom_driver);
  539. if (ret)
  540. pr_err("can't register wacom driver\n");
  541. return ret;
  542. }
  543. static void __exit wacom_exit(void)
  544. {
  545. hid_unregister_driver(&wacom_driver);
  546. }
  547. module_init(wacom_init);
  548. module_exit(wacom_exit);
  549. MODULE_LICENSE("GPL");