2 * Copyright (c) 2014 Jakub Wojciech Klama <jceel@FreeBSD.org>
3 * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #include "opt_evdev.h"
32 #include <sys/param.h>
33 #include <sys/bitstring.h>
35 #include <sys/kernel.h>
36 #include <sys/malloc.h>
37 #include <sys/module.h>
38 #include <sys/sysctl.h>
39 #include <sys/systm.h>
41 #include <dev/evdev/evdev.h>
42 #include <dev/evdev/evdev_private.h>
43 #include <dev/evdev/input.h>
46 #define debugf(evdev, fmt, args...) printf("evdev: " fmt "\n", ##args)
48 #define debugf(evdev, fmt, args...)
52 FEATURE(evdev, "Input event devices support");
55 enum evdev_sparse_result
57 EV_SKIP_EVENT, /* Event value not changed */
58 EV_REPORT_EVENT, /* Event value changed */
59 EV_REPORT_MT_SLOT, /* Event value and MT slot number changed */
62 MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory");
64 int evdev_rcpt_mask = EVDEV_RCPT_SYSMOUSE | EVDEV_RCPT_KBDMUX;
65 int evdev_sysmouse_t_axis = 0;
67 SYSCTL_NODE(_kern, OID_AUTO, evdev, CTLFLAG_RW, 0, "Evdev args");
68 SYSCTL_INT(_kern_evdev, OID_AUTO, rcpt_mask, CTLFLAG_RW, &evdev_rcpt_mask, 0,
69 "Who is receiving events: bit0 - sysmouse, bit1 - kbdmux, "
70 "bit2 - mouse hardware, bit3 - keyboard hardware");
71 SYSCTL_INT(_kern_evdev, OID_AUTO, sysmouse_t_axis, CTLFLAG_RW,
72 &evdev_sysmouse_t_axis, 0, "Extract T-axis from 0-none, 1-ums, 2-psm");
74 static void evdev_start_repeat(struct evdev_dev *, uint16_t);
75 static void evdev_stop_repeat(struct evdev_dev *);
76 static int evdev_check_event(struct evdev_dev *, uint16_t, uint16_t, int32_t);
79 bit_change(bitstr_t *bitstr, int bit, int value)
84 bit_clear(bitstr, bit);
91 return malloc(sizeof(struct evdev_dev), M_EVDEV, M_WAITOK | M_ZERO);
95 evdev_free(struct evdev_dev *evdev)
98 if (evdev != NULL && evdev->ev_cdev != NULL &&
99 evdev->ev_cdev->si_drv1 != NULL)
100 evdev_unregister(evdev);
102 free(evdev, M_EVDEV);
105 static struct input_absinfo *
106 evdev_alloc_absinfo(void)
109 return (malloc(sizeof(struct input_absinfo) * ABS_CNT, M_EVDEV,
114 evdev_free_absinfo(struct input_absinfo *absinfo)
117 free(absinfo, M_EVDEV);
121 evdev_set_report_size(struct evdev_dev *evdev, size_t report_size)
123 if (report_size > KEY_CNT + REL_CNT + ABS_CNT + MAX_MT_SLOTS * MT_CNT +
124 MSC_CNT + LED_CNT + SND_CNT + SW_CNT + FF_CNT)
127 evdev->ev_report_size = report_size;
132 evdev_estimate_report_size(struct evdev_dev *evdev)
138 * Keyboards generate one event per report but other devices with
139 * buttons like mouses can report events simultaneously
141 bit_ffs_at(evdev->ev_key_flags, KEY_OK, KEY_CNT - KEY_OK, &res);
143 bit_ffs(evdev->ev_key_flags, BTN_MISC, &res);
145 bit_count(evdev->ev_key_flags, BTN_MISC, KEY_OK - BTN_MISC, &res);
148 /* All relative axes can be reported simultaneously */
149 bit_count(evdev->ev_rel_flags, 0, REL_CNT, &res);
153 * All absolute axes can be reported simultaneously.
154 * Multitouch axes can be reported ABS_MT_SLOT times
156 if (evdev->ev_absinfo != NULL) {
157 bit_count(evdev->ev_abs_flags, 0, ABS_CNT, &res);
159 bit_count(evdev->ev_abs_flags, ABS_MT_FIRST, MT_CNT, &res);
161 res++; /* ABS_MT_SLOT or SYN_MT_REPORT */
162 if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT))
164 size += res * MAXIMAL_MT_SLOT(evdev);
167 size += res * (MAX_MT_REPORTS - 1);
171 /* All misc events can be reported simultaneously */
172 bit_count(evdev->ev_msc_flags, 0, MSC_CNT, &res);
175 /* All leds can be reported simultaneously */
176 bit_count(evdev->ev_led_flags, 0, LED_CNT, &res);
179 /* Assume other events are generated once per report */
180 bit_ffs(evdev->ev_snd_flags, SND_CNT, &res);
183 bit_ffs(evdev->ev_sw_flags, SW_CNT, &res);
186 /* XXX: FF part is not implemented yet */
188 size++; /* SYN_REPORT */
193 evdev_register_common(struct evdev_dev *evdev)
197 debugf(evdev, "%s: registered evdev provider: %s <%s>\n",
198 evdev->ev_shortname, evdev->ev_name, evdev->ev_serial);
200 /* Initialize internal structures */
201 LIST_INIT(&evdev->ev_clients);
203 if (evdev_event_supported(evdev, EV_REP) &&
204 bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT)) {
205 /* Initialize callout */
206 callout_init_mtx(&evdev->ev_rep_callout, &evdev->ev_mtx, 0);
208 if (evdev->ev_rep[REP_DELAY] == 0 &&
209 evdev->ev_rep[REP_PERIOD] == 0) {
210 /* Supply default values */
211 evdev->ev_rep[REP_DELAY] = 250;
212 evdev->ev_rep[REP_PERIOD] = 33;
216 /* Initialize multitouch protocol type B states */
217 if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT) &&
218 evdev->ev_absinfo != NULL && MAXIMAL_MT_SLOT(evdev) > 0)
219 evdev_mt_init(evdev);
221 /* Estimate maximum report size */
222 if (evdev->ev_report_size == 0) {
223 ret = evdev_set_report_size(evdev,
224 evdev_estimate_report_size(evdev));
229 /* Create char device node */
230 ret = evdev_cdev_create(evdev);
236 evdev_register(struct evdev_dev *evdev)
240 evdev->ev_lock_type = EV_LOCK_INTERNAL;
241 evdev->ev_lock = &evdev->ev_mtx;
242 mtx_init(&evdev->ev_mtx, "evmtx", NULL, MTX_DEF);
244 ret = evdev_register_common(evdev);
246 mtx_destroy(&evdev->ev_mtx);
252 evdev_register_mtx(struct evdev_dev *evdev, struct mtx *mtx)
255 evdev->ev_lock_type = EV_LOCK_MTX;
256 evdev->ev_lock = mtx;
257 return (evdev_register_common(evdev));
261 evdev_unregister(struct evdev_dev *evdev)
263 struct evdev_client *client;
265 debugf(evdev, "%s: unregistered evdev provider: %s\n",
266 evdev->ev_shortname, evdev->ev_name);
269 evdev->ev_cdev->si_drv1 = NULL;
270 /* Wake up sleepers */
271 LIST_FOREACH(client, &evdev->ev_clients, ec_link) {
272 evdev_revoke_client(client);
273 evdev_dispose_client(evdev, client);
274 EVDEV_CLIENT_LOCKQ(client);
275 evdev_notify_event(client);
276 EVDEV_CLIENT_UNLOCKQ(client);
280 /* destroy_dev can sleep so release lock */
281 ret = evdev_cdev_destroy(evdev);
282 evdev->ev_cdev = NULL;
283 if (ret == 0 && evdev->ev_lock_type == EV_LOCK_INTERNAL)
284 mtx_destroy(&evdev->ev_mtx);
286 evdev_free_absinfo(evdev->ev_absinfo);
287 evdev_mt_free(evdev);
293 evdev_set_name(struct evdev_dev *evdev, const char *name)
296 snprintf(evdev->ev_name, NAMELEN, "%s", name);
300 evdev_set_id(struct evdev_dev *evdev, uint16_t bustype, uint16_t vendor,
301 uint16_t product, uint16_t version)
304 evdev->ev_id = (struct input_id) {
313 evdev_set_phys(struct evdev_dev *evdev, const char *name)
316 snprintf(evdev->ev_shortname, NAMELEN, "%s", name);
320 evdev_set_serial(struct evdev_dev *evdev, const char *serial)
323 snprintf(evdev->ev_serial, NAMELEN, "%s", serial);
327 evdev_set_methods(struct evdev_dev *evdev, void *softc,
328 const struct evdev_methods *methods)
331 evdev->ev_methods = methods;
332 evdev->ev_softc = softc;
336 evdev_support_prop(struct evdev_dev *evdev, uint16_t prop)
339 KASSERT(prop < INPUT_PROP_CNT, ("invalid evdev input property"));
340 bit_set(evdev->ev_prop_flags, prop);
344 evdev_support_event(struct evdev_dev *evdev, uint16_t type)
347 KASSERT(type < EV_CNT, ("invalid evdev event property"));
348 bit_set(evdev->ev_type_flags, type);
352 evdev_support_key(struct evdev_dev *evdev, uint16_t code)
355 KASSERT(code < KEY_CNT, ("invalid evdev key property"));
356 bit_set(evdev->ev_key_flags, code);
360 evdev_support_rel(struct evdev_dev *evdev, uint16_t code)
363 KASSERT(code < REL_CNT, ("invalid evdev rel property"));
364 bit_set(evdev->ev_rel_flags, code);
368 evdev_support_abs(struct evdev_dev *evdev, uint16_t code, int32_t value,
369 int32_t minimum, int32_t maximum, int32_t fuzz, int32_t flat,
372 struct input_absinfo absinfo;
374 KASSERT(code < ABS_CNT, ("invalid evdev abs property"));
376 absinfo = (struct input_absinfo) {
382 .resolution = resolution,
384 evdev_set_abs_bit(evdev, code);
385 evdev_set_absinfo(evdev, code, &absinfo);
389 evdev_set_abs_bit(struct evdev_dev *evdev, uint16_t code)
392 KASSERT(code < ABS_CNT, ("invalid evdev abs property"));
393 if (evdev->ev_absinfo == NULL)
394 evdev->ev_absinfo = evdev_alloc_absinfo();
395 bit_set(evdev->ev_abs_flags, code);
399 evdev_support_msc(struct evdev_dev *evdev, uint16_t code)
402 KASSERT(code < MSC_CNT, ("invalid evdev msc property"));
403 bit_set(evdev->ev_msc_flags, code);
408 evdev_support_led(struct evdev_dev *evdev, uint16_t code)
411 KASSERT(code < LED_CNT, ("invalid evdev led property"));
412 bit_set(evdev->ev_led_flags, code);
416 evdev_support_snd(struct evdev_dev *evdev, uint16_t code)
419 KASSERT(code < SND_CNT, ("invalid evdev snd property"));
420 bit_set(evdev->ev_snd_flags, code);
424 evdev_support_sw(struct evdev_dev *evdev, uint16_t code)
427 KASSERT(code < SW_CNT, ("invalid evdev sw property"));
428 bit_set(evdev->ev_sw_flags, code);
432 evdev_event_supported(struct evdev_dev *evdev, uint16_t type)
435 KASSERT(type < EV_CNT, ("invalid evdev event property"));
436 return (bit_test(evdev->ev_type_flags, type));
440 evdev_set_absinfo(struct evdev_dev *evdev, uint16_t axis,
441 struct input_absinfo *absinfo)
444 KASSERT(axis < ABS_CNT, ("invalid evdev abs property"));
446 if (axis == ABS_MT_SLOT &&
447 (absinfo->maximum < 1 || absinfo->maximum >= MAX_MT_SLOTS))
450 if (evdev->ev_absinfo == NULL)
451 evdev->ev_absinfo = evdev_alloc_absinfo();
453 if (axis == ABS_MT_SLOT)
454 evdev->ev_absinfo[ABS_MT_SLOT].maximum = absinfo->maximum;
456 memcpy(&evdev->ev_absinfo[axis], absinfo,
457 sizeof(struct input_absinfo));
461 evdev_set_repeat_params(struct evdev_dev *evdev, uint16_t property, int value)
464 KASSERT(property < REP_CNT, ("invalid evdev repeat property"));
465 evdev->ev_rep[property] = value;
469 evdev_set_flag(struct evdev_dev *evdev, uint16_t flag)
472 KASSERT(flag < EVDEV_FLAG_CNT, ("invalid evdev flag property"));
473 bit_set(evdev->ev_flags, flag);
477 evdev_check_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
484 /* Allow SYN events implicitly */
485 if (type != EV_SYN && !evdev_event_supported(evdev, type))
497 if (!bit_test(evdev->ev_key_flags, code))
504 if (!bit_test(evdev->ev_rel_flags, code))
511 if (!bit_test(evdev->ev_abs_flags, code))
513 if (code == ABS_MT_SLOT &&
514 (value < 0 || value > MAXIMAL_MT_SLOT(evdev)))
516 if (ABS_IS_MT(code) && evdev->ev_mt == NULL &&
517 bit_test(evdev->ev_abs_flags, ABS_MT_SLOT))
524 if (!bit_test(evdev->ev_msc_flags, code))
531 if (!bit_test(evdev->ev_led_flags, code))
538 if (!bit_test(evdev->ev_snd_flags, code))
545 if (!bit_test(evdev->ev_sw_flags, code))
562 evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
566 EVDEV_LOCK_ASSERT(evdev);
570 if (!evdev_event_supported(evdev, EV_REP))
573 if (!bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT)) {
574 /* Detect driver key repeats. */
575 if (bit_test(evdev->ev_key_states, code) &&
576 *value == KEY_EVENT_DOWN)
577 *value = KEY_EVENT_REPEAT;
579 /* Start/stop callout for evdev repeats */
580 if (bit_test(evdev->ev_key_states, code) == !*value) {
581 if (*value == KEY_EVENT_DOWN)
582 evdev_start_repeat(evdev, code);
584 evdev_stop_repeat(evdev);
590 /* TBD: implement fuzz */
595 static enum evdev_sparse_result
596 evdev_sparse_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
599 int32_t last_mt_slot;
601 EVDEV_LOCK_ASSERT(evdev);
604 * For certain event types, update device state bits
605 * and convert level reporting to edge reporting
612 if (bit_test(evdev->ev_key_states, code) == value)
613 return (EV_SKIP_EVENT);
614 bit_change(evdev->ev_key_states, code, value);
617 case KEY_EVENT_REPEAT:
618 if (bit_test(evdev->ev_key_states, code) == 0 ||
619 !evdev_event_supported(evdev, EV_REP))
620 return (EV_SKIP_EVENT);
624 return (EV_SKIP_EVENT);
629 if (bit_test(evdev->ev_led_states, code) == value)
630 return (EV_SKIP_EVENT);
631 bit_change(evdev->ev_led_states, code, value);
635 if (bit_test(evdev->ev_snd_states, code) == value)
636 return (EV_SKIP_EVENT);
637 bit_change(evdev->ev_snd_states, code, value);
641 if (bit_test(evdev->ev_sw_states, code) == value)
642 return (EV_SKIP_EVENT);
643 bit_change(evdev->ev_sw_states, code, value);
647 if (evdev->ev_rep[code] == value)
648 return (EV_SKIP_EVENT);
649 evdev_set_repeat_params(evdev, code, value);
654 return (EV_SKIP_EVENT);
657 /* For EV_ABS, save last value in absinfo and ev_mt_states */
661 /* Postpone ABS_MT_SLOT till next event */
662 evdev_set_last_mt_slot(evdev, value);
663 return (EV_SKIP_EVENT);
665 case ABS_MT_FIRST ... ABS_MT_LAST:
666 /* Pass MT protocol type A events as is */
667 if (!bit_test(evdev->ev_abs_flags, ABS_MT_SLOT))
669 /* Don`t repeat MT protocol type B events */
670 last_mt_slot = evdev_get_last_mt_slot(evdev);
671 if (evdev_get_mt_value(evdev, last_mt_slot, code)
673 return (EV_SKIP_EVENT);
674 evdev_set_mt_value(evdev, last_mt_slot, code, value);
675 if (last_mt_slot != CURRENT_MT_SLOT(evdev)) {
676 CURRENT_MT_SLOT(evdev) = last_mt_slot;
677 evdev->ev_report_opened = true;
678 return (EV_REPORT_MT_SLOT);
683 if (evdev->ev_absinfo[code].value == value)
684 return (EV_SKIP_EVENT);
685 evdev->ev_absinfo[code].value = value;
690 if (code == SYN_REPORT) {
691 /* Count empty reports as well as non empty */
692 evdev->ev_report_count++;
693 /* Skip empty reports */
694 if (!evdev->ev_report_opened)
695 return (EV_SKIP_EVENT);
696 evdev->ev_report_opened = false;
697 return (EV_REPORT_EVENT);
702 evdev->ev_report_opened = true;
703 return (EV_REPORT_EVENT);
707 evdev_propagate_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
710 struct evdev_client *client;
712 debugf(evdev, "%s pushed event %d/%d/%d",
713 evdev->ev_shortname, type, code, value);
715 EVDEV_LOCK_ASSERT(evdev);
717 /* Propagate event through all clients */
718 LIST_FOREACH(client, &evdev->ev_clients, ec_link) {
719 if (evdev->ev_grabber != NULL && evdev->ev_grabber != client)
722 EVDEV_CLIENT_LOCKQ(client);
723 evdev_client_push(client, type, code, value);
724 if (type == EV_SYN && code == SYN_REPORT)
725 evdev_notify_event(client);
726 EVDEV_CLIENT_UNLOCKQ(client);
729 evdev->ev_event_count++;
733 evdev_send_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
736 enum evdev_sparse_result sparse;
738 EVDEV_LOCK_ASSERT(evdev);
740 sparse = evdev_sparse_event(evdev, type, code, value);
742 case EV_REPORT_MT_SLOT:
743 /* report postponed ABS_MT_SLOT */
744 evdev_propagate_event(evdev, EV_ABS, ABS_MT_SLOT,
745 CURRENT_MT_SLOT(evdev));
747 case EV_REPORT_EVENT:
748 evdev_propagate_event(evdev, type, code, value);
756 evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
760 if (evdev_check_event(evdev, type, code, value) != 0)
765 evdev_modify_event(evdev, type, code, &value);
766 if (type == EV_SYN && code == SYN_REPORT &&
767 bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL))
768 evdev_send_mt_autorel(evdev);
769 if (type == EV_SYN && code == SYN_REPORT && evdev->ev_report_opened &&
770 bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT))
771 evdev_send_mt_compat(evdev);
772 evdev_send_event(evdev, type, code, value);
780 evdev_inject_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
787 /* evdev repeats should not be processed by hardware driver */
788 if (bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT))
795 if (evdev->ev_methods != NULL &&
796 evdev->ev_methods->ev_event != NULL)
797 evdev->ev_methods->ev_event(evdev, evdev->ev_softc,
800 * Leds and driver repeats should be reported in ev_event
801 * method body to interoperate with kbdmux states and rates
802 * propagation so both ways (ioctl and evdev) of changing it
803 * will produce only one evdev event report to client.
805 if (type == EV_LED || type == EV_REP)
814 ret = evdev_push_event(evdev, type, code, value);
825 evdev_register_client(struct evdev_dev *evdev, struct evdev_client *client)
829 debugf(evdev, "adding new client for device %s", evdev->ev_shortname);
831 EVDEV_LOCK_ASSERT(evdev);
833 if (LIST_EMPTY(&evdev->ev_clients) && evdev->ev_methods != NULL &&
834 evdev->ev_methods->ev_open != NULL) {
835 debugf(evdev, "calling ev_open() on device %s",
836 evdev->ev_shortname);
837 ret = evdev->ev_methods->ev_open(evdev, evdev->ev_softc);
840 LIST_INSERT_HEAD(&evdev->ev_clients, client, ec_link);
845 evdev_dispose_client(struct evdev_dev *evdev, struct evdev_client *client)
847 debugf(evdev, "removing client for device %s", evdev->ev_shortname);
849 EVDEV_LOCK_ASSERT(evdev);
851 LIST_REMOVE(client, ec_link);
852 if (LIST_EMPTY(&evdev->ev_clients)) {
853 if (evdev->ev_methods != NULL &&
854 evdev->ev_methods->ev_close != NULL)
855 evdev->ev_methods->ev_close(evdev, evdev->ev_softc);
856 if (evdev_event_supported(evdev, EV_REP) &&
857 bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT))
858 evdev_stop_repeat(evdev);
860 evdev_release_client(evdev, client);
864 evdev_grab_client(struct evdev_dev *evdev, struct evdev_client *client)
867 EVDEV_LOCK_ASSERT(evdev);
869 if (evdev->ev_grabber != NULL)
872 evdev->ev_grabber = client;
878 evdev_release_client(struct evdev_dev *evdev, struct evdev_client *client)
881 EVDEV_LOCK_ASSERT(evdev);
883 if (evdev->ev_grabber != client)
886 evdev->ev_grabber = NULL;
892 evdev_repeat_callout(void *arg)
894 struct evdev_dev *evdev = (struct evdev_dev *)arg;
896 evdev_send_event(evdev, EV_KEY, evdev->ev_rep_key, KEY_EVENT_REPEAT);
897 evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1);
899 if (evdev->ev_rep[REP_PERIOD])
900 callout_reset(&evdev->ev_rep_callout,
901 evdev->ev_rep[REP_PERIOD] * hz / 1000,
902 evdev_repeat_callout, evdev);
904 evdev->ev_rep_key = KEY_RESERVED;
908 evdev_start_repeat(struct evdev_dev *evdev, uint16_t key)
911 EVDEV_LOCK_ASSERT(evdev);
913 if (evdev->ev_rep[REP_DELAY]) {
914 evdev->ev_rep_key = key;
915 callout_reset(&evdev->ev_rep_callout,
916 evdev->ev_rep[REP_DELAY] * hz / 1000,
917 evdev_repeat_callout, evdev);
922 evdev_stop_repeat(struct evdev_dev *evdev)
925 EVDEV_LOCK_ASSERT(evdev);
927 if (evdev->ev_rep_key != KEY_RESERVED) {
928 callout_stop(&evdev->ev_rep_callout);
929 evdev->ev_rep_key = KEY_RESERVED;
933 MODULE_VERSION(evdev, 1);