hid-multitouch.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /*
  2. * HID driver for multitouch panels
  3. *
  4. * Copyright (c) 2010-2011 Stephane Chatty <chatty@enac.fr>
  5. * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com>
  6. * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
  7. *
  8. * This code is partly based on hid-egalax.c:
  9. *
  10. * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr>
  11. * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
  12. * Copyright (c) 2010 Canonical, Ltd.
  13. *
  14. */
  15. /*
  16. * This program is free software; you can redistribute it and/or modify it
  17. * under the terms of the GNU General Public License as published by the Free
  18. * Software Foundation; either version 2 of the License, or (at your option)
  19. * any later version.
  20. */
  21. #include <linux/device.h>
  22. #include <linux/hid.h>
  23. #include <linux/module.h>
  24. #include <linux/slab.h>
  25. #include <linux/usb.h>
  26. #include <linux/input/mt.h>
  27. #include "usbhid/usbhid.h"
  28. MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
  29. MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
  30. MODULE_DESCRIPTION("HID multitouch panels");
  31. MODULE_LICENSE("GPL");
  32. #include "hid-ids.h"
  33. /* quirks to control the device */
  34. #define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
  35. #define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
  36. #define MT_QUIRK_CYPRESS (1 << 2)
  37. #define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
  38. #define MT_QUIRK_VALID_IS_INRANGE (1 << 4)
  39. #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
  40. #define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6)
  41. struct mt_slot {
  42. __s32 x, y, p, w, h;
  43. __s32 contactid; /* the device ContactID assigned to this slot */
  44. bool touch_state; /* is the touch valid? */
  45. bool seen_in_this_frame;/* has this slot been updated */
  46. };
  47. struct mt_device {
  48. struct mt_slot curdata; /* placeholder of incoming data */
  49. struct mt_class *mtclass; /* our mt device class */
  50. unsigned last_field_index; /* last field index of the report */
  51. unsigned last_slot_field; /* the last field of a slot */
  52. __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
  53. __u8 num_received; /* how many contacts we received */
  54. __u8 num_expected; /* expected last contact index */
  55. __u8 maxcontacts;
  56. bool curvalid; /* is the current contact valid? */
  57. struct mt_slot *slots;
  58. };
  59. struct mt_class {
  60. __s32 name; /* MT_CLS */
  61. __s32 quirks;
  62. __s32 sn_move; /* Signal/noise ratio for move events */
  63. __s32 sn_pressure; /* Signal/noise ratio for pressure events */
  64. __u8 maxcontacts;
  65. };
  66. /* classes of device behavior */
  67. #define MT_CLS_DEFAULT 1
  68. #define MT_CLS_DUAL_INRANGE_CONTACTID 2
  69. #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3
  70. #define MT_CLS_CYPRESS 4
  71. #define MT_CLS_EGALAX 5
  72. #define MT_CLS_STANTUM 6
  73. #define MT_DEFAULT_MAXCONTACT 10
  74. /*
  75. * these device-dependent functions determine what slot corresponds
  76. * to a valid contact that was just read.
  77. */
  78. static int cypress_compute_slot(struct mt_device *td)
  79. {
  80. if (td->curdata.contactid != 0 || td->num_received == 0)
  81. return td->curdata.contactid;
  82. else
  83. return -1;
  84. }
  85. static int find_slot_from_contactid(struct mt_device *td)
  86. {
  87. int i;
  88. for (i = 0; i < td->maxcontacts; ++i) {
  89. if (td->slots[i].contactid == td->curdata.contactid &&
  90. td->slots[i].touch_state)
  91. return i;
  92. }
  93. for (i = 0; i < td->maxcontacts; ++i) {
  94. if (!td->slots[i].seen_in_this_frame &&
  95. !td->slots[i].touch_state)
  96. return i;
  97. }
  98. /* should not occurs. If this happens that means
  99. * that the device sent more touches that it says
  100. * in the report descriptor. It is ignored then. */
  101. return -1;
  102. }
  103. struct mt_class mt_classes[] = {
  104. { .name = MT_CLS_DEFAULT,
  105. .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
  106. { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
  107. .quirks = MT_QUIRK_VALID_IS_INRANGE |
  108. MT_QUIRK_SLOT_IS_CONTACTID,
  109. .maxcontacts = 2 },
  110. { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
  111. .quirks = MT_QUIRK_VALID_IS_INRANGE |
  112. MT_QUIRK_SLOT_IS_CONTACTNUMBER,
  113. .maxcontacts = 2 },
  114. { .name = MT_CLS_CYPRESS,
  115. .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
  116. MT_QUIRK_CYPRESS,
  117. .maxcontacts = 10 },
  118. { .name = MT_CLS_EGALAX,
  119. .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
  120. MT_QUIRK_VALID_IS_INRANGE |
  121. MT_QUIRK_EGALAX_XYZ_FIXUP,
  122. .maxcontacts = 2,
  123. .sn_move = 4096,
  124. .sn_pressure = 32,
  125. },
  126. { .name = MT_CLS_STANTUM,
  127. .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
  128. { }
  129. };
  130. static void mt_feature_mapping(struct hid_device *hdev,
  131. struct hid_field *field, struct hid_usage *usage)
  132. {
  133. struct mt_device *td = hid_get_drvdata(hdev);
  134. switch (usage->hid) {
  135. case HID_DG_INPUTMODE:
  136. td->inputmode = field->report->id;
  137. break;
  138. case HID_DG_CONTACTMAX:
  139. td->maxcontacts = field->value[0];
  140. if (td->mtclass->maxcontacts)
  141. /* check if the maxcontacts is given by the class */
  142. td->maxcontacts = td->mtclass->maxcontacts;
  143. break;
  144. }
  145. }
  146. static void set_abs(struct input_dev *input, unsigned int code,
  147. struct hid_field *field, int snratio)
  148. {
  149. int fmin = field->logical_minimum;
  150. int fmax = field->logical_maximum;
  151. int fuzz = snratio ? (fmax - fmin) / snratio : 0;
  152. input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
  153. }
  154. static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
  155. struct hid_field *field, struct hid_usage *usage,
  156. unsigned long **bit, int *max)
  157. {
  158. struct mt_device *td = hid_get_drvdata(hdev);
  159. struct mt_class *cls = td->mtclass;
  160. __s32 quirks = cls->quirks;
  161. switch (usage->hid & HID_USAGE_PAGE) {
  162. case HID_UP_GENDESK:
  163. switch (usage->hid) {
  164. case HID_GD_X:
  165. if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
  166. field->logical_maximum = 32760;
  167. hid_map_usage(hi, usage, bit, max,
  168. EV_ABS, ABS_MT_POSITION_X);
  169. set_abs(hi->input, ABS_MT_POSITION_X, field,
  170. cls->sn_move);
  171. /* touchscreen emulation */
  172. set_abs(hi->input, ABS_X, field, cls->sn_move);
  173. td->last_slot_field = usage->hid;
  174. return 1;
  175. case HID_GD_Y:
  176. if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
  177. field->logical_maximum = 32760;
  178. hid_map_usage(hi, usage, bit, max,
  179. EV_ABS, ABS_MT_POSITION_Y);
  180. set_abs(hi->input, ABS_MT_POSITION_Y, field,
  181. cls->sn_move);
  182. /* touchscreen emulation */
  183. set_abs(hi->input, ABS_Y, field, cls->sn_move);
  184. td->last_slot_field = usage->hid;
  185. return 1;
  186. }
  187. return 0;
  188. case HID_UP_DIGITIZER:
  189. switch (usage->hid) {
  190. case HID_DG_INRANGE:
  191. td->last_slot_field = usage->hid;
  192. return 1;
  193. case HID_DG_CONFIDENCE:
  194. td->last_slot_field = usage->hid;
  195. return 1;
  196. case HID_DG_TIPSWITCH:
  197. hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
  198. input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
  199. td->last_slot_field = usage->hid;
  200. return 1;
  201. case HID_DG_CONTACTID:
  202. input_mt_init_slots(hi->input, td->maxcontacts);
  203. td->last_slot_field = usage->hid;
  204. return 1;
  205. case HID_DG_WIDTH:
  206. hid_map_usage(hi, usage, bit, max,
  207. EV_ABS, ABS_MT_TOUCH_MAJOR);
  208. td->last_slot_field = usage->hid;
  209. return 1;
  210. case HID_DG_HEIGHT:
  211. hid_map_usage(hi, usage, bit, max,
  212. EV_ABS, ABS_MT_TOUCH_MINOR);
  213. field->logical_maximum = 1;
  214. field->logical_minimum = 0;
  215. set_abs(hi->input, ABS_MT_ORIENTATION, field, 0);
  216. td->last_slot_field = usage->hid;
  217. return 1;
  218. case HID_DG_TIPPRESSURE:
  219. if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
  220. field->logical_minimum = 0;
  221. hid_map_usage(hi, usage, bit, max,
  222. EV_ABS, ABS_MT_PRESSURE);
  223. set_abs(hi->input, ABS_MT_PRESSURE, field,
  224. cls->sn_pressure);
  225. /* touchscreen emulation */
  226. set_abs(hi->input, ABS_PRESSURE, field,
  227. cls->sn_pressure);
  228. td->last_slot_field = usage->hid;
  229. return 1;
  230. case HID_DG_CONTACTCOUNT:
  231. td->last_field_index = field->report->maxfield - 1;
  232. return 1;
  233. case HID_DG_CONTACTMAX:
  234. /* we don't set td->last_slot_field as contactcount and
  235. * contact max are global to the report */
  236. return -1;
  237. }
  238. /* let hid-input decide for the others */
  239. return 0;
  240. case 0xff000000:
  241. /* we do not want to map these: no input-oriented meaning */
  242. return -1;
  243. }
  244. return 0;
  245. }
  246. static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
  247. struct hid_field *field, struct hid_usage *usage,
  248. unsigned long **bit, int *max)
  249. {
  250. if (usage->type == EV_KEY || usage->type == EV_ABS)
  251. set_bit(usage->type, hi->input->evbit);
  252. return -1;
  253. }
  254. static int mt_compute_slot(struct mt_device *td)
  255. {
  256. __s32 quirks = td->mtclass->quirks;
  257. if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
  258. return td->curdata.contactid;
  259. if (quirks & MT_QUIRK_CYPRESS)
  260. return cypress_compute_slot(td);
  261. if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
  262. return td->num_received;
  263. return find_slot_from_contactid(td);
  264. }
  265. /*
  266. * this function is called when a whole contact has been processed,
  267. * so that it can assign it to a slot and store the data there
  268. */
  269. static void mt_complete_slot(struct mt_device *td)
  270. {
  271. td->curdata.seen_in_this_frame = true;
  272. if (td->curvalid) {
  273. int slotnum = mt_compute_slot(td);
  274. if (slotnum >= 0 && slotnum < td->maxcontacts)
  275. td->slots[slotnum] = td->curdata;
  276. }
  277. td->num_received++;
  278. }
  279. /*
  280. * this function is called when a whole packet has been received and processed,
  281. * so that it can decide what to send to the input layer.
  282. */
  283. static void mt_emit_event(struct mt_device *td, struct input_dev *input)
  284. {
  285. int i;
  286. for (i = 0; i < td->maxcontacts; ++i) {
  287. struct mt_slot *s = &(td->slots[i]);
  288. if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
  289. !s->seen_in_this_frame) {
  290. s->touch_state = false;
  291. }
  292. input_mt_slot(input, i);
  293. input_mt_report_slot_state(input, MT_TOOL_FINGER,
  294. s->touch_state);
  295. if (s->touch_state) {
  296. input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
  297. input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
  298. input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
  299. input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, s->w);
  300. input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, s->h);
  301. }
  302. s->seen_in_this_frame = false;
  303. }
  304. input_mt_report_pointer_emulation(input, true);
  305. input_sync(input);
  306. td->num_received = 0;
  307. }
  308. static int mt_event(struct hid_device *hid, struct hid_field *field,
  309. struct hid_usage *usage, __s32 value)
  310. {
  311. struct mt_device *td = hid_get_drvdata(hid);
  312. __s32 quirks = td->mtclass->quirks;
  313. if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
  314. switch (usage->hid) {
  315. case HID_DG_INRANGE:
  316. if (quirks & MT_QUIRK_VALID_IS_INRANGE)
  317. td->curvalid = value;
  318. break;
  319. case HID_DG_TIPSWITCH:
  320. if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
  321. td->curvalid = value;
  322. td->curdata.touch_state = value;
  323. break;
  324. case HID_DG_CONFIDENCE:
  325. if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
  326. td->curvalid = value;
  327. break;
  328. case HID_DG_CONTACTID:
  329. td->curdata.contactid = value;
  330. break;
  331. case HID_DG_TIPPRESSURE:
  332. td->curdata.p = value;
  333. break;
  334. case HID_GD_X:
  335. td->curdata.x = value;
  336. break;
  337. case HID_GD_Y:
  338. td->curdata.y = value;
  339. break;
  340. case HID_DG_WIDTH:
  341. td->curdata.w = value;
  342. break;
  343. case HID_DG_HEIGHT:
  344. td->curdata.h = value;
  345. break;
  346. case HID_DG_CONTACTCOUNT:
  347. /*
  348. * Includes multi-packet support where subsequent
  349. * packets are sent with zero contactcount.
  350. */
  351. if (value)
  352. td->num_expected = value;
  353. break;
  354. default:
  355. /* fallback to the generic hidinput handling */
  356. return 0;
  357. }
  358. if (usage->hid == td->last_slot_field) {
  359. mt_complete_slot(td);
  360. if (!td->last_field_index)
  361. mt_emit_event(td, field->hidinput->input);
  362. }
  363. if (field->index == td->last_field_index
  364. && td->num_received >= td->num_expected)
  365. mt_emit_event(td, field->hidinput->input);
  366. }
  367. /* we have handled the hidinput part, now remains hiddev */
  368. if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
  369. hid->hiddev_hid_event(hid, field, usage, value);
  370. return 1;
  371. }
  372. static void mt_set_input_mode(struct hid_device *hdev)
  373. {
  374. struct mt_device *td = hid_get_drvdata(hdev);
  375. struct hid_report *r;
  376. struct hid_report_enum *re;
  377. if (td->inputmode < 0)
  378. return;
  379. re = &(hdev->report_enum[HID_FEATURE_REPORT]);
  380. r = re->report_id_hash[td->inputmode];
  381. if (r) {
  382. r->field[0]->value[0] = 0x02;
  383. usbhid_submit_report(hdev, r, USB_DIR_OUT);
  384. }
  385. }
  386. static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
  387. {
  388. int ret, i;
  389. struct mt_device *td;
  390. struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
  391. for (i = 0; mt_classes[i].name ; i++) {
  392. if (id->driver_data == mt_classes[i].name) {
  393. mtclass = &(mt_classes[i]);
  394. break;
  395. }
  396. }
  397. /* This allows the driver to correctly support devices
  398. * that emit events over several HID messages.
  399. */
  400. hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
  401. td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
  402. if (!td) {
  403. dev_err(&hdev->dev, "cannot allocate multitouch data\n");
  404. return -ENOMEM;
  405. }
  406. td->mtclass = mtclass;
  407. td->inputmode = -1;
  408. hid_set_drvdata(hdev, td);
  409. ret = hid_parse(hdev);
  410. if (ret != 0)
  411. goto fail;
  412. ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
  413. if (ret)
  414. goto fail;
  415. if (!td->maxcontacts)
  416. td->maxcontacts = MT_DEFAULT_MAXCONTACT;
  417. td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
  418. GFP_KERNEL);
  419. if (!td->slots) {
  420. dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
  421. hid_hw_stop(hdev);
  422. ret = -ENOMEM;
  423. goto fail;
  424. }
  425. mt_set_input_mode(hdev);
  426. return 0;
  427. fail:
  428. kfree(td);
  429. return ret;
  430. }
  431. #ifdef CONFIG_PM
  432. static int mt_reset_resume(struct hid_device *hdev)
  433. {
  434. mt_set_input_mode(hdev);
  435. return 0;
  436. }
  437. #endif
  438. static void mt_remove(struct hid_device *hdev)
  439. {
  440. struct mt_device *td = hid_get_drvdata(hdev);
  441. hid_hw_stop(hdev);
  442. kfree(td->slots);
  443. kfree(td);
  444. hid_set_drvdata(hdev, NULL);
  445. }
  446. static const struct hid_device_id mt_devices[] = {
  447. /* Cypress panel */
  448. { .driver_data = MT_CLS_CYPRESS,
  449. HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
  450. USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
  451. /* GeneralTouch panel */
  452. { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
  453. HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
  454. USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
  455. /* IRTOUCH panels */
  456. { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
  457. HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
  458. USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
  459. /* PixCir-based panels */
  460. { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
  461. HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
  462. USB_DEVICE_ID_HANVON_MULTITOUCH) },
  463. { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
  464. HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
  465. USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
  466. /* Resistive eGalax devices */
  467. { .driver_data = MT_CLS_EGALAX,
  468. HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
  469. USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
  470. { .driver_data = MT_CLS_EGALAX,
  471. HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
  472. USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
  473. /* Capacitive eGalax devices */
  474. { .driver_data = MT_CLS_EGALAX,
  475. HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
  476. USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
  477. { .driver_data = MT_CLS_EGALAX,
  478. HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
  479. USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
  480. { .driver_data = MT_CLS_EGALAX,
  481. HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
  482. USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
  483. /* Stantum panels */
  484. { .driver_data = MT_CLS_STANTUM,
  485. HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
  486. USB_DEVICE_ID_MTP)},
  487. { .driver_data = MT_CLS_STANTUM,
  488. HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
  489. USB_DEVICE_ID_MTP_STM)},
  490. { .driver_data = MT_CLS_STANTUM,
  491. HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
  492. USB_DEVICE_ID_MTP_SITRONIX)},
  493. { }
  494. };
  495. MODULE_DEVICE_TABLE(hid, mt_devices);
  496. static const struct hid_usage_id mt_grabbed_usages[] = {
  497. { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
  498. { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
  499. };
  500. static struct hid_driver mt_driver = {
  501. .name = "hid-multitouch",
  502. .id_table = mt_devices,
  503. .probe = mt_probe,
  504. .remove = mt_remove,
  505. .input_mapping = mt_input_mapping,
  506. .input_mapped = mt_input_mapped,
  507. .feature_mapping = mt_feature_mapping,
  508. .usage_table = mt_grabbed_usages,
  509. .event = mt_event,
  510. #ifdef CONFIG_PM
  511. .reset_resume = mt_reset_resume,
  512. #endif
  513. };
  514. static int __init mt_init(void)
  515. {
  516. return hid_register_driver(&mt_driver);
  517. }
  518. static void __exit mt_exit(void)
  519. {
  520. hid_unregister_driver(&mt_driver);
  521. }
  522. module_init(mt_init);
  523. module_exit(mt_exit);