Index: x11-servers/xephyr/Makefile =================================================================== --- x11-servers/xephyr/Makefile (revision 435783) +++ x11-servers/xephyr/Makefile (working copy) @@ -16,8 +16,6 @@ DESCR= ${.CURDIR}/pkg-descr SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID - USE_XORG= x11 xcb CONFIGURE_ARGS+=--enable-xephyr --disable-dmx --disable-xnest --disable-xvfb \ Index: x11-servers/xorg-dmx/Makefile =================================================================== --- x11-servers/xorg-dmx/Makefile (revision 435783) +++ x11-servers/xorg-dmx/Makefile (working copy) @@ -11,8 +11,6 @@ DESCR= ${.CURDIR}/pkg-descr SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID - USE_XORG= dmx dmxproto x11 xaw7 xext xfixes xi xmu xpm xrender xres xt xtst CONFIGURE_ARGS+=--enable-dmx --disable-xephyr --disable-xnest --disable-xvfb \ Index: x11-servers/xorg-nestserver/Makefile =================================================================== --- x11-servers/xorg-nestserver/Makefile (revision 435783) +++ x11-servers/xorg-nestserver/Makefile (working copy) @@ -2,7 +2,6 @@ # $FreeBSD$ PORTNAME= xorg-nestserver -PORTVERSION= 1.19.1 PORTEPOCH= 2 COMMENT= Nesting X server from X.Org @@ -11,16 +10,12 @@ MASTERDIR= ${.CURDIR}/../xorg-server DESCR= ${.CURDIR}/pkg-descr -DISTINFO_FILE= ${.CURDIR}/distinfo -PATCHDIR= ${.CURDIR}/files RUN_DEPENDS= xkeyboard-config>=2.5:x11/xkeyboard-config SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID +USE_XORG= x11 xext -USE_XORG= x11 xext xfont2 - CONFIGURE_ARGS+=--enable-xnest --disable-dmx --disable-xephyr --disable-xvfb \ --disable-xwayland Index: x11-servers/xorg-nestserver/distinfo =================================================================== --- x11-servers/xorg-nestserver/distinfo (revision 435783) +++ x11-servers/xorg-nestserver/distinfo (nonexistent) @@ -1,3 +0,0 @@ -TIMESTAMP = 1484388904 -SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb -SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792 Property changes on: x11-servers/xorg-nestserver/distinfo ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/Makefile =================================================================== --- x11-servers/xorg-server/Makefile (revision 435783) +++ x11-servers/xorg-server/Makefile (working copy) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME?= xorg-server -PORTVERSION?= 1.18.4 +PORTVERSION?= 1.19.2 PORTREVISION?= 0 PORTEPOCH?= 1 CATEGORIES= x11-servers @@ -23,17 +23,28 @@ OPTIONS_SUB= yes OPTIONS_DEFINE= SUID OPTIONS_RADIO= CONF -OPTIONS_RADIO_CONF= DEVD HAL -DEVD_DESC= Use devd for autoconfiguration of input devices -HAL_DESC= Use hald for autoconfiguration of input devices -SUID_DESC= Install the Xorg server with setuid bit set -OPTIONS_DEFAULT=DEVD SUID +OPTIONS_RADIO_CONF= DEVD HAL UDEV +OPTIONS_DEFAULT= DEVD SUID +SUID_DESC= Install setuid wrapper to allow startx as non-root +CONF_DESC= Backend to use for input device configuration +DEVD_DESC= Use devd (native) +HAL_DESC= Use HAL (deprecated) +UDEV_DESC= Use udev via libudev-devd (experimental) + OPTIONS_EXCLUDE_sparc64= HAL -.include +DEVD_CONFIGURE_ENABLE= config-devd +HAL_CONFIGURE_ENABLE= config-hal +HAL_LIB_DEPENDS= libhal.so:sysutils/hal \ + libdbus-1.so:devel/dbus +SUID_CONFIGURE_ENABLE= suid-wrapper +SUID_CONFIGURE_ON= --libexecdir=${PREFIX}/bin # set SUID_WRAPPER_DIR +UDEV_CONFIGURE_ENABLE= config-udev +UDEV_CONFIGURE_ON= --disable-config-udev-kms +UDEV_LIB_DEPENDS= libudev.so:devel/libudev-devd -USES= gmake libtool perl5 ssl tar:bzip2 +USES= autoreconf gmake perl5 ssl USE_PERL5= build USE_GL+= gl USE_XORG+= bigreqsproto compositeproto damageproto dri2proto dri3proto \ @@ -40,12 +51,11 @@ fixesproto fontsproto glproto inputproto kbproto pixman \ presentproto randrproto recordproto renderproto \ resourceproto scrnsaverproto videoproto xau \ - xcmiscproto xdmcp xextproto xf86driproto xfont \ + xcmiscproto xdmcp xextproto xf86driproto xfont2 \ xineramaproto xkbfile xproto xshmfence xtrans CONFIGURE_ARGS+=--without-doxygen --without-xmlto --without-fop \ - --localstatedir=/var --with-shared-memory-dir=/tmp \ - --disable-config-udev --disable-config-udev-kms \ - --without-dtrace --enable-glamor + --without-dtrace --with-shared-memory-dir=/tmp \ + --disable-install-setuid INSTALL_TARGET= install-strip .if ${SLAVE_PORT} == "no" || ${PORTNAME} == "xephyr" || ${PORTNAME} == "xwayland" @@ -62,9 +72,9 @@ --disable-xwayland SUB_FILES= pkg-install pkg-deinstall .else -CONFIGURE_ARGS+=--disable-xorg -# for slave ports we need to overwrite PLIST, so it doesn't overwrite -# PLIST_FILES, with the masterport plist. +CONFIGURE_ARGS+= --disable-xorg +OPTIONS_EXCLUDE= DEVD HAL UDEV SUID +# Set PLIST for slave ports so they only need to set PLIST_FILES PLIST= ${.CURDIR}/pkg-plist .endif @@ -77,16 +87,6 @@ CONFIGURE_ENV= SHA1_LIB="-L/usr/lib -lcrypto" SHA1_CFLAGS="-I/usr/include" .endif -.if ${PORT_OPTIONS:MHAL} -LIB_DEPENDS+= libhal.so:sysutils/hal -CONFIGURE_ARGS+= --enable-config-hal -.else -CONFIGURE_ARGS+= --disable-config-hal -.endif - -# We handle Xorg setuid in the plist. This allows to build xorg-server as a user. -CONFIGURE_ARGS+=--disable-install-setuid - .if ${ARCH} == "i386" || ${ARCH} == "amd64" LIB_DEPENDS+= libunwind.so:devel/libunwind .endif @@ -97,39 +97,15 @@ PLIST_SUB+= SPARC64="@comment " .endif -.if ${PORT_OPTIONS:MSUID} -pre-everything:: - @${ECHO_MSG} "By default, the X Server installs as a set-user-id root binary. When run by" - @${ECHO_MSG} "a normal user, it checks arguments and environment as done in the x11/wrapper" - @${ECHO_MSG} "port before handling them normally. If you are concerned about the security" - @${ECHO_MSG} "of this, but still want to run an X Server (for example using xdm/kdm/gdm," - @${ECHO_MSG} "which will still run the server as root), you can cancel the build and set" - @${ECHO_MSG} "xorg-server_UNSET=SUID in /etc/make.conf." -.endif - post-patch: @${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \ ${WRKSRC}/configure -# build libglx.so but don't install it yet. which is done in pre-install. - @${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \ - -e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \ - ${WRKSRC}/hw/xfree86/dixmods/Makefile.in -post-configure: -.if ${PORT_OPTIONS:MDEVD} - @${REINPLACE_CMD} -e 's|config\.c|config.c devd.c|g' \ - -e 's|config\.lo|config.lo devd.lo|g' \ - ${WRKSRC}/config/Makefile - @${REINPLACE_CMD} -e 's|^/\* #undef CONFIG_UDEV \*/|#define CONFIG_DEVD 1|' \ - ${WRKSRC}/include/dix-config.h -.endif - .if ${SLAVE_PORT} == "no" post-install: -# The .xorg dir because else the xorg-server might not load the correct -# libglx module. +# Avoid conflict with nvidia-driver, move libglx.so into .xorg directory @${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg - ${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \ + ${MV} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/libglx.so \ ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/ @${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d .endif # ! SLAVE_PORT Index: x11-servers/xorg-server/distinfo =================================================================== --- x11-servers/xorg-server/distinfo (revision 435783) +++ x11-servers/xorg-server/distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1484803304 -SHA256 (xorg/xserver/xorg-server-1.18.4.tar.bz2) = 278459b2c31d61a15655d95a72fb79930c480a6bb8cf9226e48a07df8b1d31c8 -SIZE (xorg/xserver/xorg-server-1.18.4.tar.bz2) = 6009508 +TIMESTAMP = 1488552223 +SHA256 (xorg/xserver/xorg-server-1.19.2.tar.bz2) = 4f8ab9f4a1a885fe7550080555381b34b82858582559e8e3c4da96e3a85884bb +SIZE (xorg/xserver/xorg-server-1.19.2.tar.bz2) = 5969543 Index: x11-servers/xorg-server/files/patch-config_Makefile.am =================================================================== --- x11-servers/xorg-server/files/patch-config_Makefile.am (nonexistent) +++ x11-servers/xorg-server/files/patch-config_Makefile.am (working copy) @@ -0,0 +1,16 @@ +* Build the devd config backend if activated +* +--- config/Makefile.am.orig 2017-03-10 14:14:25 UTC ++++ config/Makefile.am +@@ -4,6 +4,11 @@ noinst_LTLIBRARIES = libconfig.la + libconfig_la_SOURCES = config.c config-backends.h + libconfig_la_LIBADD = + ++if CONFIG_DEVD ++libconfig_la_SOURCES += devd.c ++libconfig_la_LIBADD += -lusbhid ++endif ++ + if NEED_DBUS + AM_CFLAGS += $(DBUS_CFLAGS) + libconfig_la_SOURCES += dbus-core.c Property changes on: x11-servers/xorg-server/files/patch-config_Makefile.am ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-config_Makefile.in =================================================================== --- x11-servers/xorg-server/files/patch-config_Makefile.in (nonexistent) +++ x11-servers/xorg-server/files/patch-config_Makefile.in (working copy) @@ -0,0 +1,91 @@ +* generated from patched Makefile.am; revise and regen instead of editing +* +* Build the devd config backend if activated +* +--- config/Makefile.in.orig 2017-03-10 14:14:25 UTC ++++ config/Makefile.in +@@ -89,16 +89,18 @@ PRE_UNINSTALL = : + POST_UNINSTALL = : + build_triplet = @build@ + host_triplet = @host@ +-@NEED_DBUS_TRUE@am__append_1 = $(DBUS_CFLAGS) +-@NEED_DBUS_TRUE@am__append_2 = dbus-core.c +-@NEED_DBUS_TRUE@am__append_3 = $(DBUS_LIBS) +-@CONFIG_UDEV_TRUE@am__append_4 = $(UDEV_CFLAGS) +-@CONFIG_UDEV_TRUE@am__append_5 = udev.c +-@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_LIBS) +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = $(HAL_CFLAGS) +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = hal.c +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_LIBS) +-@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_10 = wscons.c ++@CONFIG_DEVD_TRUE@am__append_1 = devd.c ++@CONFIG_DEVD_TRUE@am__append_2 = -lusbhid ++@NEED_DBUS_TRUE@am__append_3 = $(DBUS_CFLAGS) ++@NEED_DBUS_TRUE@am__append_4 = dbus-core.c ++@NEED_DBUS_TRUE@am__append_5 = $(DBUS_LIBS) ++@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_CFLAGS) ++@CONFIG_UDEV_TRUE@am__append_7 = udev.c ++@CONFIG_UDEV_TRUE@am__append_8 = $(UDEV_LIBS) ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_CFLAGS) ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_10 = hal.c ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_11 = $(HAL_LIBS) ++@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_12 = wscons.c + subdir = config + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ +@@ -126,16 +128,18 @@ am__DEPENDENCIES_1 = + @CONFIG_UDEV_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) + @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_4 = \ + @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_1) +-libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ +- $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +-am__libconfig_la_SOURCES_DIST = config.c config-backends.h dbus-core.c \ +- udev.c hal.c wscons.c +-@NEED_DBUS_TRUE@am__objects_1 = dbus-core.lo +-@CONFIG_UDEV_TRUE@am__objects_2 = udev.lo +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = hal.lo +-@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_4 = wscons.lo ++libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ ++ $(am__DEPENDENCIES_4) ++am__libconfig_la_SOURCES_DIST = config.c config-backends.h devd.c \ ++ dbus-core.c udev.c hal.c wscons.c ++@CONFIG_DEVD_TRUE@am__objects_1 = devd.lo ++@NEED_DBUS_TRUE@am__objects_2 = dbus-core.lo ++@CONFIG_UDEV_TRUE@am__objects_3 = udev.lo ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_4 = hal.lo ++@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_5 = wscons.lo + am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \ +- $(am__objects_3) $(am__objects_4) ++ $(am__objects_3) $(am__objects_4) $(am__objects_5) + libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS) + AM_V_lt = $(am__v_lt_@AM_V@) + am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +@@ -586,12 +590,14 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_4) \ +- $(am__append_7) ++AM_CFLAGS = $(DIX_CFLAGS) $(am__append_3) $(am__append_6) \ ++ $(am__append_9) + noinst_LTLIBRARIES = libconfig.la +-libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \ +- $(am__append_5) $(am__append_8) $(am__append_10) +-libconfig_la_LIBADD = $(am__append_3) $(am__append_6) $(am__append_9) ++libconfig_la_SOURCES = config.c config-backends.h $(am__append_1) \ ++ $(am__append_4) $(am__append_7) $(am__append_10) \ ++ $(am__append_12) ++libconfig_la_LIBADD = $(am__append_2) $(am__append_5) $(am__append_8) \ ++ $(am__append_11) + @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) + @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfd_DATA = 10-quirks.conf + EXTRA_DIST = x11-input.fdi fdi2iclass.py 10-quirks.conf +@@ -651,6 +657,7 @@ distclean-compile: + + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devd.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wscons.Plo@am__quote@ Property changes on: x11-servers/xorg-server/files/patch-config_Makefile.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-config_config-backends.h =================================================================== --- x11-servers/xorg-server/files/patch-config_config-backends.h (revision 435783) +++ x11-servers/xorg-server/files/patch-config_config-backends.h (working copy) @@ -1,11 +1,12 @@ ---- config/config-backends.h.orig 2016-07-15 16:17:45 UTC +* Define required functions for devd config backend +* +--- config/config-backends.h.orig 2017-03-02 23:03:58 UTC +++ config/config-backends.h -@@ -44,3 +44,8 @@ void config_hal_fini(void); +@@ -43,4 +43,7 @@ void config_hal_fini(void); + #elif defined(CONFIG_WSCONS) int config_wscons_init(void); void config_wscons_fini(void); - #endif -+ -+#ifdef CONFIG_DEVD ++#elif defined(CONFIG_DEVD) +int config_devd_init(void); +void config_devd_fini(void); -+#endif + #endif Index: x11-servers/xorg-server/files/patch-config_config.c =================================================================== --- x11-servers/xorg-server/files/patch-config_config.c (revision 435783) +++ x11-servers/xorg-server/files/patch-config_config.c (working copy) @@ -1,4 +1,6 @@ ---- config/config.c.orig 2016-07-19 17:07:29 UTC +* Call the devd config backend functions if activated +* +--- config/config.c.orig 2017-03-02 23:03:58 UTC +++ config/config.c @@ -55,6 +55,9 @@ config_init(void) #elif defined(CONFIG_WSCONS) Index: x11-servers/xorg-server/files/patch-config_devd.c =================================================================== --- x11-servers/xorg-server/files/patch-config_devd.c (revision 435783) +++ x11-servers/xorg-server/files/patch-config_devd.c (working copy) @@ -1,11 +1,13 @@ ---- config/devd.c.orig 2017-01-19 15:20:42 UTC +--- config/devd.c.orig 2017-03-10 14:14:25 UTC +++ config/devd.c -@@ -0,0 +1,532 @@ +@@ -0,0 +1,887 @@ +/* + * Copyright (c) 2012 Baptiste Daroussin + * Copyright (c) 2013, 2014 Alex Kozlov + * Copyright (c) 2014 Robert Millan + * Copyright (c) 2014 Jean-Sebastien Pedron ++ * Copyright (c) 2015 - 2017 Rozhuk Ivan ++ * Copyright (c) 2017 Matthew Rezny + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), @@ -39,8 +41,14 @@ +#include +#include +#include ++#include ++#include ++#include ++#include ++#include + +#include ++#include +#include +#include +#include @@ -47,6 +55,9 @@ +#include +#include +#include ++#include ++#include ++#include + +#include "input.h" +#include "inputstr.h" @@ -54,440 +65,768 @@ +#include "config-backends.h" +#include "os.h" + -+#define DEVD_SOCK_PATH "/var/run/devd.pipe" ++/* from: */ ++#define _IOC_READ IOC_OUT ++struct input_id { ++ uint16_t bustype; ++ uint16_t vendor; ++ uint16_t product; ++ uint16_t version; ++}; + ++#define EVIOCGBIT(ev, len) _IOC(_IOC_READ, 'E', 0x20 + (ev), (len)) ++#define EVIOCGID _IOR('E', 0x02, struct input_id) ++#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, (len)) ++#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, (len)) ++ ++#define EV_KEY 0x01 ++#define EV_REL 0x02 ++#define EV_ABS 0x03 ++#define BTN_MISC 0x100 ++#define BTN_LEFT 0x110 ++#define BTN_RIGHT 0x111 ++#define BTN_MIDDLE 0x112 ++#define BTN_JOYSTICK 0x120 ++#define BTN_TOOL_PEN 0x140 ++#define BTN_TOOL_FINGER 0x145 ++#define BTN_TOUCH 0x14a ++#define BTN_STYLUS 0x14b ++#define BTN_STYLUS2 0x14c ++#define KEY_MAX 0x2ff ++#define KEY_CNT (KEY_MAX + 1) ++#define REL_X 0x00 ++#define REL_Y 0x01 ++#define REL_MAX 0x0f ++#define REL_CNT (REL_MAX + 1) ++#define ABS_X 0x00 ++#define ABS_Y 0x01 ++#define ABS_PRESSURE 0x18 ++#define ABS_MT_SLOT 0x2f ++#define ABS_MAX 0x3f ++#define ABS_CNT (ABS_MAX + 1) ++ ++#define U32_BITS (sizeof(uint32_t) * 8) ++#define U32_CNT(__x) (((__x) + U32_BITS - 1) / U32_BITS) ++#define U32_IS_BIT_SET(__x, __bit) (((((const uint32_t*)(__x))[((__bit) >> 5)] >> ((__bit) & 0x1f))) & 0x01) ++ ++/* from: */ ++#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ ++ ++/* WebCamD specific. */ ++#define WEBCAMD_IOCTL_GET_USB_VENDOR_ID _IOR('q', 250, unsigned short) ++#define WEBCAMD_IOCTL_GET_USB_PRODUCT_ID _IOR('q', 251, unsigned short) ++#define WEBCAMD_IOCTL_GET_USB_SPEED _IOR('q', 252, unsigned int) ++ ++#ifdef COMPAT_32BIT ++ #define hid_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) ++#else ++ #define hid_pass_ptr(ptr) (ptr) ++#endif ++ ++#define _PATH_DEV_LEN (sizeof(_PATH_DEV) - 1) ++#define DEVD_PATH_DEV "devd:" _PATH_DEV ++#define DEVD_PATH_DEV_LEN (sizeof(DEVD_PATH_DEV) - 1) ++ ++#define DEVD_SOCK_PATH _PATH_VARRUN "devd.pipe" ++ +#define DEVD_EVENT_ADD '+' +#define DEVD_EVENT_REMOVE '-' ++#define DEVD_EVENT_NOTIFY '!' + -+#define RECONNECT_DELAY 5 * 1000 ++#define RECONNECT_DELAY (5 * 1000) + -+static int sock_devd; -+static bool is_console_kbd = false; -+static bool is_kbdmux = false; ++#define is_meuqual(__v1, __v1sz, __v2, __v2sz) \ ++ ((__v1sz) == (__v2sz) && NULL != (__v1) && NULL != (__v2) && \ ++ 0 == memcmp((__v1), (__v2), (__v1sz))) ++ ++#define is_meuqual_cstr(__cstr, __v, __vsz) \ ++ is_meuqual(__cstr, (sizeof(__cstr) - 1), __v, __vsz) ++ ++#define is_de_euqual_cstr(__de, __cstr) \ ++ (NULL != (__de) && \ ++ is_meuqual((__de)->d_name, (__de)->d_namlen, __cstr, (sizeof(__cstr) - 1))) ++ ++#define devd_get_val_cstr(__cstr, __buf, __bufsz, __valsz) \ ++ devd_get_val((__buf), (__bufsz), __cstr, (sizeof(__cstr) - 1), \ ++ (__valsz)) ++ ++static int devd_skt = 0; ++static char devd_buf[4096]; ++static size_t devd_buf_used = 0; ++static int is_kbdmux = 0; +static OsTimerPtr rtimer = NULL; + -+struct hw_type { -+ const char *driver; -+ int flag; -+ const char *xdriver; ++/* Input devices. */ ++typedef struct hw_type_s { ++ const char *dev_name; ++ size_t dev_name_size; ++ size_t path_offset; ++ int flags; ++ const char *xdriver; ++} hw_type_t, *hw_type_p; ++ ++/* xdriver can be set via config "InputClass" section. ++ * Do not set xdriver name if device have more than one ++ * xf86-input-* drivers. ++ * "input/event" can be hadled by: xf86-input-evdev and ++ * xf86-input-wacom, let user choose. ++ */ ++static hw_type_t hw_types[] = { ++ { "uhid", 4, 0, 0, NULL }, ++ { "ukbd", 4, 0, ATTR_KEY | ATTR_KEYBOARD, "kbd" }, ++ { "atkbd", 5, 0, ATTR_KEY | ATTR_KEYBOARD, "kbd" }, ++ { "kbdmux", 6, 0, ATTR_KEY | ATTR_KEYBOARD, "kbd" }, ++ { "sysmouse", 8, 0, ATTR_POINTER, "mouse" }, ++ { "ums", 3, 0, ATTR_POINTER, "mouse" }, ++ { "psm", 3, 0, ATTR_POINTER, "mouse" }, ++ { "vboxguest", 9, 0, ATTR_POINTER, "vboxmouse" }, ++ { "joy", 3, 0, ATTR_JOYSTICK, NULL }, ++ { "atp", 3, 0, ATTR_TOUCHPAD, NULL }, ++ { "uep", 3, 0, ATTR_TOUCHSCREEN, NULL }, ++ { "input/event",5, 6, 0, NULL }, ++ { "input/js", 2, 6, ATTR_JOYSTICK, NULL }, ++ { NULL, 0, 0, 0, NULL }, +}; + -+static struct hw_type hw_types[] = { -+ { "ukbd", ATTR_KEYBOARD, "kbd" }, -+ { "atkbd", ATTR_KEYBOARD, "kbd" }, -+ { "kbdmux", ATTR_KEYBOARD, "kbd" }, -+ { "sysmouse", ATTR_POINTER, "mouse" }, -+ { "ums", ATTR_POINTER, "mouse" }, -+ { "psm", ATTR_POINTER, "mouse" }, -+ { "vboxguest", ATTR_POINTER, "vboxmouse" }, -+ { "joy", ATTR_JOYSTICK, NULL }, -+ { "atp", ATTR_TOUCHPAD, NULL }, -+ { "uep", ATTR_TOUCHSCREEN, NULL }, -+ { NULL, -1, NULL }, ++/* Input devices paths. */ ++static hw_type_t hw_type_path[] = { ++ { "input/", 0, 6, 0, NULL }, ++ { NULL, 0, 0, 0, NULL }, +}; + -+static bool -+sysctl_exists(const struct hw_type *device, int unit, -+ char *devname, size_t devname_len) ++static size_t ++bits_calc(const uint32_t *bits, size_t off_start, size_t off_stop) +{ -+ char sysctlname[PATH_MAX]; -+ size_t len; -+ int ret; ++ size_t count = 0; + -+ if (device == NULL || device->driver == NULL) -+ return false; ++ for (size_t i = off_start; i < off_stop; ++i) { ++ if (U32_IS_BIT_SET(bits, i)) { ++ ++count; ++ } ++ } ++ return count; ++} + -+ /* Check if a sysctl exists. */ -+ snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc", -+ device->driver, unit); -+ ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0); ++static hw_type_p ++get_dev_type_by_name(const char *dev_name, size_t dev_name_size) ++{ ++ if (!dev_name || !dev_name_size) ++ return NULL; + -+ if (ret == 0 && len > 0) { -+ snprintf(devname, devname_len, "%s%i", device->driver, unit); -+ return true; ++ for (size_t i = 0; hw_types[i].dev_name; ++i) { ++ if (dev_name_size >= (hw_types[i].dev_name_size + hw_types[i].path_offset) && ++ !memcmp(dev_name, hw_types[i].dev_name, (hw_types[i].path_offset + hw_types[i].dev_name_size))) { ++ return &hw_types[i]; ++ } + } ++ return NULL; ++} + -+ return false; ++/* From: sys/dev/usb/usb_hid.c */ ++static int ++hid_is_collection(report_desc_t s, uint32_t usage) ++{ ++ struct hid_data* hd = hid_start_parse(s, ~0, -1); ++ if (!hd) ++ return 0; ++ ++ struct hid_item hi; ++ int rc; ++ while ((rc = hid_get_item(hd, &hi))) { ++ if (hi.kind == hid_collection && hi.usage == usage) ++ break; ++ } ++ hid_end_parse(hd); ++ return rc; +} + -+static bool -+devpath_exists(const struct hw_type *device, -+ char *devname, size_t devname_len) ++static int ++hid_is_mouse(report_desc_t s) +{ -+ char *devpath; -+ struct stat st; -+ int ret; ++ struct hid_data* hd = hid_start_parse(s, (1 << hid_input), -1); ++ if (!hd) ++ return 0; + -+ if (device == NULL || device->driver == NULL) -+ return false; ++ struct hid_item hi; ++ int found = 0, mdepth = 0; ++ while (hid_get_item(hd, &hi)) { ++ switch (hi.kind) { ++ case hid_collection: ++ if (mdepth != 0) ++ ++mdepth; ++ else if (hi.collection == 1 && ++ hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)) ++ ++mdepth; ++ break; ++ case hid_endcollection: ++ if (mdepth) ++ --mdepth; ++ break; ++ case hid_input: ++ if (!mdepth) ++ break; ++ if (hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X) && ++ (hi.flags & (HIO_CONST|HIO_RELATIVE)) == HIO_RELATIVE) ++ ++found; ++ if (hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y) && ++ (hi.flags & (HIO_CONST|HIO_RELATIVE)) == HIO_RELATIVE) ++ ++found; ++ break; ++ default: ++ break; ++ } ++ } ++ hid_end_parse(hd); ++ return found; ++} + -+ /* Check if /dev/$driver exists. */ -+ asprintf(&devpath, "/dev/%s", device->driver); -+ if (devpath == NULL) -+ return false; ++static hw_type_p ++get_dev_type_by_path(const char *dev_name, size_t dev_name_size, hw_type_p hw_type_cust) ++{ ++ if (!dev_name || !dev_name_size || !hw_type_cust) ++ return NULL; + -+ ret = stat(devpath, &st); -+ free(devpath); -+ -+ if (ret == 0) { -+ strncpy(devname, device->driver, devname_len); -+ return true; ++ for (size_t i = 0; hw_type_path[i].dev_name; ++i) { ++ if (dev_name_size <= hw_type_path[i].path_offset || ++ memcmp(dev_name, hw_type_path[i].dev_name, hw_type_path[i].path_offset)) ++ continue; ++ /* Path in white list. */ ++ hw_type_cust->dev_name = dev_name; ++ hw_type_cust->flags = hw_type_path[i].flags; ++ hw_type_cust->xdriver = hw_type_path[i].xdriver; ++ hw_type_cust->path_offset = hw_type_path[i].path_offset; ++ size_t name_end = hw_type_cust->path_offset; ++ while (name_end < dev_name_size && !isdigit(dev_name[name_end])) ++ ++name_end; ++ hw_type_cust->dev_name_size = (name_end - hw_type_cust->path_offset); ++ return hw_type_cust; + } ++ return NULL; ++} + -+ return false; ++static int ++is_kbdmux_enabled(void) ++{ ++ /* Xorg uses /dev/ttyv0 as a console device */ ++ /* const char device[]="/dev/console"; */ ++ static const char *device = _PATH_TTY "v0"; ++ ++ int fd = open(device, O_RDONLY); ++ if (fd < 0) ++ return 0; ++ ++ keyboard_info_t info; ++ int ret = (ioctl(fd, KDGKBINFO, &info) == -1 || ++ memcmp(info.kb_name, "kbdmux", 6)) ? 0 : 1; ++ close(fd); ++ return ret; +} + +static char * -+sysctl_get_str(const char *sysctlname) ++sysctl_get_str(const char *sysctlname, size_t *size_ret) +{ -+ char *dest = NULL; -+ size_t len; ++ if (!sysctlname) ++ return NULL; + -+ if (sysctlname == NULL) ++ size_t len = 0; ++ if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) || !len) + return NULL; + -+ if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) { -+ dest = malloc(len + 1); -+ if (dest) { -+ if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0) -+ dest[len] = '\0'; -+ else { -+ free(dest); -+ dest = NULL; -+ } -+ } ++ char* dest = malloc(len + 1); ++ if (!dest) ++ return NULL; ++ ++ if (sysctlbyname(sysctlname, dest, &len, NULL, 0)) { ++ free(dest); ++ return NULL; + } -+ ++ dest[len] = 0; ++ if (size_ret) ++ *size_ret = len; + return dest; +} + -+static void -+device_added(const char *devname) ++static char * ++devd_get_val(char *buf, size_t buf_size, const char *val_name, size_t val_name_size, size_t *val_size) +{ -+ char path[PATH_MAX]; -+ char sysctlname[PATH_MAX]; -+ char *vendor; -+ char *product = NULL; -+ char *config_info = NULL; -+ char *walk; -+ InputOption *options = NULL; -+ InputAttributes attrs = { }; -+ DeviceIntPtr dev = NULL; -+ int i; -+ int fd; ++ if (!buf || !buf_size || !val_name || !val_name_size) ++ return NULL; + -+ for (i = 0; hw_types[i].driver != NULL; i++) { -+ size_t len; -+ -+ len = strlen(hw_types[i].driver); -+ if (strcmp(devname, hw_types[i].driver) == 0 || -+ (strncmp(devname, hw_types[i].driver, len) == 0 && -+ isnumber(*(devname + len)))) { -+ attrs.flags |= hw_types[i].flag; -+ break; ++ char *ret = buf, *buf_end = (buf + buf_size); ++ while (ret && ret < buf_end) { ++ ret = memmem(ret, (buf_end - ret), val_name, val_name_size); ++ if (!ret) ++ return NULL; ++ /* Found. */ ++ /* Check: space before or buf+1. */ ++ if ((buf + 1) < ret && ret[-1] != ' ') { ++ ret += val_name_size; ++ continue; + } ++ /* Check: = after name and size for value. */ ++ ret += val_name_size; ++ if ((ret + 1) >= buf_end) ++ return NULL; ++ if (ret[0] != '=') ++ continue; ++ ++ret; ++ break; + } ++ if (!ret || !val_size) ++ return ret; ++ /* Calc value data size. */ ++ char* ptr = memchr(ret, ' ', (buf_end - ret)); ++ if (!ptr) /* End of string/last value. */ ++ ptr = buf_end; ++ *val_size = (ptr - ret); ++ return ret; ++} + -+ if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) { -+ LogMessage(X_INFO, "config/devd: ignoring device %s\n", -+ devname); ++static void ++device_added(const char *dev_name, size_t dev_name_size, int allow_no_device) ++{ ++ if (!dev_name || !dev_name_size || dev_name_size > PATH_MAX) + return; ++ ++ char config_info[(PATH_MAX + 32)]; ++ /* Make dev_name null ended string. */ ++ snprintf(config_info, sizeof(config_info), DEVD_PATH_DEV"%.*s", (int)dev_name_size, dev_name); ++ /* Set / update pointers to dev_name and dev_path. */ ++ char* dev_path = (config_info + 5); /* Skip: "devd:" */ ++ dev_name = (dev_path + _PATH_DEV_LEN); /* Skip: "/dev/" */ ++ ++ /* Is known input device or path? */ ++ hw_type_t *hwtype = get_dev_type_by_name(dev_name, dev_name_size); ++ if (!hwtype) { ++ hw_type_t hwtype_cust; ++ hwtype = get_dev_type_by_path(dev_name, dev_name_size, &hwtype_cust); + } ++ if (!hwtype) /* Not found in white list. */ ++ return; + + /* Skip keyboard devices if kbdmux is enabled */ -+ if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) { -+ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", -+ devname); ++ if (is_kbdmux && !allow_no_device && (hwtype->flags & ATTR_KEYBOARD)) { ++ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name); + return; + } -+ -+ snprintf(path, sizeof(path), "/dev/%s", devname); -+ -+ options = input_option_new(NULL, "_source", "server/devd"); -+ if (!options) ++ /* Skip duplicate devices. */ ++ if (device_is_duplicate(config_info)) { ++ LogMessage(X_WARNING, "config/devd: device %s already added. ignoring\n", dev_path); + return; -+ -+ snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc", -+ hw_types[i].driver, devname + strlen(hw_types[i].driver)); -+ vendor = sysctl_get_str(sysctlname); -+ if (vendor == NULL) { -+ options = input_option_new(options, "name", devname); + } -+ else { -+ if ((walk = strchr(vendor, ' ')) != NULL) { -+ walk[0] = '\0'; -+ walk++; -+ product = walk; -+ if ((walk = strchr(product, ',')) != NULL) -+ walk[0] = '\0'; -+ } + -+ attrs.vendor = strdup(vendor); -+ if (product) { -+ attrs.product = strdup(product); -+ options = input_option_new(options, "name", product); -+ } -+ else -+ options = input_option_new(options, "name", "(unnamed)"); ++ /* Init and set attributes. */ ++ char pnp_usb_id[PATH_MAX], product[PATH_MAX], vendor[PATH_MAX]; ++ InputAttributes attrs; ++ memset(&attrs, 0, sizeof(attrs)); ++ attrs.device = dev_path; ++ attrs.flags = hwtype->flags; + -+ free(vendor); -+ } -+ -+ /* XXX implement usb_id */ -+ attrs.usb_id = NULL; -+ attrs.device = strdup(path); -+ options = input_option_new(options, "driver", hw_types[i].xdriver); -+ -+ fd = open(path, O_RDONLY); -+ if (fd > 0) { -+ close(fd); -+ options = input_option_new(options, "device", path); -+ } -+ else { -+ if (attrs.flags & ~ATTR_KEYBOARD) { -+ LogMessage(X_INFO, "config/devd: device %s already opened\n", -+ path); -+ ++ /* Try to open device. */ ++ int fd = open(dev_path, O_RDONLY); ++ if (fd < 0) { ++ if (!(hwtype->flags & (ATTR_KEY | ATTR_KEYBOARD))) { + /* + * Fail if cannot open device, it breaks AllowMouseOpenFail, -+ * but it should not matter when config/devd enabled ++ * but it should not matter when config/devd is enabled + */ -+ goto unwind; ++ LogMessage(X_WARNING, "config/devd: device %s already opened\n", dev_path); ++ return; + } -+ -+ if (is_console_kbd) { ++ if (!allow_no_device) { + /* + * There can be only one keyboard attached to console and + * it is already added. + */ -+ LogMessage(X_WARNING, "config/devd: console keyboard is " -+ "already added, ignoring %s (%s)\n", -+ attrs.product, path); -+ goto unwind; ++ LogMessage(X_WARNING, "config/devd: console keyboard is already added, ignoring %s\n", dev_path); ++ return; + } -+ else -+ /* -+ * Don't pass "device" option if the keyboard is already -+ * attached to the console (ie. open() fails). -+ * This would activate a special logic in xf86-input-keyboard. -+ * Prevent any other attached to console keyboards being -+ * processed. There can be only one such device. -+ */ -+ is_console_kbd = true; -+ } ++ } else { ++ /* Try to get device info via ioctl(). */ ++ keyboard_info_t kbdi; ++ mousehw_t mshw; ++ struct input_id iid; ++ report_desc_t rep_desc; + -+ if (asprintf(&config_info, "devd:%s", devname) == -1) { -+ config_info = NULL; -+ goto unwind; ++ if (ioctl(fd, KDGKBINFO, &kbdi) != -1) { /* Is this keyboard? */ ++ memcpy(product, kbdi.kb_name, sizeof(kbdi.kb_name)); ++ attrs.product = product; ++ attrs.flags = ATTR_KEY | ATTR_KEYBOARD; ++ LogMessage(X_INFO, "config/devd: detected keyboard: %s, kb_index=%i, kb_unit=%i, kb_type=%i, kb_config=%i\n", ++ kbdi.kb_name, kbdi.kb_index, kbdi.kb_unit, kbdi.kb_type, kbdi.kb_config); ++ } else if (ioctl(fd, MOUSE_GETHWINFO, &mshw) != -1) { /* Is this mouse? */ ++ /* FreeBSD mouse drivers does not return real vid+pid. */ ++ /* construct USB ID in lowercase hex - "0000:ffff" */ ++ if (mshw.hwid || mshw.model) { ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", mshw.hwid, mshw.model); ++ attrs.usb_id = pnp_usb_id; ++ } ++ ++ switch (mshw.type) { ++ case MOUSE_MOUSE: ++ case MOUSE_TRACKBALL: ++ case MOUSE_STICK: ++ attrs.flags = ATTR_POINTER; ++ break; ++ case MOUSE_PAD: ++ attrs.flags = ATTR_TOUCHPAD; ++ break; ++ } ++ LogMessage(X_INFO, "config/devd: detected mouse: hwid=%04x, model=%04x, type=%04x, iftype=%04x, buttons=%04x\n", ++ mshw.hwid, mshw.model, mshw.type, mshw.iftype, mshw.buttons); ++ } else if (ioctl(fd, JSIOCGNAME((sizeof(product) - 1)), product) != -1) { /* Is this joystick? */ ++ attrs.product = product; ++ attrs.flags = ATTR_JOYSTICK; ++ LogMessage(X_INFO, "config/devd: detected joystick: %s\n", product); ++ } else if (ioctl(fd, EVIOCGID, &iid) != -1 && ++ ioctl(fd, EVIOCGNAME((sizeof(product) - 1)), product) != -1) { /* Is this event? */ ++ /* construct USB ID in lowercase hex - "0000:ffff" */ ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", iid.vendor, iid.product); ++ attrs.usb_id = pnp_usb_id; ++ attrs.product = product; ++ ++ /* Detect device type. */ ++ uint32_t key_bits[U32_CNT(KEY_CNT)]; ++ size_t has_keys = 0, has_buttons = 0, has_lmr = 0; ++ if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits) != -1) { ++ has_keys = bits_calc(key_bits, 0, BTN_MISC); ++ has_buttons = bits_calc(key_bits, BTN_MISC, BTN_JOYSTICK); ++ has_lmr = bits_calc(key_bits, BTN_LEFT, BTN_MIDDLE); ++ } ++ uint32_t rel_bits[U32_CNT(REL_CNT)]; ++ size_t has_rel_axes = 0; ++ if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)), rel_bits) != -1) { ++ has_rel_axes = bits_calc(rel_bits, 0, REL_MAX); ++ } ++ uint32_t abs_bits[U32_CNT(ABS_CNT)]; ++ size_t has_abs_axes = 0, has_mt = 0; ++ if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits) != -1) { ++ has_abs_axes = bits_calc(abs_bits, 0, ABS_MAX); ++ has_mt = bits_calc(abs_bits, ABS_MT_SLOT, ABS_MAX); ++ } ++ ++ bool done = false; ++ if (has_abs_axes) { ++ if (has_mt) { ++ if (!has_buttons) { ++ /* ++ * XXX: I'm not sure that joystick detection is ++ * done right. xf86-evdev does not support them. ++ */ ++ if (U32_IS_BIT_SET(key_bits, BTN_JOYSTICK)) { ++ attrs.flags = ATTR_JOYSTICK; ++ done = true; ++ } else { ++ ++has_buttons; ++ } ++ } ++ } ++ if (!done && U32_IS_BIT_SET(abs_bits, ABS_X) && U32_IS_BIT_SET(abs_bits, ABS_Y)) { ++ if (U32_IS_BIT_SET(key_bits, BTN_TOOL_PEN) || ++ U32_IS_BIT_SET(key_bits, BTN_STYLUS) || ++ U32_IS_BIT_SET(key_bits, BTN_STYLUS2)) { ++ attrs.flags = ATTR_TABLET; ++ done = true; ++ } else if (U32_IS_BIT_SET(abs_bits, ABS_PRESSURE) || ++ U32_IS_BIT_SET(key_bits, BTN_TOUCH)) { ++ if (has_lmr || U32_IS_BIT_SET(key_bits, BTN_TOOL_FINGER)) { ++ attrs.flags = ATTR_TOUCHPAD; ++ } else { ++ attrs.flags = ATTR_TOUCHSCREEN; ++ } ++ done = true; ++ } else if (!(U32_IS_BIT_SET(rel_bits, REL_X) && ++ U32_IS_BIT_SET(rel_bits, REL_Y)) && has_lmr) { ++ /* some touchscreens use BTN_LEFT rather than BTN_TOUCH */ ++ attrs.flags = ATTR_TOUCHSCREEN; ++ done = true; ++ } ++ } ++ } ++ if (!done) { ++ if (has_keys) { ++ if (is_kbdmux) { ++ close(fd); ++ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name); ++ return; ++ } ++ attrs.flags = ATTR_KEY | ATTR_KEYBOARD; ++ } else if (has_rel_axes || has_abs_axes || has_buttons) { ++ attrs.flags = ATTR_POINTER; ++ } ++ } ++ LogMessage(X_INFO, "config/devd: detected event input: %s, bustype=%04x, vendor=%04x, product=%04x, version=%04x\n", ++ product, iid.bustype, iid.vendor, iid.product, iid.version); ++ } else if ((rep_desc = hid_get_report_desc(fd))) { /* Is USB HID? */ ++ if (hid_is_mouse(rep_desc)) { ++ attrs.flags = ATTR_POINTER; ++ } else if (hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD))) { ++ /* Skip keyboard devices if kbdmux is enabled */ ++ if (is_kbdmux) { ++ hid_dispose_report_desc(rep_desc); ++ close(fd); ++ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name); ++ return; ++ } ++ attrs.flags = ATTR_KEY | ATTR_KEYBOARD; ++ } else if (hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_JOYSTICK)) || ++ hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_GAME_PAD))) { ++ attrs.flags = ATTR_JOYSTICK; ++ } ++ hid_dispose_report_desc(rep_desc); ++ LogMessage(X_INFO, "config/devd: detected USB HID...\n"); ++ } ++ ++ if (!attrs.usb_id) { /* Is this webcamd device? */ ++ unsigned short vid, pid; ++ if (ioctl(fd, WEBCAMD_IOCTL_GET_USB_VENDOR_ID, &vid) != -1 && ++ ioctl(fd, WEBCAMD_IOCTL_GET_USB_PRODUCT_ID, &pid) != -1) { ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", vid, pid); ++ attrs.usb_id = pnp_usb_id; ++ LogMessage(X_INFO, "config/devd: webcamd device: %s\n", pnp_usb_id); ++ } ++ } + } ++ close(fd); + -+ if (device_is_duplicate(config_info)) { -+ LogMessage(X_WARNING, "config/devd: device %s (%s) already added. " -+ "ignoring\n", attrs.product, path); -+ goto unwind; ++ /* Try to get device info via sysctl(). */ ++ if (!attrs.usb_id && !attrs.pnp_id) { ++ char sysctlname[PATH_MAX]; ++ snprintf(sysctlname, sizeof(sysctlname), "dev.%.*s.%s.%%pnpinfo", ++ (int)hwtype->dev_name_size, ++ (hwtype->dev_name + hwtype->path_offset), ++ (dev_name + hwtype->path_offset + hwtype->dev_name_size)); ++ size_t sdata_size; ++ char* sdata = sysctl_get_str(sysctlname, &sdata_size); ++ if (sdata) { ++ size_t pid_size, vid_size; ++ char* ptr_vid = devd_get_val_cstr("vendor", sdata, sdata_size, &vid_size); ++ char* ptr_pid = devd_get_val_cstr("product", sdata, sdata_size, &pid_size); ++ if (ptr_vid && ptr_pid) { /* usb_id */ ++ ptr_vid[vid_size] = 0; ++ ptr_pid[pid_size] = 0; ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%s:%s", ptr_vid, ptr_pid); ++ attrs.usb_id = pnp_usb_id; ++ LogMessage(X_INFO, "config/devd: [sysctl] usb_id: %s\n", pnp_usb_id); ++ } else { /* pnp_id */ ++ strlcpy(pnp_usb_id, sdata, sizeof(pnp_usb_id)); ++ attrs.pnp_id = pnp_usb_id; ++ } ++ free(sdata); ++ } + } ++ if (!attrs.vendor || !attrs.product) { ++ char sysctlname[PATH_MAX]; ++ snprintf(sysctlname, sizeof(sysctlname), "dev.%.*s.%s.%%desc", ++ (int)hwtype->dev_name_size, ++ (hwtype->dev_name + hwtype->path_offset), ++ (dev_name + hwtype->path_offset + hwtype->dev_name_size)); ++ size_t sdata_size; ++ char* sdata = sysctl_get_str(sysctlname, &sdata_size); ++ if (sdata) { ++ /* Vendor. */ ++ char* ptr_pid = memchr(sdata, ' ', sdata_size); ++ if (ptr_pid) ++ ptr_pid[0] = 0; ++ strlcpy(vendor, sdata, sizeof(vendor)); ++ attrs.vendor = vendor; ++ /* Product. */ ++ if (!attrs.product && ptr_pid) { ++ ++ptr_pid; ++ char* ptr_vid = memchr(ptr_pid, ',', (sdata_size - (ptr_pid - sdata))); ++ if (ptr_vid) ++ ptr_vid[0] = 0; ++ strlcpy(product, ptr_pid, sizeof(product)); ++ attrs.product = product; ++ } else ++ product[0] = 0; ++ free(sdata); ++ LogMessage(X_INFO, "config/devd: [sysctl] vendor: %s, product: %s\n", vendor, product); ++ } ++ } + -+ options = input_option_new(options, "config_info", config_info); -+ LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n", -+ attrs.product, path); -+ -+ NewInputDeviceRequest(options, &attrs, &dev); -+ -+unwind: -+ free(config_info); -+ input_option_free_list(&options); -+ free(attrs.usb_id); -+ free(attrs.product); -+ free(attrs.device); -+ free(attrs.vendor); ++ /* Init options. */ ++ InputOption *option = NULL, *options = NULL; ++ if ((option = input_option_new(options, "_source", "server/devd"))) ++ options = option; ++ if (option && (option = input_option_new(options, "config_info", config_info))) ++ options = option; ++ if (option && (option = input_option_new(options, "name", (attrs.product ? attrs.product : dev_name)))) ++ options = option; ++ if (option && hwtype->xdriver && (option = input_option_new(options, "driver", hwtype->xdriver))) ++ options = option; ++ /* ++ * Don't pass "device" option if the keyboard is already attached to the console (ie. open() failed) ++ * This would activate a special logic in xf86-input-keyboard. Prevent any other attached to console ++ * keyboards being processed. There can be only one such device. ++ */ ++ if (option && fd >= 0 && (option = input_option_new(options, "device", dev_path))) ++ options = option; ++ /* Most drivers just use "device" but evdev also uses "path" so populate both */ ++ if (option && (option = input_option_new(options, "path", dev_path))) ++ options = option; ++ if (option) { ++ LogMessage(X_INFO, "config/devd: adding input device %s\n", dev_path); ++ DeviceIntPtr dev_iptr = NULL; ++ int rc; ++ if ((rc = NewInputDeviceRequest(options, &attrs, &dev_iptr)) != Success) ++ LogMessage(X_ERROR, "config/devd: error %d adding device %s\n", rc, dev_path); ++ } else ++ LogMessage(X_ERROR, "config/devd: error adding device %s\n", dev_path); ++ if (options) ++ input_option_free_list(&options); ++ return; +} + +static void -+device_removed(char *devname) ++device_removed(const char *dev_name, size_t dev_name_size) +{ -+ char *config_info; + -+ if (asprintf(&config_info, "devd:%s", devname) == -1) ++ if (!dev_name || !dev_name_size || dev_name_size > PATH_MAX) + return; + -+ remove_devices("devd", config_info); ++ char config_info[(PATH_MAX + 32)]; ++ snprintf(config_info, sizeof(config_info), DEVD_PATH_DEV"%.*s", (int)dev_name_size, dev_name); + -+ free(config_info); -+} -+ -+static bool is_kbdmux_enabled(void) -+{ -+ /* Xorg uses /dev/ttyv0 as a console device */ -+ /* const char device[]="/dev/console"; */ -+ const char device[]="/dev/ttyv0"; -+ keyboard_info_t info; -+ int fd; -+ -+ fd = open(device, O_RDONLY); -+ -+ if (fd < 0) -+ return false; -+ -+ if (ioctl(fd, KDGKBINFO, &info) == -1) { -+ close(fd); -+ return false; ++ hw_type_t hwtype_cust; ++ if (!get_dev_type_by_name(dev_name, dev_name_size) && ++ !get_dev_type_by_path(dev_name, dev_name_size, &hwtype_cust)) { ++ LogMessage(X_INFO, "config/devd: skip remove unrecognized device %s\n", (config_info + DEVD_PATH_DEV_LEN)); ++ return; /* Device not in list - unknown. */ + } + -+ close(fd); -+ -+ if (!strncmp(info.kb_name, "kbdmux", 6)) -+ return true; -+ -+ return false; ++ if (device_is_duplicate(config_info)) ++ LogMessage(X_INFO, "config/devd: removing input device %s\n", (config_info + DEVD_PATH_DEV_LEN)); ++ else ++ LogMessage(X_INFO, "config/devd: removing missing device %s\n", (config_info + DEVD_PATH_DEV_LEN)); ++ remove_devices("devd", config_info); ++ return; +} + -+static void -+disconnect_devd(int sock) -+{ -+ if (sock >= 0) { -+ RemoveGeneralSocket(sock); -+ close(sock); -+ } -+} ++static void socket_handler(int fd, int ready, void *data); + +static int +connect_devd(void) +{ -+ struct sockaddr_un devd; -+ int sock; -+ -+ sock = socket(AF_UNIX, SOCK_STREAM, 0); ++ int sock = socket(AF_UNIX, SOCK_STREAM, 0); + if (sock < 0) { -+ LogMessage(X_ERROR, "config/devd: fail opening stream socket\n"); ++ LogMessage(X_ERROR, "config/devd: failed opening stream socket: %s\n", strerror(errno)); + return -1; + } + ++ struct sockaddr_un devd; + devd.sun_family = AF_UNIX; -+ strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path)); -+ -+ if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) { ++ memcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(DEVD_SOCK_PATH)); ++ if (connect(sock, (struct sockaddr*)&devd, sizeof(devd)) < 0) { ++ int error = errno; + close(sock); -+ LogMessage(X_ERROR, "config/devd: fail to connect to devd\n"); ++ LogMessage(X_ERROR, "config/devd: failed to connect to devd: %s)\n", strerror(error)); + return -1; + } + -+ AddGeneralSocket(sock); ++ SetNotifyFd(sock, socket_handler, X_NOTIFY_READ, NULL); ++ return sock; ++} + -+ return sock; ++static void ++disconnect_devd(int sock) ++{ ++ if (sock < 0) ++ return; ++ RemoveNotifyFd(sock); ++ close(sock); ++ return; +} + +static CARD32 +reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg) +{ -+ int newsock; -+ -+ if ((newsock = connect_devd()) > 0) { -+ sock_devd = newsock; -+ TimerFree(rtimer); -+ rtimer = NULL; -+ LogMessage(X_INFO, "config/devd: reopening devd socket\n"); -+ return 0; -+ } -+ -+ /* Try again after RECONNECT_DELAY */ -+ return RECONNECT_DELAY; ++ devd_buf_used = 0; ++ devd_skt = connect_devd(); ++ if (devd_skt < 0) /* Try again after RECONNECT_DELAY */ ++ return RECONNECT_DELAY; ++ TimerFree(rtimer); ++ rtimer = NULL; ++ LogMessage(X_INFO, "config/devd: reopened devd socket\n"); ++ return 0; +} + -+static ssize_t -+socket_getline(int fd, char **out) ++static void ++socket_handler(int fd, int ready, void *data) +{ -+ char *buf, *newbuf; -+ ssize_t ret, cap, sz = 0; -+ char c; -+ -+ cap = 1024; -+ buf = malloc(cap * sizeof(char)); -+ if (!buf) -+ return -1; -+ -+ for (;;) { -+ ret = read(sock_devd, &c, 1); -+ if (ret < 0) { -+ if (errno == EINTR) -+ continue; -+ free(buf); -+ return -1; -+ /* EOF - devd socket is lost */ -+ } else if (ret == 0) { -+ disconnect_devd(sock_devd); -+ rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL); -+ LogMessage(X_WARNING, "config/devd: devd socket is lost\n"); -+ free(buf); -+ return -1; ++ /* Read new data. */ ++ while (1) { ++ ssize_t ios = recv(devd_skt, (devd_buf + devd_buf_used), (sizeof(devd_buf) - devd_buf_used), MSG_DONTWAIT); ++ if (ios > 0) { /* Read OK. */ ++ devd_buf_used += ios; ++ continue; /* Try to read more. */ + } -+ if (c == '\n') -+ break; -+ -+ if (sz + 1 >= cap) { -+ cap *= 2; -+ newbuf = realloc(buf, cap * sizeof(char)); -+ if (!newbuf) { -+ free(buf); -+ return -1; -+ } -+ buf = newbuf; ++ /* Something wrong. */ ++ int error = errno; ++ if (error == EAGAIN) ++ break; /* All available data read. */ ++ if (error == EINTR) ++ continue; ++ if (devd_buf_used >= sizeof(devd_buf)) { ++ devd_buf_used = 0; /* Message too long, reset buf. */ ++ continue; + } -+ buf[sz] = c; -+ sz++; ++ /* devd socket is lost */ ++ disconnect_devd(devd_skt); ++ rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL); ++ LogMessage(X_WARNING, "config/devd: devd socket read error: %s\n", strerror(error)); ++ return; + } + -+ buf[sz] = '\0'; -+ if (sz >= 0) -+ *out = buf; -+ else -+ free(buf); ++ /* Process data. */ ++ char *ptr, *line = (devd_buf + 1); ++ size_t line_size = 0; ++ while((ptr = memchr(line, '\n', (devd_buf_used - line_size)))) { ++ line_size = (ptr - line); ++ do { ++ if (*(line - 1) != DEVD_EVENT_NOTIFY) ++ break; /* Handle only notify. */ ++ /* Check: is system=DEVFS. */ ++ size_t val_size; ++ char* val = devd_get_val_cstr("system", line, line_size, &val_size); ++ if (!is_meuqual_cstr("DEVFS", val, val_size)) ++ break; ++ /* Check: is subsystem=CDEV. */ ++ val = devd_get_val_cstr("subsystem", line, line_size, &val_size); ++ if (!is_meuqual_cstr("CDEV", val, val_size)) ++ break; ++ /* Get device name. */ ++ size_t cdev_size; ++ char* cdev = devd_get_val_cstr("cdev", line, line_size, &cdev_size); ++ if (!cdev) ++ break; ++ /* Get event type. */ ++ val = devd_get_val_cstr("type", line, line_size, &val_size); ++ if (is_meuqual_cstr("CREATE", val, val_size)) { ++ device_added(cdev, cdev_size, 0); ++ } else if (is_meuqual_cstr("DESTROY", val, val_size)) { ++ device_removed(cdev, cdev_size); ++ } ++ } while(0); + -+ /* Number of bytes in the line, not counting the line break */ -+ return sz; -+} -+ -+static void -+wakeup_handler(void *data, int err, void *read_mask) -+{ -+ char *line = NULL; -+ char *walk; -+ -+ if (err < 0) -+ return; -+ -+ if (FD_ISSET(sock_devd, (fd_set *) read_mask)) { -+ if (socket_getline(sock_devd, &line) < 0) ++ line += (line_size + 2); /* Skip '\n' and event type byte. */ ++ line_size = (line - devd_buf); ++ if (devd_buf_used <= line_size) { ++ devd_buf_used = 0; + return; -+ -+ walk = strchr(line + 1, ' '); -+ if (walk != NULL) -+ walk[0] = '\0'; -+ -+ switch (*line) { -+ case DEVD_EVENT_ADD: -+ device_added(line + 1); -+ break; -+ case DEVD_EVENT_REMOVE: -+ device_removed(line + 1); -+ break; -+ default: -+ break; + } -+ free(line); + } ++ /* Save line without end marker. */ ++ if (line_size) { ++ devd_buf_used -= (line_size - 1); ++ memmove(devd_buf, (line - 1), devd_buf_used); ++ } ++ return; +} + -+static void -+block_handler(void *data, struct timeval **tv, void *read_mask) -+{ -+} -+ +int +config_devd_init(void) +{ -+ char devicename[1024]; -+ int i, j; -+ + LogMessage(X_INFO, "config/devd: probing input devices...\n"); + + /* @@ -494,27 +833,46 @@ + * Add fake keyboard and give up on keyboards management + * if kbdmux is enabled + */ -+ if ((is_kbdmux = is_kbdmux_enabled()) == true) -+ device_added("kbdmux"); ++ is_kbdmux = is_kbdmux_enabled(); ++ if (is_kbdmux) ++ device_added("kbdmux0", 7, 1); + -+ for (i = 0; hw_types[i].driver != NULL; i++) { -+ /* First scan the sysctl to determine the hardware */ -+ for (j = 0; j < 16; j++) { -+ if (sysctl_exists(&hw_types[i], j, -+ devicename, sizeof(devicename)) != 0) -+ device_added(devicename); ++ /* Scan /dev/ for devices. */ ++ struct dirent** namelist; ++ size_t dir_cnt = scandir(_PATH_DEV, &namelist, 0, alphasort); ++ for (size_t i = 0; i < dir_cnt; ++i) { ++ struct dirent* de = namelist[i]; ++ if (is_de_euqual_cstr(de, ".") || ++ is_de_euqual_cstr(de, "..")) { ++ free(de); ++ continue; + } -+ -+ if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0) -+ device_added(devicename); ++ if (de->d_type != DT_DIR) { ++ device_added(de->d_name, de->d_namlen, 0); ++ } else { /* Sub folder. */ ++ char devicename[PATH_MAX]; ++ snprintf(devicename, sizeof(devicename), _PATH_DEV "%s", de->d_name); ++ struct dirent** snamelist; ++ size_t sdir_cnt = scandir(devicename, &snamelist, 0, alphasort); ++ for (size_t j = 0; j < sdir_cnt; ++j) { ++ struct dirent* sde = snamelist[j]; ++ if (!is_de_euqual_cstr(sde, ".") && ++ !is_de_euqual_cstr(sde, "..") && ++ sde->d_type != DT_DIR) { ++ size_t tm = snprintf(devicename, sizeof(devicename), "%s/%s", de->d_name, sde->d_name); ++ device_added(devicename, tm, 0); ++ } ++ free(sde); ++ } ++ free(snamelist); ++ } ++ free(de); + } ++ free(namelist); + -+ if ((sock_devd = connect_devd()) < 0) -+ return 0; -+ -+ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); -+ -+ return 1; ++ devd_buf_used = 0; ++ devd_skt = connect_devd(); ++ return (devd_skt < 0) ? 0 : 1; +} + +void @@ -527,9 +885,6 @@ + rtimer = NULL; + } + -+ disconnect_devd(sock_devd); -+ -+ RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); -+ -+ is_console_kbd = false; ++ disconnect_devd(devd_skt); ++ return; +} Index: x11-servers/xorg-server/files/patch-config_udev.c =================================================================== --- x11-servers/xorg-server/files/patch-config_udev.c (nonexistent) +++ x11-servers/xorg-server/files/patch-config_udev.c (working copy) @@ -0,0 +1,53 @@ +* Don't pass the device parameter when using kbdmux to prevent conflict +* +* Specify a driver to use for basic devices (keyboard and mouse), otherwise none attaches +* +--- config/udev.c.orig 2017-03-02 23:03:58 UTC ++++ config/udev.c +@@ -29,6 +29,7 @@ + + #include + #include ++#include + #include + + #include "input.h" +@@ -188,7 +189,21 @@ device_added(struct udev_device *udev_de + attrs.product = strdup(name); + input_options = input_option_new(input_options, "name", name); + input_options = input_option_new(input_options, "path", path); +- input_options = input_option_new(input_options, "device", path); ++ if(strstr(path, "kbdmux") != NULL) { ++ /* ++ * Don't pass "device" option if the keyboard is already attached ++ * to the console (ie. open() fails). This would activate a special ++ * logic in xf86-input-keyboard. Prevent any other attached to console ++ * keyboards being processed. There can be only one such device. ++ */ ++ int fd = open(path, O_RDONLY); ++ if (fd > -1) { ++ close(fd); ++ input_options = input_option_new(input_options, "device", path); ++ } ++ } ++ else ++ input_options = input_option_new(input_options, "device", path); + input_options = input_option_new(input_options, "major", itoa(major(devnum))); + input_options = input_option_new(input_options, "minor", itoa(minor(devnum))); + if (path) +@@ -272,6 +287,15 @@ device_added(struct udev_device *udev_de + } + } + ++ if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) ++ input_options = input_option_new(input_options, "driver", "kbd"); ++ else if (attrs.flags & ATTR_POINTER) { ++ if (strstr(path, "vbox")) ++ input_options = input_option_new(input_options, "driver", "vboxmouse"); ++ else ++ input_options = input_option_new(input_options, "driver", "mouse"); ++ } ++ + input_options = input_option_new(input_options, "config_info", config_info); + + /* Default setting needed for non-seat0 seats */ Property changes on: x11-servers/xorg-server/files/patch-config_udev.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-configure =================================================================== --- x11-servers/xorg-server/files/patch-configure (revision 435783) +++ x11-servers/xorg-server/files/patch-configure (working copy) @@ -1,6 +1,41 @@ ---- configure.orig 2016-07-19 17:27:31 UTC +* generated from patched configure.ac; revise and regen instead of editing +* +* Plumb the devd config backend into configure +* +* define USE_DEV_IO for ARM platforms +* +* Only run pkg-config for udev if it is not disabled to prevent over-linking +* +* Automatically use systemd/logind only on Linux +* +--- configure.orig 2017-03-02 23:04:12 UTC +++ configure -@@ -23168,9 +23168,14 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con +@@ -1032,6 +1032,8 @@ CONFIG_UDEV_FALSE + CONFIG_UDEV_TRUE + UDEV_LIBS + UDEV_CFLAGS ++CONFIG_DEVD_FALSE ++CONFIG_DEVD_TRUE + HAVE_SYSTEMD_DAEMON_FALSE + HAVE_SYSTEMD_DAEMON_TRUE + SYSTEMD_DAEMON_LIBS +@@ -1367,6 +1369,7 @@ enable_tslib + enable_dbe + enable_xf86bigfont + enable_dpms ++enable_config_devd + enable_config_udev + enable_config_udev_kms + enable_config_hal +@@ -2191,6 +2194,7 @@ Optional Features: + --disable-dbe Build DBE extension (default: enabled) + --enable-xf86bigfont Build XF86 Big Font extension (default: disabled) + --disable-dpms Build DPMS extension (default: enabled) ++ --enable-config-devd Build devd support (default: auto) + --enable-config-udev Build udev support (default: auto) + --enable-config-udev-kms + Build udev kms support (default: auto) +@@ -23263,9 +23267,13 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con esac GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" ;; @@ -9,19 +44,122 @@ ARM_VIDEO=yes DEFAULT_INT10="stub" + case $host_os in -+ *freebsd*) -+ $as_echo "#define USE_DEV_IO 1" >>confdefs.h -+ ;; ++ *freebsd*) $as_echo "#define USE_DEV_IO 1" >>confdefs.h ++ ;; + esac ;; i*86) I386_VIDEO=yes -@@ -26057,7 +26062,7 @@ fi - case "x$XTRANS_SEND_FDS" in - xauto) - case "$host_os" in -- linux*|solaris*) -+ linux*|solaris*|freebsd*|dragonfly*|openbsd*) - XTRANS_SEND_FDS=yes - ;; - *) +@@ -24036,6 +24044,13 @@ else + DPMSExtension=yes + fi + ++# Check whether --enable-config-devd was given. ++if test "${enable_config_devd+set}" = set; then : ++ enableval=$enable_config_devd; CONFIG_DEVD=$enableval ++else ++ CONFIG_DEVD=auto ++fi ++ + # Check whether --enable-config-udev was given. + if test "${enable_config_udev+set}" = set; then : + enableval=$enable_config_udev; CONFIG_UDEV=$enableval +@@ -25796,6 +25811,31 @@ if test "x$CONFIG_UDEV" = xyes && test " + as_fn_error $? "Hotplugging through both libudev and hal not allowed" "$LINENO" 5 + fi + ++if test "x$CONFIG_DEVD" = xauto; then ++ case $host_os in ++ *freebsd*) ++ CONFIG_DEVD=yes ++ ;; ++ *) ++ CONFIG_DEVD=no ++ ;; ++ esac ++fi ++ if test "x$CONFIG_DEVD" = xyes; then ++ CONFIG_DEVD_TRUE= ++ CONFIG_DEVD_FALSE='#' ++else ++ CONFIG_DEVD_TRUE='#' ++ CONFIG_DEVD_FALSE= ++fi ++ ++if test "x$CONFIG_DEVD" = xyes; then ++ ++$as_echo "#define CONFIG_DEVD 1" >>confdefs.h ++ ++fi ++ ++if test "x$CONFIG_UDEV" != xno; then + + pkg_failed=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 +@@ -25867,11 +25907,12 @@ else + $as_echo "yes" >&6; } + HAVE_LIBUDEV=yes + fi +-if test "x$CONFIG_UDEV" = xauto; then +- CONFIG_UDEV="$HAVE_LIBUDEV" ++ if test "x$CONFIG_UDEV" = xauto; then ++ CONFIG_UDEV="$HAVE_LIBUDEV" + + $as_echo "#define HAVE_LIBUDEV 1" >>confdefs.h + ++ fi + fi + if test "x$CONFIG_UDEV" = xyes; then + CONFIG_UDEV_TRUE= +@@ -26115,7 +26156,14 @@ fi + + if test "x$SYSTEMD_LOGIND" = xauto; then + if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then +- SYSTEMD_LOGIND=yes ++ case $host_os in ++ *linux*) ++ SYSTEMD_LOGIND=yes ++ ;; ++ *) ++ SYSTEMD_LOGIND=no ++ ;; ++ esac + else + SYSTEMD_LOGIND=no + fi +@@ -32832,17 +32880,17 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER + ac_config_commands="$ac_config_commands sdksyms" + + +-if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then ++if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno && test "x$CONFIG_DEVD" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +- *********************************************** +- Neither HAL nor udev backend will be enabled. ++ ***************************************************** ++ Neither HAL, devd, nor udev backend will be enabled. + Input device hotplugging will not be available! +- ***********************************************" >&5 ++ *****************************************************" >&5 + $as_echo "$as_me: WARNING: +- *********************************************** +- Neither HAL nor udev backend will be enabled. ++ ***************************************************** ++ Neither HAL, devd, nor udev backend will be enabled. + Input device hotplugging will not be available! +- ***********************************************" >&2;} ++ *****************************************************" >&2;} + fi + + ac_config_files="$ac_config_files Makefile glx/Makefile include/Makefile composite/Makefile damageext/Makefile dbe/Makefile dix/Makefile doc/Makefile doc/dtrace/Makefile man/Makefile fb/Makefile glamor/Makefile record/Makefile config/Makefile mi/Makefile miext/Makefile miext/sync/Makefile miext/damage/Makefile miext/shadow/Makefile miext/rootless/Makefile os/Makefile pseudoramiX/Makefile randr/Makefile render/Makefile xkb/Makefile Xext/Makefile Xi/Makefile xfixes/Makefile exa/Makefile dri3/Makefile present/Makefile hw/Makefile hw/xfree86/Makefile hw/xfree86/Xorg.sh hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile hw/xfree86/dixmods/Makefile hw/xfree86/doc/Makefile hw/xfree86/dri/Makefile hw/xfree86/dri2/Makefile hw/xfree86/dri2/pci_ids/Makefile hw/xfree86/drivers/Makefile hw/xfree86/drivers/modesetting/Makefile hw/xfree86/exa/Makefile hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile hw/xfree86/fbdevhw/man/Makefile hw/xfree86/glamor_egl/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile hw/xfree86/man/Makefile hw/xfree86/modes/Makefile hw/xfree86/os-support/Makefile hw/xfree86/os-support/bsd/Makefile hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/linux/Makefile hw/xfree86/os-support/solaris/Makefile hw/xfree86/os-support/stub/Makefile hw/xfree86/parser/Makefile hw/xfree86/ramdac/Makefile hw/xfree86/shadowfb/Makefile hw/xfree86/vbe/Makefile hw/xfree86/vgahw/Makefile hw/xfree86/x86emu/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/man/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile hw/dmx/config/Makefile hw/dmx/config/man/Makefile hw/dmx/doc/Makefile hw/dmx/doxygen/doxygen.conf hw/dmx/doxygen/Makefile hw/dmx/examples/Makefile hw/dmx/input/Makefile hw/dmx/glxProxy/Makefile hw/dmx/Makefile hw/dmx/man/Makefile hw/vfb/Makefile hw/vfb/man/Makefile hw/xnest/Makefile hw/xnest/man/Makefile hw/xwin/Makefile hw/xwin/dri/Makefile hw/xwin/glx/Makefile hw/xwin/man/Makefile hw/xwin/winclipboard/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile hw/xquartz/man/Makefile hw/xquartz/mach-startup/Makefile hw/xquartz/pbproxy/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ephyr/Makefile hw/kdrive/ephyr/man/Makefile hw/kdrive/fake/Makefile hw/kdrive/fbdev/Makefile hw/kdrive/linux/Makefile hw/kdrive/src/Makefile hw/xwayland/Makefile test/Makefile test/xi1/Makefile test/xi2/Makefile xserver.ent xorg-server.pc" +@@ -33105,6 +33153,10 @@ if test -z "${HAVE_SYSTEMD_DAEMON_TRUE}" + as_fn_error $? "conditional \"HAVE_SYSTEMD_DAEMON\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${CONFIG_DEVD_TRUE}" && test -z "${CONFIG_DEVD_FALSE}"; then ++ as_fn_error $? "conditional \"CONFIG_DEVD\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${CONFIG_UDEV_TRUE}" && test -z "${CONFIG_UDEV_FALSE}"; then + as_fn_error $? "conditional \"CONFIG_UDEV\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 Index: x11-servers/xorg-server/files/patch-configure.ac =================================================================== --- x11-servers/xorg-server/files/patch-configure.ac (nonexistent) +++ x11-servers/xorg-server/files/patch-configure.ac (working copy) @@ -0,0 +1,97 @@ +* Plumb the devd config backend into configure +* +* define USE_DEV_IO for ARM platforms +* +* Only run pkg-config for udev if it is not disabled to prevent over-linking +* +* Automatically use systemd/logind only on Linux +* +--- configure.ac.orig 2017-03-02 23:03:58 UTC ++++ configure.ac +@@ -328,9 +328,12 @@ case $host_cpu in + esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" + ;; +- arm*) ++ arm*|aarch64*) + ARM_VIDEO=yes + DEFAULT_INT10="stub" ++ case $host_os in ++ *freebsd*) AC_DEFINE(USE_DEV_IO) ;; ++ esac + ;; + i*86) + I386_VIDEO=yes +@@ -628,6 +631,7 @@ AC_ARG_ENABLE(tslib, AS_HELP_ST + AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes]) + AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no]) + AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes]) ++AC_ARG_ENABLE(config-devd, AS_HELP_STRING([--enable-config-devd], [Build devd support (default: auto)]), [CONFIG_DEVD=$enableval], [CONFIG_DEVD=auto]) + AC_ARG_ENABLE(config-udev, AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto]) + AC_ARG_ENABLE(config-udev-kms, AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto]) + AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto]) +@@ -924,10 +928,27 @@ if test "x$CONFIG_UDEV" = xyes && test " + AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed]) + fi + +-PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no]) +-if test "x$CONFIG_UDEV" = xauto; then +- CONFIG_UDEV="$HAVE_LIBUDEV" +- AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.]) ++if test "x$CONFIG_DEVD" = xauto; then ++ case $host_os in ++ *freebsd*) ++ CONFIG_DEVD=yes ++ ;; ++ *) ++ CONFIG_DEVD=no ++ ;; ++ esac ++fi ++AM_CONDITIONAL(CONFIG_DEVD, [test "x$CONFIG_DEVD" = xyes]) ++if test "x$CONFIG_DEVD" = xyes; then ++ AC_DEFINE(CONFIG_DEVD, 1, [Use devd for input auto configuration]) ++fi ++ ++if test "x$CONFIG_UDEV" != xno; then ++ PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no]) ++ if test "x$CONFIG_UDEV" = xauto; then ++ CONFIG_UDEV="$HAVE_LIBUDEV" ++ AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.]) ++ fi + fi + AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes]) + if test "x$CONFIG_UDEV" = xyes; then +@@ -975,7 +996,14 @@ AM_CONDITIONAL(CONFIG_HAL, [test "x$CONF + + if test "x$SYSTEMD_LOGIND" = xauto; then + if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then +- SYSTEMD_LOGIND=yes ++ case $host_os in ++ *linux*) ++ SYSTEMD_LOGIND=yes ++ ;; ++ *) ++ SYSTEMD_LOGIND=no ++ ;; ++ esac + else + SYSTEMD_LOGIND=no + fi +@@ -2570,12 +2598,12 @@ AC_SUBST([prefix]) + + AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep]) + +-if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then ++if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno && test "x$CONFIG_DEVD" = xno; then + AC_MSG_WARN([ +- *********************************************** +- Neither HAL nor udev backend will be enabled. ++ ***************************************************** ++ Neither HAL, devd, nor udev backend will be enabled. + Input device hotplugging will not be available! +- ***********************************************]) ++ *****************************************************]) + fi + + AC_CONFIG_FILES([ Property changes on: x11-servers/xorg-server/files/patch-configure.ac ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.am =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.am (nonexistent) +++ x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.am (working copy) @@ -0,0 +1,14 @@ +* Don't overwrite Xorg binary with Xorg.sh when SUID_WRAPPER_DIR == bindir +* Instead, relink bin/X to Xorg.wrap rather than to Xorg (which isn't Xorg.sh) +* +--- hw/xfree86/Makefile.am.orig 2017-03-10 14:14:25 UTC ++++ hw/xfree86/Makefile.am +@@ -109,7 +109,7 @@ endif + if SUID_WRAPPER + $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) + mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg +- ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg ++ (test ! -f $(DESTDIR)$(bindir)/Xorg && ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg || cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg.wrap$(EXEEXT) X) + -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap + endif + Property changes on: x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.am ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in (nonexistent) +++ x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in (working copy) @@ -0,0 +1,14 @@ +* Don't overwrite Xorg binary with Xorg.sh when SUID_WRAPPER_DIR == bindir +* Instead, relink bin/X to Xorg.wrap rather than to Xorg (which isn't Xorg.sh) +* +--- hw/xfree86/Makefile.in.orig 2017-03-10 14:14:25 UTC ++++ hw/xfree86/Makefile.in +@@ -1149,7 +1149,7 @@ install-exec-hook: + @INSTALL_SETUID_TRUE@ chmod u+s $(DESTDIR)$(bindir)/Xorg + @SUID_WRAPPER_TRUE@ $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) + @SUID_WRAPPER_TRUE@ mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg +-@SUID_WRAPPER_TRUE@ ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg ++@SUID_WRAPPER_TRUE@ (test ! -f $(DESTDIR)$(bindir)/Xorg && ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg || cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg.wrap$(EXEEXT) X) + @SUID_WRAPPER_TRUE@ -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap + + uninstall-local: Property changes on: x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c (working copy) @@ -1,4 +1,8 @@ ---- hw/xfree86/common/xf86AutoConfig.c.orig 2017-01-11 20:00:58 UTC +* Try using modesetting driver before falling back to scfb or vesa +* +* Use our scfb driver as fallback instead of Linux's fbdev +* +--- hw/xfree86/common/xf86AutoConfig.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/common/xf86AutoConfig.c @@ -276,7 +276,7 @@ listPossibleVideoDrivers(char *matches[] i += xf86PciMatchDriver(&matches[i], nmatches - i); Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c (working copy) @@ -1,12 +1,14 @@ ---- hw/xfree86/common/xf86Config.c.orig 2016-07-19 17:14:30 UTC +* Select the devd config backend if it is activated +* +--- hw/xfree86/common/xf86Config.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/common/xf86Config.c -@@ -1410,13 +1410,16 @@ checkCoreInputDevices(serverLayoutPtr se +@@ -1375,13 +1375,16 @@ checkCoreInputDevices(serverLayoutPtr se } if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) { -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \ -+ defined(CONFIG_DEVD) ++ defined(CONFIG_DEVD) const char *config_backend; #if defined(CONFIG_HAL) Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c (working copy) @@ -1,4 +1,6 @@ ---- hw/xfree86/common/xf86Globals.c.orig 2016-07-19 17:07:29 UTC +* Include devd in the set of config backends +* +--- hw/xfree86/common/xf86Globals.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/common/xf86Globals.c @@ -122,7 +122,8 @@ xf86InfoRec xf86Info = { .pmFlag = TRUE, Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c (working copy) @@ -1,6 +1,8 @@ ---- hw/xfree86/common/xf86Xinput.c.orig 2016-07-19 17:07:29 UTC +* Recognize devd backend as a source of auto-configured devices +* +--- hw/xfree86/common/xf86Xinput.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/common/xf86Xinput.c -@@ -841,7 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D +@@ -871,7 +871,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D { InputDriverPtr drv = NULL; DeviceIntPtr dev = NULL; @@ -9,7 +11,7 @@ int rval; char *path = NULL; -@@ -996,6 +996,7 @@ NewInputDeviceRequest(InputOption *optio +@@ -1034,6 +1034,7 @@ NewInputDeviceRequest(InputOption *optio if (strcmp(key, "_source") == 0 && (strcmp(value, "server/hal") == 0 || strcmp(value, "server/udev") == 0 || Index: x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c (working copy) @@ -1,4 +1,4 @@ ---- hw/xfree86/os-support/bsd/bsd_init.c.orig 2016-07-19 17:07:29 UTC +--- hw/xfree86/os-support/bsd/bsd_init.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/os-support/bsd/bsd_init.c @@ -230,6 +230,9 @@ xf86OpenConsole() * Add cases for other *BSD that behave the same. Index: x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_i386__video.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_i386__video.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_i386__video.c (working copy) @@ -1,5 +1,5 @@ Index: programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c ---- hw/xfree86/os-support/bsd/i386_video.c.orig 2016-07-15 16:18:11 UTC +--- hw/xfree86/os-support/bsd/i386_video.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/os-support/bsd/i386_video.c @@ -32,6 +32,7 @@ #include "xf86Priv.h" Index: x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_ppc__video.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_ppc__video.c (revision 435783) +++ x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_ppc__video.c (working copy) @@ -1,4 +1,4 @@ ---- hw/xfree86/os-support/bsd/ppc_video.c.orig 2016-07-15 16:18:11 UTC +--- hw/xfree86/os-support/bsd/ppc_video.c.orig 2017-03-02 23:03:58 UTC +++ hw/xfree86/os-support/bsd/ppc_video.c @@ -79,7 +79,11 @@ xf86DisableIO() { Index: x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c (nonexistent) +++ x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c (working copy) @@ -0,0 +1,27 @@ +* Skip the detection of root rights requirement, the assumption that presence +* of KMS drivers removes the root requirement is only valid for Linux +* +--- hw/xfree86/xorg-wrapper.c.orig 2017-03-02 23:03:58 UTC ++++ hw/xfree86/xorg-wrapper.c +@@ -188,9 +188,6 @@ static int on_console(int fd) + + int main(int argc, char *argv[]) + { +-#ifdef WITH_LIBDRM +- struct drm_mode_card_res res; +-#endif + char buf[PATH_MAX]; + int i, r, fd; + int kms_cards = 0; +@@ -227,9 +224,10 @@ int main(int argc, char *argv[]) + } + } + +-#ifdef WITH_LIBDRM ++#if defined(WITH_LIBDRM) && defined(__linux__) + /* Detect if we need root rights, except when overriden by the config */ + if (needs_root_rights == -1) { ++ struct drm_mode_card_res res; + for (i = 0; i < 16; i++) { + snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, i); + fd = open(buf, O_RDWR); Property changes on: x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-include_dix-config.h.in =================================================================== --- x11-servers/xorg-server/files/patch-include_dix-config.h.in (nonexistent) +++ x11-servers/xorg-server/files/patch-include_dix-config.h.in (working copy) @@ -0,0 +1,14 @@ +* Add a define which will be toggled by configure when devd backend is activated +* +--- include/dix-config.h.in.orig 2017-03-02 23:03:58 UTC ++++ include/dix-config.h.in +@@ -433,6 +433,9 @@ + /* Support D-Bus */ + #undef HAVE_DBUS + ++/* Use devd for input hotplug */ ++#undef CONFIG_DEVD ++ + /* Use libudev for input hotplug */ + #undef CONFIG_UDEV + Property changes on: x11-servers/xorg-server/files/patch-include_dix-config.h.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-xkb_Makefile.am =================================================================== --- x11-servers/xorg-server/files/patch-xkb_Makefile.am (nonexistent) +++ x11-servers/xorg-server/files/patch-xkb_Makefile.am (working copy) @@ -0,0 +1,13 @@ +* Skip installing a README into a directory which is actually a symlink created +* by another port. If this file is installed, then upon uninstall pkg will +* delete the directory under the symlink, which would cause a reinstall to fail +* as the target directory is not remade until reinstalling the other port +* +--- xkb/Makefile.am.orig 2017-03-10 14:14:25 UTC ++++ xkb/Makefile.am +@@ -39,4 +39,4 @@ libxkbstubs_la_SOURCES = ddxVT.c ddxPriv + EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h + + xkbcompileddir = $(XKB_COMPILED_DIR) +-dist_xkbcompiled_DATA = README.compiled ++#dist_xkbcompiled_DATA = README.compiled Property changes on: x11-servers/xorg-server/files/patch-xkb_Makefile.am ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-xkb_Makefile.in =================================================================== --- x11-servers/xorg-server/files/patch-xkb_Makefile.in (revision 435783) +++ x11-servers/xorg-server/files/patch-xkb_Makefile.in (working copy) @@ -1,6 +1,11 @@ ---- xkb/Makefile.in.orig 2017-01-19 15:20:42 UTC +* Skip installing a README into a directory which is actually a symlink created +* by another port. If this file is installed, then upon uninstall pkg will +* delete the directory under the symlink, which would cause a reinstall to fail +* as the target directory is not remade until reinstalling the other port +* +--- xkb/Makefile.in.orig 2017-03-10 14:14:25 UTC +++ xkb/Makefile.in -@@ -878,7 +878,7 @@ info: info-am +@@ -886,7 +886,7 @@ info: info-am info-am: Index: x11-servers/xorg-server/pkg-plist =================================================================== --- x11-servers/xorg-server/pkg-plist (revision 435783) +++ x11-servers/xorg-server/pkg-plist (working copy) @@ -1,6 +1,6 @@ bin/X -%%SUID%%@(,,4555) bin/Xorg -%%NO_SUID%%bin/Xorg +bin/Xorg +%%SUID%%@(,,4555) bin/Xorg.wrap bin/cvt bin/gtf include/xorg/BT.h @@ -159,7 +159,7 @@ include/xorg/xorg-server.h include/xorg/xorgVersion.h include/xorg/xserver-properties.h -@comment include/xorg/xserver_poll.h +include/xorg/xserver_poll.h include/xorg/xvdix.h include/xorg/xvmcext.h lib/xorg/modules/drivers/modesetting_drv.so @@ -177,6 +177,7 @@ lib/xorg/protocol.txt libdata/pkgconfig/xorg-server.pc man/man1/Xorg.1.gz +%%SUID%%man/man1/Xorg.wrap.1.gz man/man1/Xserver.1.gz man/man1/cvt.1.gz man/man1/gtf.1.gz @@ -183,7 +184,9 @@ man/man4/exa.4.gz man/man4/fbdevhw.4.gz man/man4/modesetting.4.gz +%%SUID%%man/man5/Xwrapper.config.5.gz man/man5/xorg.conf.5.gz man/man5/xorg.conf.d.5.gz +%%UDEV%%share/X11/xorg.conf.d/10-quirks.conf share/aclocal/xorg-server.m4 @dir etc/X11/xorg.conf.d Index: x11-servers/xorg-vfbserver/Makefile =================================================================== --- x11-servers/xorg-vfbserver/Makefile (revision 435783) +++ x11-servers/xorg-vfbserver/Makefile (working copy) @@ -2,7 +2,6 @@ # $FreeBSD$ PORTNAME= xorg-vfbserver -PORTVERSION= 1.19.1 PORTEPOCH= 1 COMMENT= X virtual framebuffer server from X.Org @@ -11,14 +10,9 @@ MASTERDIR= ${.CURDIR}/../xorg-server DESCR= ${.CURDIR}/pkg-descr -DISTINFO_FILE= ${.CURDIR}/distinfo -PATCHDIR= ${.CURDIR}/files SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID -USE_XORG= xfont2 - CONFIGURE_ARGS+=--enable-xvfb --disable-dmx --disable-xephyr --disable-xnest \ --disable-xwayland Index: x11-servers/xorg-vfbserver/distinfo =================================================================== --- x11-servers/xorg-vfbserver/distinfo (revision 435783) +++ x11-servers/xorg-vfbserver/distinfo (nonexistent) @@ -1,3 +0,0 @@ -TIMESTAMP = 1484389062 -SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb -SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792 Property changes on: x11-servers/xorg-vfbserver/distinfo ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xwayland/Makefile =================================================================== --- x11-servers/xwayland/Makefile (revision 435783) +++ x11-servers/xwayland/Makefile (working copy) @@ -1,7 +1,6 @@ # $FreeBSD$ PORTNAME= xwayland -PORTVERSION= 1.19.1 COMMENT= X Clients under Wayland @@ -13,18 +12,13 @@ MASTERDIR= ${.CURDIR}/../xorg-server DESCR= ${.CURDIR}/pkg-descr -DISTINFO_FILE= ${.CURDIR}/distinfo -PATCHDIR= ${.CURDIR}/files SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID - -USE_XORG= x11 xext xfont2 +USE_XORG= x11 xext USE_GL+= egl gbm -CONFIGURE_ARGS+= --disable-docs --disable-devel-docs \ - --enable-xwayland --disable-xorg --disable-xvfb --disable-xnest \ - --disable-xquartz --disable-xwin +CONFIGURE_ARGS+=--disable-dmx --disable-xephyr --disable-xnest --disable-xvfb \ + --enable-xwayland PLIST_FILES= bin/Xwayland Index: x11-servers/xwayland/distinfo =================================================================== --- x11-servers/xwayland/distinfo (revision 435783) +++ x11-servers/xwayland/distinfo (nonexistent) @@ -1,3 +0,0 @@ -TIMESTAMP = 1484388904 -SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb -SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792 Property changes on: x11-servers/xwayland/distinfo ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property