aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/input/ukbd.c
diff options
context:
space:
mode:
authorVladimir Kondratyev <wulf@FreeBSD.org>2018-08-13 19:05:53 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2018-08-13 19:05:53 +0000
commit48f2b006486019a1a238238ba32875a2c1ce16a0 (patch)
tree4f6588852eec9128bcf6be3014baa737f7935c65 /sys/dev/usb/input/ukbd.c
parent911aed94fa3a6b7c99aae26c48c0724ada8ab787 (diff)
downloadsrc-48f2b006486019a1a238238ba32875a2c1ce16a0.tar.gz
src-48f2b006486019a1a238238ba32875a2c1ce16a0.zip
evdev: Remove evdev.ko linkage dependency on kbd driver
Move evdev_ev_kbd_event() helper from evdev to kbd.c as otherwise evdev unconditionally requires all keyboard and console stuff to be compiled into the kernel. This dependency happens as evdev_ev_kbd_event() helper references kbdsw global variable defined in kbd.c through use of kbdd_ioctl() macro. While here make all keyboard drivers respect evdev_rcpt_mask while setting typematic rate and LEDs with evdev interface. Requested by: Milan Obuch <bsd@dino.sk> Reviewed by: hselasky, gonzo Differential Revision: https://reviews.freebsd.org/D16614
Notes
Notes: svn path=/head/; revision=337721
Diffstat (limited to 'sys/dev/usb/input/ukbd.c')
-rw-r--r--sys/dev/usb/input/ukbd.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index 072e374ed5dd..f35652c663dc 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -365,8 +365,10 @@ static device_detach_t ukbd_detach;
static device_resume_t ukbd_resume;
#ifdef EVDEV_SUPPORT
+static evdev_event_t ukbd_ev_event;
+
static const struct evdev_methods ukbd_evdev_methods = {
- .ev_event = evdev_ev_kbd_event,
+ .ev_event = ukbd_ev_event,
};
#endif
@@ -1472,6 +1474,22 @@ ukbd_resume(device_t dev)
return (0);
}
+#ifdef EVDEV_SUPPORT
+static void
+ukbd_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
+ int32_t value)
+{
+ keyboard_t *kbd = evdev_get_softc(evdev);
+
+ if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD &&
+ (type == EV_LED || type == EV_REP)) {
+ mtx_lock(&Giant);
+ kbd_ev_event(kbd, type, code, value);
+ mtx_unlock(&Giant);
+ }
+}
+#endif
+
/* early keyboard probe, not supported */
static int
ukbd_configure(int flags)