From owner-svn-src-all@freebsd.org Sun Oct 2 03:20:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A41B8AC4601; Sun, 2 Oct 2016 03:20:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FF202F5; Sun, 2 Oct 2016 03:20:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u923KWDf051359; Sun, 2 Oct 2016 03:20:32 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u923KV5r051346; Sun, 2 Oct 2016 03:20:31 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610020320.u923KV5r051346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 2 Oct 2016 03:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306579 - in head/sys: arm/conf arm/ti conf dev/evdev dev/usb/input modules modules/evdev modules/uinput X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2016 03:20:33 -0000 Author: gonzo Date: Sun Oct 2 03:20:31 2016 New Revision: 306579 URL: https://svnweb.freebsd.org/changeset/base/306579 Log: 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 Added: head/sys/modules/evdev/ head/sys/modules/evdev/Makefile (contents, props changed) head/sys/modules/uinput/ head/sys/modules/uinput/Makefile (contents, props changed) Modified: head/sys/arm/conf/BEAGLEBONE head/sys/arm/ti/ti_adc.c head/sys/arm/ti/ti_adcvar.h head/sys/conf/NOTES head/sys/conf/options head/sys/dev/evdev/evdev.c head/sys/dev/evdev/uinput.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c head/sys/modules/Makefile Modified: head/sys/arm/conf/BEAGLEBONE ============================================================================== --- head/sys/arm/conf/BEAGLEBONE Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/arm/conf/BEAGLEBONE Sun Oct 2 03:20:31 2016 (r306579) @@ -133,4 +133,4 @@ device ukbd device kbdmux # Uncomment to enable evdev support for ti_adc -# options EVDEV +# options EVDEV_SUPPORT Modified: head/sys/arm/ti/ti_adc.c ============================================================================== --- head/sys/arm/ti/ti_adc.c Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/arm/ti/ti_adc.c Sun Oct 2 03:20:31 2016 (r306579) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef EVDEV +#ifdef EVDEV_SUPPORT #include #include #endif @@ -89,7 +89,7 @@ static int ti_adc_samples[5] = { 0, 2, 4 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 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,6 +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 +#ifdef EVDEV_SUPPORT MODULE_DEPEND(ti_adc, evdev, 1, 1, 1); #endif Modified: head/sys/arm/ti/ti_adcvar.h ============================================================================== --- head/sys/arm/ti/ti_adcvar.h Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/arm/ti/ti_adcvar.h Sun Oct 2 03:20:31 2016 (r306579) @@ -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; Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/conf/NOTES Sun Oct 2 03:20:31 2016 (r306579) @@ -3054,6 +3054,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 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/conf/options Sun Oct 2 03:20:31 2016 (r306579) @@ -989,6 +989,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 Modified: head/sys/dev/evdev/evdev.c ============================================================================== --- head/sys/dev/evdev/evdev.c Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/dev/evdev/evdev.c Sun Oct 2 03:20:31 2016 (r306579) @@ -918,22 +918,4 @@ evdev_stop_repeat(struct evdev_dev *evde } } -static int -evdev_modevent(module_t mod, int type, void *unused) -{ - switch (type) { - case MOD_LOAD: - return 0; - case MOD_UNLOAD: - return 0; - } - return EINVAL; -} - -static moduledata_t evdev_mod = { - "evdev", - evdev_modevent, - 0 -}; -DECLARE_MODULE(evdev, evdev_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(evdev, 1); Modified: head/sys/dev/evdev/uinput.c ============================================================================== --- head/sys/dev/evdev/uinput.c Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/dev/evdev/uinput.c Sun Oct 2 03:20:31 2016 (r306579) @@ -708,3 +708,5 @@ uinput_modevent(module_t mod __unused, i } DEV_MODULE(uinput, uinput_modevent, NULL); +MODULE_VERSION(uinput, 1); +MODULE_DEPEND(uinput, evdev, 1, 1, 1); Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/dev/usb/input/ukbd.c Sun Oct 2 03:20:31 2016 (r306579) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #include -#ifdef EVDEV +#ifdef EVDEV_SUPPORT #include #include #endif @@ -166,7 +166,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 @@ -363,7 +363,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, }; @@ -403,7 +403,7 @@ ukbd_put_key(struct ukbd_softc *sc, uint 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)); @@ -931,7 +931,7 @@ ukbd_set_leds_callback(struct usb_xfer * if (!any) break; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_evdev != NULL) evdev_push_leds(sc->sc_evdev, sc->sc_leds); #endif @@ -1211,7 +1211,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 @@ -1330,7 +1330,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)); @@ -1431,7 +1431,7 @@ ukbd_detach(device_t dev) } #endif -#ifdef EVDEV +#ifdef EVDEV_SUPPORT evdev_free(sc->sc_evdev); #endif @@ -1952,7 +1952,7 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_lon */ kbd->kb_delay1 = imax(((int *)arg)[0], 250); kbd->kb_delay2 = imax(((int *)arg)[1], 34); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_evdev != NULL) evdev_push_repeats(sc->sc_evdev, kbd); #endif @@ -2104,7 +2104,7 @@ ukbd_set_leds(struct ukbd_softc *sc, uin 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}; @@ -2118,7 +2118,7 @@ ukbd_set_typematic(keyboard_t *kbd, int } 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 @@ -2300,7 +2300,7 @@ 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 +#ifdef EVDEV_SUPPORT MODULE_DEPEND(ukbd, evdev, 1, 1, 1); #endif MODULE_VERSION(ukbd, 1); Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/dev/usb/input/ums.c Sun Oct 2 03:20:31 2016 (r306579) @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #include -#ifdef EVDEV +#ifdef EVDEV_SUPPORT #include #include #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_ .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, 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, int3 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 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,7 +1199,7 @@ static driver_t ums_driver = { DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); MODULE_DEPEND(ums, usb, 1, 1, 1); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT MODULE_DEPEND(ums, evdev, 1, 1, 1); #endif MODULE_VERSION(ums, 1); Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Oct 2 03:06:58 2016 (r306578) +++ head/sys/modules/Makefile Sun Oct 2 03:20:31 2016 (r306579) @@ -111,6 +111,7 @@ SUBDIR= \ ${_epic} \ esp \ ${_et} \ + evdev \ ${_ex} \ ${_exca} \ ext2fs \ @@ -371,6 +372,7 @@ SUBDIR= \ udf \ udf_iconv \ ufs \ + uinput \ unionfs \ urtwn \ ${_urtwnfw} \ Added: head/sys/modules/evdev/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/evdev/Makefile Sun Oct 2 03:20:31 2016 (r306579) @@ -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 Added: head/sys/modules/uinput/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/uinput/Makefile Sun Oct 2 03:20:31 2016 (r306579) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/evdev + +KMOD= uinput +SRCS= uinput.c +SRCS+= opt_evdev.h + +.include