wacom_serial4.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Wacom protocol 4 serial tablet driver
  4. *
  5. * Copyright 2014 Hans de Goede <[email protected]>
  6. * Copyright 2011-2012 Julian Squires <[email protected]>
  7. *
  8. * Many thanks to Bill Seremetis, without whom PenPartner support
  9. * would not have been possible. Thanks to Patrick Mahoney.
  10. *
  11. * This driver was developed with reference to much code written by others,
  12. * particularly:
  13. * - elo, gunze drivers by Vojtech Pavlik <[email protected]>;
  14. * - wacom_w8001 driver by Jaya Kumar <[email protected]>;
  15. * - the USB wacom input driver, credited to many people
  16. * (see drivers/input/tablet/wacom.h);
  17. * - new and old versions of linuxwacom / xf86-input-wacom credited to
  18. * Frederic Lepied, France. <[email protected]> and
  19. * Ping Cheng, Wacom. <[email protected]>;
  20. * - and xf86wacom.c (a presumably ancient version of the linuxwacom code),
  21. * by Frederic Lepied and Raph Levien <[email protected]>.
  22. *
  23. * To do:
  24. * - support pad buttons; (requires access to a model with pad buttons)
  25. * - support (protocol 4-style) tilt (requires access to a > 1.4 rom model)
  26. */
  27. /*
  28. * Wacom serial protocol 4 documentation taken from linuxwacom-0.9.9 code,
  29. * protocol 4 uses 7 or 9 byte of data in the following format:
  30. *
  31. * Byte 1
  32. * bit 7 Sync bit always 1
  33. * bit 6 Pointing device detected
  34. * bit 5 Cursor = 0 / Stylus = 1
  35. * bit 4 Reserved
  36. * bit 3 1 if a button on the pointing device has been pressed
  37. * bit 2 P0 (optional)
  38. * bit 1 X15
  39. * bit 0 X14
  40. *
  41. * Byte 2
  42. * bit 7 Always 0
  43. * bits 6-0 = X13 - X7
  44. *
  45. * Byte 3
  46. * bit 7 Always 0
  47. * bits 6-0 = X6 - X0
  48. *
  49. * Byte 4
  50. * bit 7 Always 0
  51. * bit 6 B3
  52. * bit 5 B2
  53. * bit 4 B1
  54. * bit 3 B0
  55. * bit 2 P1 (optional)
  56. * bit 1 Y15
  57. * bit 0 Y14
  58. *
  59. * Byte 5
  60. * bit 7 Always 0
  61. * bits 6-0 = Y13 - Y7
  62. *
  63. * Byte 6
  64. * bit 7 Always 0
  65. * bits 6-0 = Y6 - Y0
  66. *
  67. * Byte 7
  68. * bit 7 Always 0
  69. * bit 6 Sign of pressure data; or wheel-rel for cursor tool
  70. * bit 5 P7; or REL1 for cursor tool
  71. * bit 4 P6; or REL0 for cursor tool
  72. * bit 3 P5
  73. * bit 2 P4
  74. * bit 1 P3
  75. * bit 0 P2
  76. *
  77. * byte 8 and 9 are optional and present only
  78. * in tilt mode.
  79. *
  80. * Byte 8
  81. * bit 7 Always 0
  82. * bit 6 Sign of tilt X
  83. * bit 5 Xt6
  84. * bit 4 Xt5
  85. * bit 3 Xt4
  86. * bit 2 Xt3
  87. * bit 1 Xt2
  88. * bit 0 Xt1
  89. *
  90. * Byte 9
  91. * bit 7 Always 0
  92. * bit 6 Sign of tilt Y
  93. * bit 5 Yt6
  94. * bit 4 Yt5
  95. * bit 3 Yt4
  96. * bit 2 Yt3
  97. * bit 1 Yt2
  98. * bit 0 Yt1
  99. */
  100. #include <linux/completion.h>
  101. #include <linux/init.h>
  102. #include <linux/input.h>
  103. #include <linux/interrupt.h>
  104. #include <linux/kernel.h>
  105. #include <linux/module.h>
  106. #include <linux/serio.h>
  107. #include <linux/slab.h>
  108. #include <linux/string.h>
  109. MODULE_AUTHOR("Julian Squires <[email protected]>, Hans de Goede <[email protected]>");
  110. MODULE_DESCRIPTION("Wacom protocol 4 serial tablet driver");
  111. MODULE_LICENSE("GPL");
  112. #define REQUEST_MODEL_AND_ROM_VERSION "~#"
  113. #define REQUEST_MAX_COORDINATES "~C\r"
  114. #define REQUEST_CONFIGURATION_STRING "~R\r"
  115. #define REQUEST_RESET_TO_PROTOCOL_IV "\r#"
  116. /*
  117. * Note: sending "\r$\r" causes at least the Digitizer II to send
  118. * packets in ASCII instead of binary. "\r#" seems to undo that.
  119. */
  120. #define COMMAND_START_SENDING_PACKETS "ST\r"
  121. #define COMMAND_STOP_SENDING_PACKETS "SP\r"
  122. #define COMMAND_MULTI_MODE_INPUT "MU1\r"
  123. #define COMMAND_ORIGIN_IN_UPPER_LEFT "OC1\r"
  124. #define COMMAND_ENABLE_ALL_MACRO_BUTTONS "~M0\r"
  125. #define COMMAND_DISABLE_GROUP_1_MACRO_BUTTONS "~M1\r"
  126. #define COMMAND_TRANSMIT_AT_MAX_RATE "IT0\r"
  127. #define COMMAND_DISABLE_INCREMENTAL_MODE "IN0\r"
  128. #define COMMAND_ENABLE_CONTINUOUS_MODE "SR\r"
  129. #define COMMAND_ENABLE_PRESSURE_MODE "PH1\r"
  130. #define COMMAND_Z_FILTER "ZF1\r"
  131. /* Note that this is a protocol 4 packet without tilt information. */
  132. #define PACKET_LENGTH 7
  133. #define DATA_SIZE 32
  134. /* flags */
  135. #define F_COVERS_SCREEN 0x01
  136. #define F_HAS_STYLUS2 0x02
  137. #define F_HAS_SCROLLWHEEL 0x04
  138. /* device IDs */
  139. #define STYLUS_DEVICE_ID 0x02
  140. #define CURSOR_DEVICE_ID 0x06
  141. #define ERASER_DEVICE_ID 0x0A
  142. enum { STYLUS = 1, ERASER, CURSOR };
  143. static const struct {
  144. int device_id;
  145. int input_id;
  146. } tools[] = {
  147. { 0, 0 },
  148. { STYLUS_DEVICE_ID, BTN_TOOL_PEN },
  149. { ERASER_DEVICE_ID, BTN_TOOL_RUBBER },
  150. { CURSOR_DEVICE_ID, BTN_TOOL_MOUSE },
  151. };
  152. struct wacom {
  153. struct input_dev *dev;
  154. struct completion cmd_done;
  155. int result;
  156. u8 expect;
  157. u8 eraser_mask;
  158. unsigned int extra_z_bits;
  159. unsigned int flags;
  160. unsigned int res_x, res_y;
  161. unsigned int max_x, max_y;
  162. unsigned int tool;
  163. unsigned int idx;
  164. u8 data[DATA_SIZE];
  165. char phys[32];
  166. };
  167. enum {
  168. MODEL_CINTIQ = 0x504C, /* PL */
  169. MODEL_CINTIQ2 = 0x4454, /* DT */
  170. MODEL_DIGITIZER_II = 0x5544, /* UD */
  171. MODEL_GRAPHIRE = 0x4554, /* ET */
  172. MODEL_PENPARTNER = 0x4354, /* CT */
  173. MODEL_ARTPAD_II = 0x4B54, /* KT */
  174. };
  175. static void wacom_handle_model_response(struct wacom *wacom)
  176. {
  177. int major_v, minor_v, r = 0;
  178. char *p;
  179. p = strrchr(wacom->data, 'V');
  180. if (p)
  181. r = sscanf(p + 1, "%u.%u", &major_v, &minor_v);
  182. if (r != 2)
  183. major_v = minor_v = 0;
  184. switch (wacom->data[2] << 8 | wacom->data[3]) {
  185. case MODEL_CINTIQ: /* UNTESTED */
  186. case MODEL_CINTIQ2:
  187. if ((wacom->data[2] << 8 | wacom->data[3]) == MODEL_CINTIQ) {
  188. wacom->dev->name = "Wacom Cintiq";
  189. wacom->dev->id.version = MODEL_CINTIQ;
  190. } else {
  191. wacom->dev->name = "Wacom Cintiq II";
  192. wacom->dev->id.version = MODEL_CINTIQ2;
  193. }
  194. wacom->res_x = 508;
  195. wacom->res_y = 508;
  196. switch (wacom->data[5] << 8 | wacom->data[6]) {
  197. case 0x3731: /* PL-710 */
  198. wacom->res_x = 2540;
  199. wacom->res_y = 2540;
  200. fallthrough;
  201. case 0x3535: /* PL-550 */
  202. case 0x3830: /* PL-800 */
  203. wacom->extra_z_bits = 2;
  204. }
  205. wacom->flags = F_COVERS_SCREEN;
  206. break;
  207. case MODEL_PENPARTNER:
  208. wacom->dev->name = "Wacom Penpartner";
  209. wacom->dev->id.version = MODEL_PENPARTNER;
  210. wacom->res_x = 1000;
  211. wacom->res_y = 1000;
  212. break;
  213. case MODEL_GRAPHIRE:
  214. wacom->dev->name = "Wacom Graphire";
  215. wacom->dev->id.version = MODEL_GRAPHIRE;
  216. wacom->res_x = 1016;
  217. wacom->res_y = 1016;
  218. wacom->max_x = 5103;
  219. wacom->max_y = 3711;
  220. wacom->extra_z_bits = 2;
  221. wacom->eraser_mask = 0x08;
  222. wacom->flags = F_HAS_STYLUS2 | F_HAS_SCROLLWHEEL;
  223. break;
  224. case MODEL_ARTPAD_II:
  225. case MODEL_DIGITIZER_II:
  226. wacom->dev->name = "Wacom Digitizer II";
  227. wacom->dev->id.version = MODEL_DIGITIZER_II;
  228. if (major_v == 1 && minor_v <= 2)
  229. wacom->extra_z_bits = 0; /* UNTESTED */
  230. break;
  231. default:
  232. dev_err(&wacom->dev->dev, "Unsupported Wacom model %s\n",
  233. wacom->data);
  234. wacom->result = -ENODEV;
  235. return;
  236. }
  237. dev_info(&wacom->dev->dev, "%s tablet, version %u.%u\n",
  238. wacom->dev->name, major_v, minor_v);
  239. }
  240. static void wacom_handle_configuration_response(struct wacom *wacom)
  241. {
  242. int r, skip;
  243. dev_dbg(&wacom->dev->dev, "Configuration string: %s\n", wacom->data);
  244. r = sscanf(wacom->data, "~R%x,%u,%u,%u,%u", &skip, &skip, &skip,
  245. &wacom->res_x, &wacom->res_y);
  246. if (r != 5)
  247. dev_warn(&wacom->dev->dev, "could not get resolution\n");
  248. }
  249. static void wacom_handle_coordinates_response(struct wacom *wacom)
  250. {
  251. int r;
  252. dev_dbg(&wacom->dev->dev, "Coordinates string: %s\n", wacom->data);
  253. r = sscanf(wacom->data, "~C%u,%u", &wacom->max_x, &wacom->max_y);
  254. if (r != 2)
  255. dev_warn(&wacom->dev->dev, "could not get max coordinates\n");
  256. }
  257. static void wacom_handle_response(struct wacom *wacom)
  258. {
  259. if (wacom->data[0] != '~' || wacom->data[1] != wacom->expect) {
  260. dev_err(&wacom->dev->dev,
  261. "Wacom got an unexpected response: %s\n", wacom->data);
  262. wacom->result = -EIO;
  263. } else {
  264. wacom->result = 0;
  265. switch (wacom->data[1]) {
  266. case '#':
  267. wacom_handle_model_response(wacom);
  268. break;
  269. case 'R':
  270. wacom_handle_configuration_response(wacom);
  271. break;
  272. case 'C':
  273. wacom_handle_coordinates_response(wacom);
  274. break;
  275. }
  276. }
  277. complete(&wacom->cmd_done);
  278. }
  279. static void wacom_handle_packet(struct wacom *wacom)
  280. {
  281. u8 in_proximity_p, stylus_p, button;
  282. unsigned int tool;
  283. int x, y, z;
  284. in_proximity_p = wacom->data[0] & 0x40;
  285. stylus_p = wacom->data[0] & 0x20;
  286. button = (wacom->data[3] & 0x78) >> 3;
  287. x = (wacom->data[0] & 3) << 14 | wacom->data[1]<<7 | wacom->data[2];
  288. y = (wacom->data[3] & 3) << 14 | wacom->data[4]<<7 | wacom->data[5];
  289. if (in_proximity_p && stylus_p) {
  290. z = wacom->data[6] & 0x7f;
  291. if (wacom->extra_z_bits >= 1)
  292. z = z << 1 | (wacom->data[3] & 0x4) >> 2;
  293. if (wacom->extra_z_bits > 1)
  294. z = z << 1 | (wacom->data[0] & 0x4) >> 2;
  295. z = z ^ (0x40 << wacom->extra_z_bits);
  296. } else {
  297. z = -1;
  298. }
  299. if (stylus_p)
  300. tool = (button & wacom->eraser_mask) ? ERASER : STYLUS;
  301. else
  302. tool = CURSOR;
  303. if (tool != wacom->tool && wacom->tool != 0) {
  304. input_report_key(wacom->dev, tools[wacom->tool].input_id, 0);
  305. input_sync(wacom->dev);
  306. }
  307. wacom->tool = tool;
  308. input_report_key(wacom->dev, tools[tool].input_id, in_proximity_p);
  309. input_report_abs(wacom->dev, ABS_MISC,
  310. in_proximity_p ? tools[tool].device_id : 0);
  311. input_report_abs(wacom->dev, ABS_X, x);
  312. input_report_abs(wacom->dev, ABS_Y, y);
  313. input_report_abs(wacom->dev, ABS_PRESSURE, z);
  314. if (stylus_p) {
  315. input_report_key(wacom->dev, BTN_TOUCH, button & 1);
  316. input_report_key(wacom->dev, BTN_STYLUS, button & 2);
  317. input_report_key(wacom->dev, BTN_STYLUS2, button & 4);
  318. } else {
  319. input_report_key(wacom->dev, BTN_LEFT, button & 1);
  320. input_report_key(wacom->dev, BTN_RIGHT, button & 2);
  321. input_report_key(wacom->dev, BTN_MIDDLE, button & 4);
  322. /* handle relative wheel for non-stylus device */
  323. z = (wacom->data[6] & 0x30) >> 4;
  324. if (wacom->data[6] & 0x40)
  325. z = -z;
  326. input_report_rel(wacom->dev, REL_WHEEL, z);
  327. }
  328. input_sync(wacom->dev);
  329. }
  330. static void wacom_clear_data_buf(struct wacom *wacom)
  331. {
  332. memset(wacom->data, 0, DATA_SIZE);
  333. wacom->idx = 0;
  334. }
  335. static irqreturn_t wacom_interrupt(struct serio *serio, unsigned char data,
  336. unsigned int flags)
  337. {
  338. struct wacom *wacom = serio_get_drvdata(serio);
  339. if (data & 0x80)
  340. wacom->idx = 0;
  341. /*
  342. * We're either expecting a carriage return-terminated ASCII
  343. * response string, or a seven-byte packet with the MSB set on
  344. * the first byte.
  345. *
  346. * Note however that some tablets (the PenPartner, for
  347. * example) don't send a carriage return at the end of a
  348. * command. We handle these by waiting for timeout.
  349. */
  350. if (data == '\r' && !(wacom->data[0] & 0x80)) {
  351. wacom_handle_response(wacom);
  352. wacom_clear_data_buf(wacom);
  353. return IRQ_HANDLED;
  354. }
  355. /* Leave place for 0 termination */
  356. if (wacom->idx > (DATA_SIZE - 2)) {
  357. dev_dbg(&wacom->dev->dev,
  358. "throwing away %d bytes of garbage\n", wacom->idx);
  359. wacom_clear_data_buf(wacom);
  360. }
  361. wacom->data[wacom->idx++] = data;
  362. if (wacom->idx == PACKET_LENGTH && (wacom->data[0] & 0x80)) {
  363. wacom_handle_packet(wacom);
  364. wacom_clear_data_buf(wacom);
  365. }
  366. return IRQ_HANDLED;
  367. }
  368. static void wacom_disconnect(struct serio *serio)
  369. {
  370. struct wacom *wacom = serio_get_drvdata(serio);
  371. serio_close(serio);
  372. serio_set_drvdata(serio, NULL);
  373. input_unregister_device(wacom->dev);
  374. kfree(wacom);
  375. }
  376. static int wacom_send(struct serio *serio, const u8 *command)
  377. {
  378. int err = 0;
  379. for (; !err && *command; command++)
  380. err = serio_write(serio, *command);
  381. return err;
  382. }
  383. static int wacom_send_setup_string(struct wacom *wacom, struct serio *serio)
  384. {
  385. const u8 *cmd;
  386. switch (wacom->dev->id.version) {
  387. case MODEL_CINTIQ: /* UNTESTED */
  388. cmd = COMMAND_ORIGIN_IN_UPPER_LEFT
  389. COMMAND_TRANSMIT_AT_MAX_RATE
  390. COMMAND_ENABLE_CONTINUOUS_MODE
  391. COMMAND_START_SENDING_PACKETS;
  392. break;
  393. case MODEL_PENPARTNER:
  394. cmd = COMMAND_ENABLE_PRESSURE_MODE
  395. COMMAND_START_SENDING_PACKETS;
  396. break;
  397. default:
  398. cmd = COMMAND_MULTI_MODE_INPUT
  399. COMMAND_ORIGIN_IN_UPPER_LEFT
  400. COMMAND_ENABLE_ALL_MACRO_BUTTONS
  401. COMMAND_DISABLE_GROUP_1_MACRO_BUTTONS
  402. COMMAND_TRANSMIT_AT_MAX_RATE
  403. COMMAND_DISABLE_INCREMENTAL_MODE
  404. COMMAND_ENABLE_CONTINUOUS_MODE
  405. COMMAND_Z_FILTER
  406. COMMAND_START_SENDING_PACKETS;
  407. break;
  408. }
  409. return wacom_send(serio, cmd);
  410. }
  411. static int wacom_send_and_wait(struct wacom *wacom, struct serio *serio,
  412. const u8 *cmd, const char *desc)
  413. {
  414. int err;
  415. unsigned long u;
  416. wacom->expect = cmd[1];
  417. init_completion(&wacom->cmd_done);
  418. err = wacom_send(serio, cmd);
  419. if (err)
  420. return err;
  421. u = wait_for_completion_timeout(&wacom->cmd_done, HZ);
  422. if (u == 0) {
  423. /* Timeout, process what we've received. */
  424. wacom_handle_response(wacom);
  425. }
  426. wacom->expect = 0;
  427. return wacom->result;
  428. }
  429. static int wacom_setup(struct wacom *wacom, struct serio *serio)
  430. {
  431. int err;
  432. /* Note that setting the link speed is the job of inputattach.
  433. * We assume that reset negotiation has already happened,
  434. * here. */
  435. err = wacom_send_and_wait(wacom, serio, REQUEST_MODEL_AND_ROM_VERSION,
  436. "model and version");
  437. if (err)
  438. return err;
  439. if (!(wacom->res_x && wacom->res_y)) {
  440. err = wacom_send_and_wait(wacom, serio,
  441. REQUEST_CONFIGURATION_STRING,
  442. "configuration string");
  443. if (err)
  444. return err;
  445. }
  446. if (!(wacom->max_x && wacom->max_y)) {
  447. err = wacom_send_and_wait(wacom, serio,
  448. REQUEST_MAX_COORDINATES,
  449. "coordinates string");
  450. if (err)
  451. return err;
  452. }
  453. return wacom_send_setup_string(wacom, serio);
  454. }
  455. static int wacom_connect(struct serio *serio, struct serio_driver *drv)
  456. {
  457. struct wacom *wacom;
  458. struct input_dev *input_dev;
  459. int err = -ENOMEM;
  460. wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
  461. input_dev = input_allocate_device();
  462. if (!wacom || !input_dev)
  463. goto free_device;
  464. wacom->dev = input_dev;
  465. wacom->extra_z_bits = 1;
  466. wacom->eraser_mask = 0x04;
  467. wacom->tool = wacom->idx = 0;
  468. snprintf(wacom->phys, sizeof(wacom->phys), "%s/input0", serio->phys);
  469. input_dev->phys = wacom->phys;
  470. input_dev->id.bustype = BUS_RS232;
  471. input_dev->id.vendor = SERIO_WACOM_IV;
  472. input_dev->id.product = serio->id.extra;
  473. input_dev->dev.parent = &serio->dev;
  474. input_dev->evbit[0] =
  475. BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) | BIT_MASK(EV_REL);
  476. set_bit(ABS_MISC, input_dev->absbit);
  477. set_bit(BTN_TOOL_PEN, input_dev->keybit);
  478. set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
  479. set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
  480. set_bit(BTN_TOUCH, input_dev->keybit);
  481. set_bit(BTN_STYLUS, input_dev->keybit);
  482. set_bit(BTN_LEFT, input_dev->keybit);
  483. set_bit(BTN_RIGHT, input_dev->keybit);
  484. set_bit(BTN_MIDDLE, input_dev->keybit);
  485. serio_set_drvdata(serio, wacom);
  486. err = serio_open(serio, drv);
  487. if (err)
  488. goto free_device;
  489. err = wacom_setup(wacom, serio);
  490. if (err)
  491. goto close_serio;
  492. set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
  493. if (!(wacom->flags & F_COVERS_SCREEN))
  494. __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
  495. if (wacom->flags & F_HAS_STYLUS2)
  496. __set_bit(BTN_STYLUS2, input_dev->keybit);
  497. if (wacom->flags & F_HAS_SCROLLWHEEL)
  498. __set_bit(REL_WHEEL, input_dev->relbit);
  499. input_abs_set_res(wacom->dev, ABS_X, wacom->res_x);
  500. input_abs_set_res(wacom->dev, ABS_Y, wacom->res_y);
  501. input_set_abs_params(wacom->dev, ABS_X, 0, wacom->max_x, 0, 0);
  502. input_set_abs_params(wacom->dev, ABS_Y, 0, wacom->max_y, 0, 0);
  503. input_set_abs_params(wacom->dev, ABS_PRESSURE, -1,
  504. (1 << (7 + wacom->extra_z_bits)) - 1, 0, 0);
  505. err = input_register_device(wacom->dev);
  506. if (err)
  507. goto close_serio;
  508. return 0;
  509. close_serio:
  510. serio_close(serio);
  511. free_device:
  512. serio_set_drvdata(serio, NULL);
  513. input_free_device(input_dev);
  514. kfree(wacom);
  515. return err;
  516. }
  517. static const struct serio_device_id wacom_serio_ids[] = {
  518. {
  519. .type = SERIO_RS232,
  520. .proto = SERIO_WACOM_IV,
  521. .id = SERIO_ANY,
  522. .extra = SERIO_ANY,
  523. },
  524. { 0 }
  525. };
  526. MODULE_DEVICE_TABLE(serio, wacom_serio_ids);
  527. static struct serio_driver wacom_drv = {
  528. .driver = {
  529. .name = "wacom_serial4",
  530. },
  531. .description = "Wacom protocol 4 serial tablet driver",
  532. .id_table = wacom_serio_ids,
  533. .interrupt = wacom_interrupt,
  534. .connect = wacom_connect,
  535. .disconnect = wacom_disconnect,
  536. };
  537. module_serio_driver(wacom_drv);