pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/50200: x11/modular-xorg-server



>Number:         50200
>Category:       pkg
>Synopsis:       x11/modular-xorg-server
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 03 22:15:00 +0000 2015
>Originator:     David Shao
>Release:        pkgsrc current
>Organization:
>Environment:
DragonFly  4.3-DEVELOPMENT DragonFly v4.3.1.401.g3f4ec-DEVELOPMENT #2: Thu Sep  3 07:03:26 PDT 2015     xxxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64

>Description:
The following patches are from DragonFly dports / FreeBSD ports for devd support in x11/modular-xorg-server.  When devd support is working, one's /var/log/Xorg.0.log has lines similar to this:

[    45.490] (II) config/devd: probing input devices...
[    45.490] (II) config/devd: adding input device (null) (/dev/kbdmux)
[    45.490] (II) LoadModule: "kbd"
[    45.490] (II) Loading /usr/pkg/lib/xorg/modules/input/kbd_drv.so
[    45.513] (II) Module kbd: vendor="X.Org Foundation"
[    45.513] 	compiled for 1.17.2, module version = 1.8.1
[    45.513] 	Module class: X.Org XInput Driver
[    45.513] 	ABI class: X.Org XInput driver, version 21.0
[    45.513] (II) Using input driver 'kbd' for 'kbdmux'
[    45.513] (**) kbdmux: always reports core events
[    45.513] (**) kbdmux: always reports core events
[    45.513] (**) Option "Protocol" "standard"
[    45.513] (**) Option "XkbRules" "base"
[    45.513] (**) Option "XkbModel" "pc105"
[    45.513] (**) Option "XkbLayout" "us"
[    45.513] (**) Option "config_info" "devd:kbdmux"
[    45.513] (II) XINPUT: Adding extended input device "kbdmux" (type: KEYBOARD, id 6)
[    45.704] (II) config/devd: kbdmux is enabled, ignoring device ukbd0
[    45.704] (II) config/devd: kbdmux is enabled, ignoring device atkbd0
[    45.704] (II) config/devd: adding input device (null) (/dev/sysmouse)
[    45.704] (II) LoadModule: "mouse"
[    45.704] (II) Loading /usr/pkg/lib/xorg/modules/input/mouse_drv.so
[    45.719] (II) Module mouse: vendor="X.Org Foundation"
[    45.719] 	compiled for 1.17.2, module version = 1.9.1
[    45.719] 	Module class: X.Org XInput Driver
[    45.719] 	ABI class: X.Org XInput driver, version 21.0
[    45.719] (II) Using input driver 'mouse' for 'sysmouse'
[    45.719] (**) sysmouse: always reports core events
[    45.719] (**) Option "Device" "/dev/sysmouse"
[    45.719] (==) sysmouse: Protocol: "Auto"
[    45.719] (**) sysmouse: always reports core events
[    45.719] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[    45.719] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[    45.719] (**) sysmouse: Buttons: 5
[    45.719] (**) Option "config_info" "devd:sysmouse"
[    45.719] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[    45.720] (**) sysmouse: (accel) keeping acceleration scheme 1
[    45.720] (**) sysmouse: (accel) acceleration profile 0
[    45.720] (**) sysmouse: (accel) acceleration factor: 2.000
[    45.720] (**) sysmouse: (accel) acceleration threshold: 4
[    45.720] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[    45.720] (II) sysmouse: SetupAuto: protocol is SysMouse
[    45.720] (II) config/devd: device /dev/ums0 already opened

The patches have been tested on DragonFly 4.3-DEVELOPMENT and FreeBSD 10.2 release, 10.2 stable, and 11 current and on a Radeon 5570, a Radeon 6450, and Radeon R7 240, and Intel integrated graphics EagleLake G45 and IvyBridge, to the limits of what the operating system kernels support (FreeBSD not supporting any of Intel graphics using the latest ports nor the Radeon R7 240).
>How-To-Repeat:

>Fix:
I'm sorry but I'm throwing in also the glamor and debug options because that is what is working on my systems.

diff -Nurb modular-xorg-server.orig/options.mk modular-xorg-server/options.mk
--- modular-xorg-server.orig/options.mk	2015-04-29 08:11:02.000000000 -0700
+++ modular-xorg-server/options.mk	2015-08-15 05:38:07.911535000 -0700
@@ -1,9 +1,17 @@
 # $NetBSD: options.mk,v 1.11 2015/04/29 15:11:02 tnn Exp $
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.modular-xorg-server
-PKG_SUPPORTED_OPTIONS=	dri inet6 debug dtrace
+PKG_SUPPORTED_OPTIONS=	dri inet6 debug dtrace devd
+PKG_SUPPORTED_OPTIONS+= glamor	
 PKG_SUGGESTED_OPTIONS=	dri inet6
 
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= devd
+# CONFIGURE_ARGS+=	--disable-xvfb
+# CONFIGURE_ARGS+=	--disable-xnest 
+CONFIGURE_ARGS+=	--enable-record=yes
+.endif
+
 .include "../../mk/bsd.options.mk"
 
 PLIST_VARS+=		dri dri3 dtrace
@@ -41,13 +49,17 @@
 	(echo "all:"; echo "install:") > ${WRKSRC}/hw/xfree86/drivers/modesetting/Makefile
 .endif
 
-#.if !empty(PKG_OPTIONS:Mglamor)
-#.include "../../x11/dri3proto/buildlink3.mk"
-#.include "../../x11/libxshmfence/buildlink3.mk"
-#CONFIGURE_ARGS+=	--enable-xtrans-send-fds
-#CONFIGURE_ARGS+=	--enable-dri3
-#CONFIGURE_ARGS+=	--enable-glamor
-#.endif
+PLIST_VARS+=		glamor
+.if !empty(PKG_OPTIONS:Mglamor)
+# .include "../../x11/dri3proto/buildlink3.mk"
+.if ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
+.include "../../x11/libxshmfence/buildlink3.mk"
+.endif
+# CONFIGURE_ARGS+=	--enable-xtrans-send-fds
+# CONFIGURE_ARGS+=	--enable-dri3
+CONFIGURE_ARGS+=	--enable-glamor
+PLIST.glamor=		yes
+.endif
 
 .if !empty(PKG_OPTIONS:Minet6)
 CONFIGURE_ARGS+=	--enable-ipv6
@@ -57,7 +69,8 @@
 
 .if !empty(PKG_OPTIONS:Mdebug)
 CONFIGURE_ARGS+=	--enable-debug
-CFLAGS+=		-ggdb
+#CFLAGS+=		-ggdb
+CFLAGS+=		-O0 -g3
 .endif
 
 .if !empty(PKG_OPTIONS:Mdtrace)
@@ -66,3 +79,17 @@
 .else
 CONFIGURE_ARGS+=	--without-dtrace
 .endif
+
+.if !empty(PKG_OPTIONS:Mdevd)
+SUBST_CLASSES+=			devd_config
+SUBST_STAGE.devd_config=	pre-build
+SUBST_MESSAGE.devd_config=	Patching config/Makefile for devd
+SUBST_FILES.devd_config+=	config/Makefile
+SUBST_SED.devd_config+=		-e 's|config\.c|config.c devd.c|g'
+SUBST_SED.devd_config+=		-e 's|config\.lo|config.lo devd.lo|g'
+SUBST_CLASSES+=			devd_dix
+SUBST_STAGE.devd_dix=		post-configure
+SUBST_MESSAGE.devd_dix=		Patching include/dix-config.h for devd 
+SUBST_FILES.devd_dix+=		include/dix-config.h	
+SUBST_SED.devd_dix+=		-e 's|/\* \#undef CONFIG_UDEV \*/|\#define CONFIG_DEVD 1 |'
+.endif

diff -Nurb modular-xorg-server.orig/patches/patch-config_config-backends.h modular-xorg-server/patches/patch-config_config-backends.h
--- modular-xorg-server.orig/patches/patch-config_config-backends.h	1969-12-31 16:00:00.000000000 -0800
+++ modular-xorg-server/patches/patch-config_config-backends.h	2015-07-29 22:10:53.327463000 -0700
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- config/config-backends.h.orig	2015-05-21 14:23:54.000000000 +0000
++++ config/config-backends.h
+@@ -44,3 +44,8 @@ void config_hal_fini(void);
+ int config_wscons_init(void);
+ void config_wscons_fini(void);
+ #endif
++
++#ifdef CONFIG_DEVD
++int config_devd_init(void);
++void config_devd_fini(void);
++#endif
diff -Nurb modular-xorg-server.orig/patches/patch-config_config.c modular-xorg-server/patches/patch-config_config.c
--- modular-xorg-server.orig/patches/patch-config_config.c	1969-12-31 16:00:00.000000000 -0800
+++ modular-xorg-server/patches/patch-config_config.c	2015-07-18 16:42:23.587126000 -0700
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- config/config.c.orig	2015-07-18 23:39:56.348775000 +0000
++++ config/config.c
+@@ -55,6 +55,9 @@ config_init(void)
+ #elif defined(CONFIG_WSCONS)
+     if (!config_wscons_init())
+         ErrorF("[config] failed to initialise wscons\n");
++#elif defined(CONFIG_DEVD)
++    if (!config_devd_init())
++        ErrorF("[config] failed to initialise devd\n");
+ #endif
+ }
+ 
+@@ -67,6 +70,8 @@ config_fini(void)
+     config_hal_fini();
+ #elif defined(CONFIG_WSCONS)
+     config_wscons_fini();
++#elif defined(CONFIG_DEVD)
++    config_devd_fini();
+ #endif
+ }
+ 
diff -Nurb modular-xorg-server.orig/patches/patch-config_devd.c modular-xorg-server/patches/patch-config_devd.c
--- modular-xorg-server.orig/patches/patch-config_devd.c	1969-12-31 16:00:00.000000000 -0800
+++ modular-xorg-server/patches/patch-config_devd.c	2015-07-29 21:59:49.936935000 -0700
@@ -0,0 +1,540 @@
+$NetBSD$
+
+--- config/devd.c.orig	2015-07-30 04:46:21.648387000 +0000
++++ config/devd.c
+@@ -0,0 +1,535 @@
++/*
++ * Copyright (c) 2012 Baptiste Daroussin
++ * Copyright (c) 2013, 2014 Alex Kozlov
++ * Copyright (c) 2014 Robert Millan
++ * Copyright (c) 2014 Jean-Sebastien Pedron
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Author: Baptiste Daroussin <bapt%FreeBSD.org@localhost>
++ */
++
++#ifdef HAVE_DIX_CONFIG_H
++#include <dix-config.h>
++#endif
++
++#ifdef CONFIG_DEVD
++
++#include <sys/types.h>
++#include <sys/kbio.h>
++#include <sys/socket.h>
++#include <sys/stat.h>
++#include <sys/sysctl.h>
++#include <sys/un.h>
++
++#include <ctype.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <stdbool.h>
++#include <unistd.h>
++
++#include "input.h"
++#include "inputstr.h"
++#include "hotplug.h"
++#include "config-backends.h"
++#include "os.h"
++
++#define DEVD_SOCK_PATH "/var/run/devd.pipe"
++
++#define DEVD_EVENT_ADD		'+'
++#define DEVD_EVENT_REMOVE	'-'
++
++#define RECONNECT_DELAY		5 * 1000
++
++static int sock_devd;
++static bool is_console_kbd = false;
++static bool is_kbdmux = false;
++OsTimerPtr rtimer;
++
++struct hw_type {
++	const char *driver;
++	int flag;
++	const char *xdriver;
++};
++
++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 },
++};
++
++static bool
++sysctl_exists(const struct hw_type *device, int unit,
++	char *devname, size_t devname_len)
++{
++	char sysctlname[PATH_MAX];
++	size_t len;
++	int ret;
++
++	if (device == NULL || device->driver == NULL)
++		return false;
++
++	/* Check if a sysctl exists. */
++	snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
++	    device->driver, unit);
++	ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
++
++	if (ret == 0 && len > 0) {
++		snprintf(devname, devname_len, "%s%i", device->driver, unit);
++		return true;
++	}
++
++	return false;
++}
++
++static bool
++devpath_exists(const struct hw_type *device,
++	char *devname, size_t devname_len)
++{
++	char *devpath;
++	struct stat st;
++	int ret;
++
++	if (device == NULL || device->driver == NULL)
++		return false;
++
++	/* Check if /dev/$driver exists. */
++	asprintf(&devpath, "/dev/%s", device->driver);
++	if (devpath == NULL)
++		return false;
++
++	ret = stat(devpath, &st);
++	free(devpath);
++
++	if (ret == 0) {
++		strncpy(devname, device->driver, devname_len);
++		return true;
++	}
++
++	return false;
++}
++
++static char *
++sysctl_get_str(const char *sysctlname)
++{
++	char *dest = NULL;
++	size_t len;
++
++	if (sysctlname == NULL)
++		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;
++			}
++		}
++	}
++
++	return dest;
++}
++
++static void
++device_added(const char *devname)
++{
++	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;
++
++	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;
++		}
++	}
++
++	if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
++		LogMessage(X_INFO, "config/devd: ignoring device %s\n",
++				devname);
++		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);
++		return;
++	}
++
++	snprintf(path, sizeof(path), "/dev/%s", devname);
++
++	options = input_option_new(NULL, "_source", "server/devd");
++	if (!options)
++		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)");
++
++		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);
++
++			/*
++			 * Fail if cannot open device, it breaks AllowMouseOpenFail,
++			 * but it should not matter when config/devd enabled
++			 */
++			goto unwind;
++		}
++
++		if (is_console_kbd) {
++			/*
++			 * 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;
++		}
++		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;
++	}
++
++	if (asprintf(&config_info, "devd:%s", devname) == -1) {
++		config_info = NULL;
++		goto unwind;
++	}
++
++	if (device_is_duplicate(config_info)) {
++		LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
++				"ignoring\n", attrs.product, path);
++		goto unwind;
++	}
++
++	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);
++}
++
++static void
++device_removed(char *devname)
++{
++	char *config_info;
++
++	if (asprintf(&config_info, "devd:%s", devname) == -1)
++		return;
++
++	remove_devices("devd", config_info);
++
++	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;
++	}
++
++	close(fd);
++
++	if (!strncmp(info.kb_name, "kbdmux", 6))
++		return true;
++
++	return false;
++}
++
++static void
++disconnect_devd(int sock)
++{
++	if (sock >= 0) {
++		RemoveGeneralSocket(sock);
++		close(sock);
++	}
++}
++
++static int
++connect_devd(void)
++{
++	struct sockaddr_un devd;
++	int sock;
++
++	sock = socket(AF_UNIX, SOCK_STREAM, 0);
++	if (sock < 0) {
++		LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
++		return -1;
++	}
++
++	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) {
++		close(sock);
++		LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
++		return -1;
++	}
++
++	AddGeneralSocket(sock);
++
++	return	sock;
++}
++
++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;
++}
++
++static ssize_t
++socket_getline(int fd, char **out)
++{
++	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");
++			return -1;
++		}
++		if (c == '\n')
++			break;
++
++		if (sz + 1 >= cap) {
++			cap *= 2;
++			newbuf = realloc(buf, cap * sizeof(char));
++			if (!newbuf) {
++				free(buf);
++				return -1;
++			}
++			buf = newbuf;
++		}
++		buf[sz] = c;
++		sz++;
++	}
++
++	buf[sz] = '\0';
++	if (sz >= 0)
++		*out = buf;
++	else
++		free(buf);
++
++	/* 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)
++			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);
++	}
++}
++
++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");
++
++	/*
++	 * Add fake keyboard and give up on keyboards management
++	 * if kbdmux is enabled
++	 */
++	if ((is_kbdmux = is_kbdmux_enabled()) == true)
++		device_added("kbdmux");
++
++	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);
++		}
++
++		if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
++			device_added(devicename);
++	}
++
++	if ((sock_devd = connect_devd()) < 0)
++		return 0;
++
++	RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
++
++	return 1;
++}
++
++void
++config_devd_fini(void)
++{
++	LogMessage(X_INFO, "config/devd: terminating backend...\n");
++
++	if (rtimer) {
++		TimerFree(rtimer);
++		rtimer = NULL;
++	}
++
++	disconnect_devd(sock_devd);
++
++	RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
++
++	is_console_kbd = false;
++}
++
++#endif /* CONFIG_DEVD */
diff -Nurb modular-xorg-server.orig/patches/patch-hw_xfree86_common_xf86Config.c modular-xorg-server/patches/patch-hw_xfree86_common_xf86Config.c
--- modular-xorg-server.orig/patches/patch-hw_xfree86_common_xf86Config.c	1969-12-31 16:00:00.000000000 -0800
+++ modular-xorg-server/patches/patch-hw_xfree86_common_xf86Config.c	2015-07-18 16:43:30.846372000 -0700
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- hw/xfree86/common/xf86Config.c.orig	2015-07-18 23:34:36.392362000 +0000
++++ hw/xfree86/common/xf86Config.c
+@@ -1362,13 +1362,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)
+         const char *config_backend;
+ 
+ #if defined(CONFIG_HAL)
+         config_backend = "HAL";
+ #elif defined(CONFIG_UDEV)
+         config_backend = "udev";
++#elif defined(CONFIG_DEVD)
++	config_backend = "devd";
+ #else
+         config_backend = "wscons";
+ #endif
diff -Nurb modular-xorg-server.orig/patches/patch-hw_xfree86_common_xf86Globals.c modular-xorg-server/patches/patch-hw_xfree86_common_xf86Globals.c
--- modular-xorg-server.orig/patches/patch-hw_xfree86_common_xf86Globals.c	1969-12-31 16:00:00.000000000 -0800
+++ modular-xorg-server/patches/patch-hw_xfree86_common_xf86Globals.c	2015-07-18 16:43:49.966158000 -0700
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- hw/xfree86/common/xf86Globals.c.orig	2015-07-18 23:25:51.820719000 +0000
++++ hw/xfree86/common/xf86Globals.c
+@@ -122,7 +122,8 @@ xf86InfoRec xf86Info = {
+     .pmFlag = TRUE,
+     .disableRandR = FALSE,
+     .randRFrom = X_DEFAULT,
+-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
++#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
++	defined(CONFIG_DEVD)
+     .forceInputDevices = FALSE,
+     .autoAddDevices = TRUE,
+     .autoEnableDevices = TRUE,
diff -Nurb modular-xorg-server.orig/patches/patch-hw_xfree86_common_xf86Xinput.c modular-xorg-server/patches/patch-hw_xfree86_common_xf86Xinput.c
--- modular-xorg-server.orig/patches/patch-hw_xfree86_common_xf86Xinput.c	1969-12-31 16:00:00.000000000 -0800
+++ modular-xorg-server/patches/patch-hw_xfree86_common_xf86Xinput.c	2015-07-29 20:47:20.383925000 -0700
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- hw/xfree86/common/xf86Xinput.c.orig	2015-07-30 03:44:20.375499000 +0000
++++ hw/xfree86/common/xf86Xinput.c
+@@ -992,6 +992,7 @@ NewInputDeviceRequest(InputOption *optio
+         if (strcmp(key, "_source") == 0 &&
+             (strcmp(value, "server/hal") == 0 ||
+              strcmp(value, "server/udev") == 0 ||
++             strcmp(value, "server/devd") == 0 ||
+              strcmp(value, "server/wscons") == 0)) {
+             is_auto = 1;
+             if (!xf86Info.autoAddDevices) {

diff -Nurb modular-xorg-server.orig/PLIST modular-xorg-server/PLIST
--- modular-xorg-server.orig/PLIST	2015-06-08 22:05:37.000000000 -0700
+++ modular-xorg-server/PLIST	2015-08-14 20:40:36.464378000 -0700
@@ -52,6 +52,7 @@
 include/xorg/gcstruct.h
 include/xorg/geext.h
 include/xorg/geint.h
+${PLIST.glamor}include/xorg/glamor.h
 include/xorg/globals.h
 include/xorg/glx_extinit.h
 include/xorg/glyphstr.h
@@ -171,6 +172,7 @@
 lib/xorg/modules/libexa.la
 lib/xorg/modules/libfb.la
 lib/xorg/modules/libfbdevhw.la
+${PLIST.glamor}lib/xorg/modules/libglamoregl.la
 lib/xorg/modules/libint10.la
 lib/xorg/modules/libshadow.la
 lib/xorg/modules/libshadowfb.la




These changes are not really related to devd but some magic incantation got things working on some system, so I'm just listing what is there.

diff -Nurb modular-xorg-server.orig/Makefile.common modular-xorg-server/Makefile.common
--- modular-xorg-server.orig/Makefile.common	2015-07-07 14:51:22.000000000 -0700
+++ modular-xorg-server/Makefile.common	2015-08-18 20:54:55.368747000 -0700
@@ -28,9 +28,9 @@
 CONFIGURE_ARGS+=	--localstatedir=${VARBASE:Q}
 CONFIGURE_ARGS+=	--with-xkb-output=${XKB_OUTPUT_DIR:Q}
 
-.if !empty(USE_TOOLS:Mauto*)
-TOOLS_DEPENDS+=	xorg-util-macros>=1.1.5:../../devel/xorg-util-macros
-.endif
+# .if !empty(USE_TOOLS:Mauto*)
+# TOOLS_DEPENDS+=	xorg-util-macros>=1.1.5:../../devel/xorg-util-macros
+# .endif
 
 DEPENDS+=	xkbcomp-[0-9]*:../../x11/xkbcomp
 DEPENDS+=	xkeyboard-config-[0-9]*:../../x11/xkeyboard-config
@@ -134,6 +134,8 @@
 CONFIGURE_ARGS+=	--with-sha1=libnettle
 .endif
 
+.include "../../devel/xorg-util-macros/buildlink3.mk"
+
 .include "../../devel/ncurses/buildlink3.mk"
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../fonts/libfontenc/buildlink3.mk"
@@ -150,10 +152,13 @@
 .include "../../x11/libX11/buildlink3.mk"
 .include "../../x11/libXau/buildlink3.mk"
 .include "../../x11/libXaw/buildlink3.mk"
+.include "../../x11/libXdmcp/buildlink3.mk"
 BUILDLINK_API_DEPENDS.libXext+=	libXext>=1.1.1
 .include "../../x11/libXext/buildlink3.mk"
 .include "../../x11/libXfixes/buildlink3.mk"
 .include "../../x11/libXfont/buildlink3.mk"
+.include "../../x11/libXmu/buildlink3.mk"
+.include "../../x11/libXpm/buildlink3.mk"
 .include "../../x11/libXt/buildlink3.mk"
 .include "../../x11/libXxf86misc/buildlink3.mk"
 .include "../../x11/libXxf86vm/buildlink3.mk"



Home | Main Index | Thread Index | Old Index