MFC r306530, r306531, r306532, r306579:
r306530: Declare a module for evdev and add dependency to ukbd(4) and ums(4) Prepare for making evdev a module. "Pure" evdev device drivers (like touchscreen) and evdev itself can be built as a modules regardless of "options EVDEV" in kernel config. So if people does not require evdev functionality in hybrid drivers like ums and ukbd they can, for instance, kldload evdev and utouchscreen to run FreeBSD in kiosk mode. r306531: Add dependency to evdev module (if required) r306532: Add dependency to evdev module r306579: Modularize evdev - Convert "options EVDEV" to "device evdev" and "device uinput", add modules for both new devices. They are isolated subsystems and do not require any compile-time changes to general kernel subsytems - For hybrid drivers that have evdev as an optional way to deliver input events add option EVDEV_SUPPORT. Update all existing hybrid drivers to use it instead of EVDEV - Remove no-op DECLARE_MODULE in evdev, it's not required, MODULE_VERSION is enough - Add evdev module dependency to uinput Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
This commit is contained in:
parent
49c4c7e411
commit
885af1a317
@ -335,3 +335,4 @@ static driver_t ft5406ts_driver = {
|
||||
};
|
||||
|
||||
DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0);
|
||||
MODULE_DEPEND(ft5406ts, evdev, 1, 1, 1);
|
||||
|
@ -135,4 +135,4 @@ device ukbd
|
||||
device kbdmux
|
||||
|
||||
# Uncomment to enable evdev support for ti_adc
|
||||
# options EVDEV
|
||||
# options EVDEV_SUPPORT
|
||||
|
@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
#include <dev/evdev/input.h>
|
||||
#include <dev/evdev/evdev.h>
|
||||
#endif
|
||||
@ -89,7 +89,7 @@ static int ti_adc_samples[5] = { 0, 2, 4, 8, 16 };
|
||||
|
||||
static int ti_adc_detach(device_t dev);
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
static void
|
||||
ti_adc_ev_report(struct ti_adc_softc *sc)
|
||||
{
|
||||
@ -472,7 +472,7 @@ ti_adc_tsc_read_data(struct ti_adc_softc *sc)
|
||||
device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y);
|
||||
#endif
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if ((sc->sc_x != x) || (sc->sc_y != y)) {
|
||||
sc->sc_x = x;
|
||||
sc->sc_y = y;
|
||||
@ -516,7 +516,7 @@ ti_adc_intr(void *arg)
|
||||
status |= ADC_IRQ_HW_PEN_ASYNC;
|
||||
ADC_WRITE4(sc, ADC_IRQENABLE_CLR,
|
||||
ADC_IRQ_HW_PEN_ASYNC);
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
ti_adc_ev_report(sc);
|
||||
#endif
|
||||
}
|
||||
@ -524,7 +524,7 @@ ti_adc_intr(void *arg)
|
||||
if (rawstatus & ADC_IRQ_PEN_UP) {
|
||||
sc->sc_pen_down = 0;
|
||||
status |= ADC_IRQ_PEN_UP;
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
ti_adc_ev_report(sc);
|
||||
#endif
|
||||
}
|
||||
@ -874,7 +874,7 @@ ti_adc_attach(device_t dev)
|
||||
ti_adc_setup(sc);
|
||||
TI_ADC_UNLOCK(sc);
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (sc->sc_tsc_wires > 0) {
|
||||
sc->sc_evdev = evdev_alloc();
|
||||
evdev_set_name(sc->sc_evdev, device_get_desc(dev));
|
||||
@ -921,7 +921,7 @@ ti_adc_detach(device_t dev)
|
||||
ti_adc_reset(sc);
|
||||
ti_adc_setup(sc);
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
evdev_free(sc->sc_evdev);
|
||||
#endif
|
||||
|
||||
@ -958,3 +958,6 @@ static devclass_t ti_adc_devclass;
|
||||
DRIVER_MODULE(ti_adc, simplebus, ti_adc_driver, ti_adc_devclass, 0, 0);
|
||||
MODULE_VERSION(ti_adc, 1);
|
||||
MODULE_DEPEND(ti_adc, simplebus, 1, 1, 1);
|
||||
#ifdef EVDEV_SUPPORT
|
||||
MODULE_DEPEND(ti_adc, evdev, 1, 1, 1);
|
||||
#endif
|
||||
|
@ -55,7 +55,7 @@ struct ti_adc_softc {
|
||||
int sc_yn_bit, sc_yn_inp;
|
||||
uint32_t sc_tsc_enabled;
|
||||
int sc_pen_down;
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
int sc_x;
|
||||
int sc_y;
|
||||
struct evdev_dev *sc_evdev;
|
||||
|
@ -3064,6 +3064,8 @@ options GZIO
|
||||
options BHND_LOGLEVEL # Logging threshold level
|
||||
|
||||
# evdev interface
|
||||
options EVDEV
|
||||
options EVDEV_DEBUG
|
||||
options UINPUT_DEBUG
|
||||
device evdev # input event device support
|
||||
options EVDEV_SUPPORT # evdev support in legacy drivers
|
||||
options EVDEV_DEBUG # enable event debug msgs
|
||||
device uinput # install /dev/uinput cdev
|
||||
options UINPUT_DEBUG # enable uinput debug msgs
|
||||
|
@ -988,6 +988,6 @@ BHND_LOGLEVEL opt_global.h
|
||||
GPIO_SPI_DEBUG opt_gpio.h
|
||||
|
||||
# evdev protocol support
|
||||
EVDEV opt_evdev.h
|
||||
EVDEV_SUPPORT opt_evdev.h
|
||||
EVDEV_DEBUG opt_evdev.h
|
||||
UINPUT_DEBUG opt_evdev.h
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/bitstring.h>
|
||||
@ -916,3 +917,5 @@ evdev_stop_repeat(struct evdev_dev *evdev)
|
||||
evdev->ev_rep_key = KEY_RESERVED;
|
||||
}
|
||||
}
|
||||
|
||||
MODULE_VERSION(evdev, 1);
|
||||
|
@ -708,3 +708,5 @@ uinput_modevent(module_t mod __unused, int cmd, void *data)
|
||||
}
|
||||
|
||||
DEV_MODULE(uinput, uinput_modevent, NULL);
|
||||
MODULE_VERSION(uinput, 1);
|
||||
MODULE_DEPEND(uinput, evdev, 1, 1, 1);
|
||||
|
@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/usb/quirk/usb_quirk.h>
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
#include <dev/evdev/input.h>
|
||||
#include <dev/evdev/evdev.h>
|
||||
#endif
|
||||
@ -168,7 +168,7 @@ struct ukbd_softc {
|
||||
struct usb_device *sc_udev;
|
||||
struct usb_interface *sc_iface;
|
||||
struct usb_xfer *sc_xfer[UKBD_N_TRANSFER];
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
struct evdev_dev *sc_evdev;
|
||||
#endif
|
||||
|
||||
@ -386,7 +386,7 @@ static device_attach_t ukbd_attach;
|
||||
static device_detach_t ukbd_detach;
|
||||
static device_resume_t ukbd_resume;
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
static struct evdev_methods ukbd_evdev_methods = {
|
||||
.ev_event = evdev_ev_kbd_event,
|
||||
};
|
||||
@ -420,7 +420,7 @@ ukbd_put_key(struct ukbd_softc *sc, uint32_t key)
|
||||
DPRINTF("0x%02x (%d) %s\n", key, key,
|
||||
(key & KEY_RELEASE) ? "released" : "pressed");
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) {
|
||||
evdev_push_event(sc->sc_evdev, EV_KEY,
|
||||
evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE));
|
||||
@ -941,7 +941,7 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
if (!any)
|
||||
break;
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (sc->sc_evdev != NULL)
|
||||
evdev_push_leds(sc->sc_evdev, sc->sc_leds);
|
||||
#endif
|
||||
@ -1221,7 +1221,7 @@ ukbd_attach(device_t dev)
|
||||
usb_error_t err;
|
||||
uint16_t n;
|
||||
uint16_t hid_len;
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
struct evdev_dev *evdev;
|
||||
int i;
|
||||
#endif
|
||||
@ -1340,7 +1340,7 @@ ukbd_attach(device_t dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
evdev = evdev_alloc();
|
||||
evdev_set_name(evdev, device_get_desc(dev));
|
||||
evdev_set_phys(evdev, device_get_nameunit(dev));
|
||||
@ -1441,7 +1441,7 @@ ukbd_detach(device_t dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
evdev_free(sc->sc_evdev);
|
||||
#endif
|
||||
|
||||
@ -1976,7 +1976,7 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
else
|
||||
kbd->kb_delay1 = ((int *)arg)[0];
|
||||
kbd->kb_delay2 = ((int *)arg)[1];
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (sc->sc_evdev != NULL)
|
||||
evdev_push_repeats(sc->sc_evdev, kbd);
|
||||
#endif
|
||||
@ -2128,7 +2128,7 @@ ukbd_set_leds(struct ukbd_softc *sc, uint8_t leds)
|
||||
static int
|
||||
ukbd_set_typematic(keyboard_t *kbd, int code)
|
||||
{
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
struct ukbd_softc *sc = kbd->kb_data;
|
||||
#endif
|
||||
static const int delays[] = {250, 500, 750, 1000};
|
||||
@ -2142,7 +2142,7 @@ ukbd_set_typematic(keyboard_t *kbd, int code)
|
||||
}
|
||||
kbd->kb_delay1 = delays[(code >> 5) & 3];
|
||||
kbd->kb_delay2 = rates[code & 0x1f];
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (sc->sc_evdev != NULL)
|
||||
evdev_push_repeats(sc->sc_evdev, kbd);
|
||||
#endif
|
||||
@ -2297,5 +2297,8 @@ static driver_t ukbd_driver = {
|
||||
|
||||
DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0);
|
||||
MODULE_DEPEND(ukbd, usb, 1, 1, 1);
|
||||
#ifdef EVDEV_SUPPORT
|
||||
MODULE_DEPEND(ukbd, evdev, 1, 1, 1);
|
||||
#endif
|
||||
MODULE_VERSION(ukbd, 1);
|
||||
USB_PNP_HOST_INFO(ukbd_devs);
|
||||
|
@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/usb/quirk/usb_quirk.h>
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
#include <dev/evdev/input.h>
|
||||
#include <dev/evdev/evdev.h>
|
||||
#endif
|
||||
@ -142,7 +142,7 @@ struct ums_softc {
|
||||
|
||||
int sc_pollrate;
|
||||
int sc_fflags;
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
int sc_evflags;
|
||||
#define UMS_EVDEV_OPENED 1
|
||||
#endif
|
||||
@ -151,7 +151,7 @@ struct ums_softc {
|
||||
uint8_t sc_iid;
|
||||
uint8_t sc_temp[64];
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
struct evdev_dev *sc_evdev;
|
||||
#endif
|
||||
};
|
||||
@ -170,7 +170,7 @@ static usb_fifo_open_t ums_fifo_open;
|
||||
static usb_fifo_close_t ums_fifo_close;
|
||||
static usb_fifo_ioctl_t ums_fifo_ioctl;
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
static evdev_open_t ums_ev_open;
|
||||
static evdev_close_t ums_ev_close;
|
||||
#endif
|
||||
@ -190,7 +190,7 @@ static struct usb_fifo_methods ums_fifo_methods = {
|
||||
.basename[0] = "ums",
|
||||
};
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
static struct evdev_methods ums_evdev_methods = {
|
||||
.ev_open = &ums_ev_open,
|
||||
.ev_close = &ums_ev_close,
|
||||
@ -357,7 +357,7 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
tr_setup:
|
||||
/* check if we can put more data into the FIFO */
|
||||
if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) == 0) {
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (sc->sc_evflags == 0)
|
||||
break;
|
||||
#else
|
||||
@ -690,7 +690,7 @@ ums_attach(device_t dev)
|
||||
if (err)
|
||||
goto detach;
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
sc->sc_evdev = evdev_alloc();
|
||||
evdev_set_name(sc->sc_evdev, device_get_desc(dev));
|
||||
evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev));
|
||||
@ -750,7 +750,7 @@ ums_detach(device_t self)
|
||||
|
||||
usb_fifo_detach(&sc->sc_fifo);
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
evdev_free(sc->sc_evdev);
|
||||
#endif
|
||||
|
||||
@ -892,7 +892,7 @@ ums_put_queue(struct ums_softc *sc, int32_t dx, int32_t dy,
|
||||
usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf,
|
||||
sc->sc_mode.packetsize, 1);
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) {
|
||||
/* Push evdev event */
|
||||
evdev_push_event(sc->sc_evdev, EV_REL, REL_X, dx);
|
||||
@ -919,7 +919,7 @@ ums_reset_buf(struct ums_softc *sc)
|
||||
usb_fifo_reset(sc->sc_fifo.fp[USB_FIFO_RX]);
|
||||
}
|
||||
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
static int
|
||||
ums_ev_open(struct evdev_dev *evdev, void *ev_softc)
|
||||
{
|
||||
@ -967,7 +967,7 @@ ums_fifo_open(struct usb_fifo *fifo, int fflags)
|
||||
return (EBUSY);
|
||||
|
||||
/* check for first open */
|
||||
#ifdef EVDEV
|
||||
#ifdef EVDEV_SUPPORT
|
||||
if (sc->sc_fflags == 0 && sc->sc_evflags == 0)
|
||||
ums_reset(sc);
|
||||
#else
|
||||
@ -1199,5 +1199,8 @@ static driver_t ums_driver = {
|
||||
|
||||
DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0);
|
||||
MODULE_DEPEND(ums, usb, 1, 1, 1);
|
||||
#ifdef EVDEV_SUPPORT
|
||||
MODULE_DEPEND(ums, evdev, 1, 1, 1);
|
||||
#endif
|
||||
MODULE_VERSION(ums, 1);
|
||||
USB_PNP_HOST_INFO(ums_devs);
|
||||
|
@ -111,6 +111,7 @@ SUBDIR= \
|
||||
${_epic} \
|
||||
esp \
|
||||
${_et} \
|
||||
evdev \
|
||||
${_ex} \
|
||||
${_exca} \
|
||||
ext2fs \
|
||||
@ -373,6 +374,7 @@ SUBDIR= \
|
||||
udf \
|
||||
udf_iconv \
|
||||
ufs \
|
||||
uinput \
|
||||
unionfs \
|
||||
urtwn \
|
||||
${_urtwnfw} \
|
||||
|
9
sys/modules/evdev/Makefile
Normal file
9
sys/modules/evdev/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/evdev
|
||||
|
||||
KMOD= evdev
|
||||
SRCS= cdev.c evdev.c evdev_mt.c evdev_utils.c
|
||||
SRCS+= opt_evdev.h bus_if.h device_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
9
sys/modules/uinput/Makefile
Normal file
9
sys/modules/uinput/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/evdev
|
||||
|
||||
KMOD= uinput
|
||||
SRCS= uinput.c
|
||||
SRCS+= opt_evdev.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
Loading…
x
Reference in New Issue
Block a user