evdev.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. /*
  2. * Event char devices, giving access to raw input device events.
  3. *
  4. * Copyright (c) 1999-2002 Vojtech Pavlik
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. */
  10. #define EVDEV_MINOR_BASE 64
  11. #define EVDEV_MINORS 32
  12. #define EVDEV_BUFFER_SIZE 64
  13. #include <linux/poll.h>
  14. #include <linux/slab.h>
  15. #include <linux/module.h>
  16. #include <linux/init.h>
  17. #include <linux/input.h>
  18. #include <linux/major.h>
  19. #include <linux/smp_lock.h>
  20. #include <linux/device.h>
  21. #include <linux/compat.h>
  22. struct evdev {
  23. int exist;
  24. int open;
  25. int minor;
  26. char name[16];
  27. struct input_handle handle;
  28. wait_queue_head_t wait;
  29. struct evdev_list *grab;
  30. struct list_head list;
  31. };
  32. struct evdev_list {
  33. struct input_event buffer[EVDEV_BUFFER_SIZE];
  34. int head;
  35. int tail;
  36. struct fasync_struct *fasync;
  37. struct evdev *evdev;
  38. struct list_head node;
  39. };
  40. static struct evdev *evdev_table[EVDEV_MINORS];
  41. static void evdev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
  42. {
  43. struct evdev *evdev = handle->private;
  44. struct evdev_list *list;
  45. if (evdev->grab) {
  46. list = evdev->grab;
  47. do_gettimeofday(&list->buffer[list->head].time);
  48. list->buffer[list->head].type = type;
  49. list->buffer[list->head].code = code;
  50. list->buffer[list->head].value = value;
  51. list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1);
  52. kill_fasync(&list->fasync, SIGIO, POLL_IN);
  53. } else
  54. list_for_each_entry(list, &evdev->list, node) {
  55. do_gettimeofday(&list->buffer[list->head].time);
  56. list->buffer[list->head].type = type;
  57. list->buffer[list->head].code = code;
  58. list->buffer[list->head].value = value;
  59. list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1);
  60. kill_fasync(&list->fasync, SIGIO, POLL_IN);
  61. }
  62. wake_up_interruptible(&evdev->wait);
  63. }
  64. static int evdev_fasync(int fd, struct file *file, int on)
  65. {
  66. int retval;
  67. struct evdev_list *list = file->private_data;
  68. retval = fasync_helper(fd, file, on, &list->fasync);
  69. return retval < 0 ? retval : 0;
  70. }
  71. static int evdev_flush(struct file * file)
  72. {
  73. struct evdev_list *list = file->private_data;
  74. if (!list->evdev->exist) return -ENODEV;
  75. return input_flush_device(&list->evdev->handle, file);
  76. }
  77. static void evdev_free(struct evdev *evdev)
  78. {
  79. evdev_table[evdev->minor] = NULL;
  80. kfree(evdev);
  81. }
  82. static int evdev_release(struct inode * inode, struct file * file)
  83. {
  84. struct evdev_list *list = file->private_data;
  85. if (list->evdev->grab == list) {
  86. input_release_device(&list->evdev->handle);
  87. list->evdev->grab = NULL;
  88. }
  89. evdev_fasync(-1, file, 0);
  90. list_del(&list->node);
  91. if (!--list->evdev->open) {
  92. if (list->evdev->exist)
  93. input_close_device(&list->evdev->handle);
  94. else
  95. evdev_free(list->evdev);
  96. }
  97. kfree(list);
  98. return 0;
  99. }
  100. static int evdev_open(struct inode * inode, struct file * file)
  101. {
  102. struct evdev_list *list;
  103. int i = iminor(inode) - EVDEV_MINOR_BASE;
  104. int accept_err;
  105. if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist)
  106. return -ENODEV;
  107. if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file)))
  108. return accept_err;
  109. if (!(list = kmalloc(sizeof(struct evdev_list), GFP_KERNEL)))
  110. return -ENOMEM;
  111. memset(list, 0, sizeof(struct evdev_list));
  112. list->evdev = evdev_table[i];
  113. list_add_tail(&list->node, &evdev_table[i]->list);
  114. file->private_data = list;
  115. if (!list->evdev->open++)
  116. if (list->evdev->exist)
  117. input_open_device(&list->evdev->handle);
  118. return 0;
  119. }
  120. #ifdef CONFIG_COMPAT
  121. struct input_event_compat {
  122. struct compat_timeval time;
  123. __u16 type;
  124. __u16 code;
  125. __s32 value;
  126. };
  127. #ifdef CONFIG_X86_64
  128. # define COMPAT_TEST test_thread_flag(TIF_IA32)
  129. #elif defined(CONFIG_IA64)
  130. # define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current))
  131. #elif defined(CONFIG_ARCH_S390)
  132. # define COMPAT_TEST test_thread_flag(TIF_31BIT)
  133. #elif defined(CONFIG_MIPS)
  134. # define COMPAT_TEST (current->thread.mflags & MF_32BIT_ADDR)
  135. #else
  136. # define COMPAT_TEST test_thread_flag(TIF_32BIT)
  137. #endif
  138. static inline size_t evdev_event_size(void)
  139. {
  140. return COMPAT_TEST ?
  141. sizeof(struct input_event_compat) : sizeof(struct input_event);
  142. }
  143. static int evdev_event_from_user(const char __user *buffer, struct input_event *event)
  144. {
  145. if (COMPAT_TEST) {
  146. struct input_event_compat compat_event;
  147. if (copy_from_user(&compat_event, buffer, sizeof(struct input_event_compat)))
  148. return -EFAULT;
  149. event->time.tv_sec = compat_event.time.tv_sec;
  150. event->time.tv_usec = compat_event.time.tv_usec;
  151. event->type = compat_event.type;
  152. event->code = compat_event.code;
  153. event->value = compat_event.value;
  154. } else {
  155. if (copy_from_user(event, buffer, sizeof(struct input_event)))
  156. return -EFAULT;
  157. }
  158. return 0;
  159. }
  160. static int evdev_event_to_user(char __user *buffer, const struct input_event *event)
  161. {
  162. if (COMPAT_TEST) {
  163. struct input_event_compat compat_event;
  164. compat_event.time.tv_sec = event->time.tv_sec;
  165. compat_event.time.tv_usec = event->time.tv_usec;
  166. compat_event.type = event->type;
  167. compat_event.code = event->code;
  168. compat_event.value = event->value;
  169. if (copy_to_user(buffer, &compat_event, sizeof(struct input_event_compat)))
  170. return -EFAULT;
  171. } else {
  172. if (copy_to_user(buffer, event, sizeof(struct input_event)))
  173. return -EFAULT;
  174. }
  175. return 0;
  176. }
  177. #else
  178. static inline size_t evdev_event_size(void)
  179. {
  180. return sizeof(struct input_event);
  181. }
  182. static int evdev_event_from_user(const char __user *buffer, struct input_event *event)
  183. {
  184. if (copy_from_user(event, buffer, sizeof(struct input_event)))
  185. return -EFAULT;
  186. return 0;
  187. }
  188. static int evdev_event_to_user(char __user *buffer, const struct input_event *event)
  189. {
  190. if (copy_to_user(buffer, event, sizeof(struct input_event)))
  191. return -EFAULT;
  192. return 0;
  193. }
  194. #endif /* CONFIG_COMPAT */
  195. static ssize_t evdev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos)
  196. {
  197. struct evdev_list *list = file->private_data;
  198. struct input_event event;
  199. int retval = 0;
  200. if (!list->evdev->exist)
  201. return -ENODEV;
  202. while (retval < count) {
  203. if (evdev_event_from_user(buffer + retval, &event))
  204. return -EFAULT;
  205. input_event(list->evdev->handle.dev, event.type, event.code, event.value);
  206. retval += evdev_event_size();
  207. }
  208. return retval;
  209. }
  210. static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos)
  211. {
  212. struct evdev_list *list = file->private_data;
  213. int retval;
  214. if (count < evdev_event_size())
  215. return -EINVAL;
  216. if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK))
  217. return -EAGAIN;
  218. retval = wait_event_interruptible(list->evdev->wait,
  219. list->head != list->tail || (!list->evdev->exist));
  220. if (retval)
  221. return retval;
  222. if (!list->evdev->exist)
  223. return -ENODEV;
  224. while (list->head != list->tail && retval + evdev_event_size() <= count) {
  225. struct input_event *event = (struct input_event *) list->buffer + list->tail;
  226. if (evdev_event_to_user(buffer + retval, event))
  227. return -EFAULT;
  228. list->tail = (list->tail + 1) & (EVDEV_BUFFER_SIZE - 1);
  229. retval += evdev_event_size();
  230. }
  231. return retval;
  232. }
  233. /* No kernel lock - fine */
  234. static unsigned int evdev_poll(struct file *file, poll_table *wait)
  235. {
  236. struct evdev_list *list = file->private_data;
  237. poll_wait(file, &list->evdev->wait, wait);
  238. return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) |
  239. (list->evdev->exist ? 0 : (POLLHUP | POLLERR));
  240. }
  241. #ifdef CONFIG_COMPAT
  242. #define BITS_PER_LONG_COMPAT (sizeof(compat_long_t) * 8)
  243. #define NBITS_COMPAT(x) ((((x) - 1) / BITS_PER_LONG_COMPAT) + 1)
  244. #ifdef __BIG_ENDIAN
  245. static int bits_to_user(unsigned long *bits, unsigned int maxbit,
  246. unsigned int maxlen, void __user *p, int compat)
  247. {
  248. int len, i;
  249. if (compat) {
  250. len = NBITS_COMPAT(maxbit) * sizeof(compat_long_t);
  251. if (len < maxlen)
  252. len = maxlen;
  253. for (i = 0; i < len / sizeof(compat_long_t); i++)
  254. if (copy_to_user((compat_long_t __user *) p + i,
  255. (compat_long_t *) bits +
  256. i + 1 - ((i % 2) << 1),
  257. sizeof(compat_long_t)))
  258. return -EFAULT;
  259. } else {
  260. len = NBITS(maxbit) * sizeof(long);
  261. if (len > maxlen)
  262. len = maxlen;
  263. if (copy_to_user(p, bits, len))
  264. return -EFAULT;
  265. }
  266. return len;
  267. }
  268. #else
  269. static int bits_to_user(unsigned long *bits, unsigned int maxbit,
  270. unsigned int maxlen, void __user *p, int compat)
  271. {
  272. int len = compat ?
  273. NBITS_COMPAT(maxbit) * sizeof(compat_long_t) :
  274. NBITS(maxbit) * sizeof(long);
  275. if (len > maxlen)
  276. len = maxlen;
  277. return copy_to_user(p, bits, len) ? -EFAULT : len;
  278. }
  279. #endif /* __BIG_ENDIAN */
  280. #else
  281. static int bits_to_user(unsigned long *bits, unsigned int maxbit,
  282. unsigned int maxlen, void __user *p, int compat)
  283. {
  284. int len = NBITS(maxbit) * sizeof(long);
  285. if (len > maxlen)
  286. len = maxlen;
  287. return copy_to_user(p, bits, len) ? -EFAULT : len;
  288. }
  289. #endif /* CONFIG_COMPAT */
  290. static int str_to_user(const char *str, unsigned int maxlen, void __user *p)
  291. {
  292. int len;
  293. if (!str)
  294. return -ENOENT;
  295. len = strlen(str) + 1;
  296. if (len > maxlen)
  297. len = maxlen;
  298. return copy_to_user(p, str, len) ? -EFAULT : len;
  299. }
  300. static long evdev_ioctl_handler(struct file *file, unsigned int cmd,
  301. void __user *p, int compat_mode)
  302. {
  303. struct evdev_list *list = file->private_data;
  304. struct evdev *evdev = list->evdev;
  305. struct input_dev *dev = evdev->handle.dev;
  306. struct input_absinfo abs;
  307. int __user *ip = (int __user *)p;
  308. int i, t, u, v;
  309. if (!evdev->exist)
  310. return -ENODEV;
  311. switch (cmd) {
  312. case EVIOCGVERSION:
  313. return put_user(EV_VERSION, ip);
  314. case EVIOCGID:
  315. if (copy_to_user(p, &dev->id, sizeof(struct input_id)))
  316. return -EFAULT;
  317. return 0;
  318. case EVIOCGKEYCODE:
  319. if (get_user(t, ip))
  320. return -EFAULT;
  321. if (t < 0 || t >= dev->keycodemax || !dev->keycodesize)
  322. return -EINVAL;
  323. if (put_user(INPUT_KEYCODE(dev, t), ip + 1))
  324. return -EFAULT;
  325. return 0;
  326. case EVIOCSKEYCODE:
  327. if (get_user(t, ip))
  328. return -EFAULT;
  329. if (t < 0 || t >= dev->keycodemax || !dev->keycodesize)
  330. return -EINVAL;
  331. if (get_user(v, ip + 1))
  332. return -EFAULT;
  333. if (v < 0 || v > KEY_MAX)
  334. return -EINVAL;
  335. if (dev->keycodesize < sizeof(v) && (v >> (dev->keycodesize * 8)))
  336. return -EINVAL;
  337. u = SET_INPUT_KEYCODE(dev, t, v);
  338. clear_bit(u, dev->keybit);
  339. set_bit(v, dev->keybit);
  340. for (i = 0; i < dev->keycodemax; i++)
  341. if (INPUT_KEYCODE(dev, i) == u)
  342. set_bit(u, dev->keybit);
  343. return 0;
  344. case EVIOCSFF:
  345. if (dev->upload_effect) {
  346. struct ff_effect effect;
  347. int err;
  348. if (copy_from_user(&effect, p, sizeof(effect)))
  349. return -EFAULT;
  350. err = dev->upload_effect(dev, &effect);
  351. if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
  352. return -EFAULT;
  353. return err;
  354. } else
  355. return -ENOSYS;
  356. case EVIOCRMFF:
  357. if (!dev->erase_effect)
  358. return -ENOSYS;
  359. return dev->erase_effect(dev, (int)(unsigned long) p);
  360. case EVIOCGEFFECTS:
  361. if (put_user(dev->ff_effects_max, ip))
  362. return -EFAULT;
  363. return 0;
  364. case EVIOCGRAB:
  365. if (p) {
  366. if (evdev->grab)
  367. return -EBUSY;
  368. if (input_grab_device(&evdev->handle))
  369. return -EBUSY;
  370. evdev->grab = list;
  371. return 0;
  372. } else {
  373. if (evdev->grab != list)
  374. return -EINVAL;
  375. input_release_device(&evdev->handle);
  376. evdev->grab = NULL;
  377. return 0;
  378. }
  379. default:
  380. if (_IOC_TYPE(cmd) != 'E')
  381. return -EINVAL;
  382. if (_IOC_DIR(cmd) == _IOC_READ) {
  383. if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0,0))) {
  384. long *bits;
  385. int len;
  386. switch (_IOC_NR(cmd) & EV_MAX) {
  387. case 0: bits = dev->evbit; len = EV_MAX; break;
  388. case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;
  389. case EV_REL: bits = dev->relbit; len = REL_MAX; break;
  390. case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;
  391. case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break;
  392. case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
  393. case EV_SND: bits = dev->sndbit; len = SND_MAX; break;
  394. case EV_FF: bits = dev->ffbit; len = FF_MAX; break;
  395. case EV_SW: bits = dev->swbit; len = SW_MAX; break;
  396. default: return -EINVAL;
  397. }
  398. return bits_to_user(bits, len, _IOC_SIZE(cmd), p, compat_mode);
  399. }
  400. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0)))
  401. return bits_to_user(dev->key, KEY_MAX, _IOC_SIZE(cmd),
  402. p, compat_mode);
  403. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGLED(0)))
  404. return bits_to_user(dev->led, LED_MAX, _IOC_SIZE(cmd),
  405. p, compat_mode);
  406. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSND(0)))
  407. return bits_to_user(dev->snd, SND_MAX, _IOC_SIZE(cmd),
  408. p, compat_mode);
  409. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSW(0)))
  410. return bits_to_user(dev->sw, SW_MAX, _IOC_SIZE(cmd),
  411. p, compat_mode);
  412. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0)))
  413. return str_to_user(dev->name, _IOC_SIZE(cmd), p);
  414. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0)))
  415. return str_to_user(dev->phys, _IOC_SIZE(cmd), p);
  416. if (_IOC_NR(cmd) == _IOC_NR(EVIOCGUNIQ(0)))
  417. return str_to_user(dev->uniq, _IOC_SIZE(cmd), p);
  418. if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {
  419. int t = _IOC_NR(cmd) & ABS_MAX;
  420. abs.value = dev->abs[t];
  421. abs.minimum = dev->absmin[t];
  422. abs.maximum = dev->absmax[t];
  423. abs.fuzz = dev->absfuzz[t];
  424. abs.flat = dev->absflat[t];
  425. if (copy_to_user(p, &abs, sizeof(struct input_absinfo)))
  426. return -EFAULT;
  427. return 0;
  428. }
  429. }
  430. if (_IOC_DIR(cmd) == _IOC_WRITE) {
  431. if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
  432. int t = _IOC_NR(cmd) & ABS_MAX;
  433. if (copy_from_user(&abs, p, sizeof(struct input_absinfo)))
  434. return -EFAULT;
  435. dev->abs[t] = abs.value;
  436. dev->absmin[t] = abs.minimum;
  437. dev->absmax[t] = abs.maximum;
  438. dev->absfuzz[t] = abs.fuzz;
  439. dev->absflat[t] = abs.flat;
  440. return 0;
  441. }
  442. }
  443. }
  444. return -EINVAL;
  445. }
  446. static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  447. {
  448. return evdev_ioctl_handler(file, cmd, (void __user *)arg, 0);
  449. }
  450. #ifdef CONFIG_COMPAT
  451. static long evdev_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
  452. {
  453. return evdev_ioctl_handler(file, cmd, compat_ptr(arg), 1);
  454. }
  455. #endif
  456. static struct file_operations evdev_fops = {
  457. .owner = THIS_MODULE,
  458. .read = evdev_read,
  459. .write = evdev_write,
  460. .poll = evdev_poll,
  461. .open = evdev_open,
  462. .release = evdev_release,
  463. .unlocked_ioctl = evdev_ioctl,
  464. #ifdef CONFIG_COMPAT
  465. .compat_ioctl = evdev_ioctl_compat,
  466. #endif
  467. .fasync = evdev_fasync,
  468. .flush = evdev_flush
  469. };
  470. static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
  471. {
  472. struct evdev *evdev;
  473. struct class_device *cdev;
  474. int minor;
  475. for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++);
  476. if (minor == EVDEV_MINORS) {
  477. printk(KERN_ERR "evdev: no more free evdev devices\n");
  478. return NULL;
  479. }
  480. if (!(evdev = kmalloc(sizeof(struct evdev), GFP_KERNEL)))
  481. return NULL;
  482. memset(evdev, 0, sizeof(struct evdev));
  483. INIT_LIST_HEAD(&evdev->list);
  484. init_waitqueue_head(&evdev->wait);
  485. evdev->exist = 1;
  486. evdev->minor = minor;
  487. evdev->handle.dev = dev;
  488. evdev->handle.name = evdev->name;
  489. evdev->handle.handler = handler;
  490. evdev->handle.private = evdev;
  491. sprintf(evdev->name, "event%d", minor);
  492. evdev_table[minor] = evdev;
  493. cdev = class_device_create(&input_class, &dev->cdev,
  494. MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
  495. dev->cdev.dev, evdev->name);
  496. /* temporary symlink to keep userspace happy */
  497. sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj,
  498. evdev->name);
  499. return &evdev->handle;
  500. }
  501. static void evdev_disconnect(struct input_handle *handle)
  502. {
  503. struct evdev *evdev = handle->private;
  504. struct evdev_list *list;
  505. sysfs_remove_link(&input_class.subsys.kset.kobj, evdev->name);
  506. class_device_destroy(&input_class,
  507. MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
  508. evdev->exist = 0;
  509. if (evdev->open) {
  510. input_close_device(handle);
  511. wake_up_interruptible(&evdev->wait);
  512. list_for_each_entry(list, &evdev->list, node)
  513. kill_fasync(&list->fasync, SIGIO, POLL_HUP);
  514. } else
  515. evdev_free(evdev);
  516. }
  517. static struct input_device_id evdev_ids[] = {
  518. { .driver_info = 1 }, /* Matches all devices */
  519. { }, /* Terminating zero entry */
  520. };
  521. MODULE_DEVICE_TABLE(input, evdev_ids);
  522. static struct input_handler evdev_handler = {
  523. .event = evdev_event,
  524. .connect = evdev_connect,
  525. .disconnect = evdev_disconnect,
  526. .fops = &evdev_fops,
  527. .minor = EVDEV_MINOR_BASE,
  528. .name = "evdev",
  529. .id_table = evdev_ids,
  530. };
  531. static int __init evdev_init(void)
  532. {
  533. input_register_handler(&evdev_handler);
  534. return 0;
  535. }
  536. static void __exit evdev_exit(void)
  537. {
  538. input_unregister_handler(&evdev_handler);
  539. }
  540. module_init(evdev_init);
  541. module_exit(evdev_exit);
  542. MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
  543. MODULE_DESCRIPTION("Input driver event char devices");
  544. MODULE_LICENSE("GPL");