freebsd-ports/x11-servers/xorg-server/files/patch-config_udev.c
Niclas Zeising 4b9c697c26 Update xorg x11 servers to 1.20.7
Update xorg x11 servers to 1.20.7.  This updates x11-servers/xorg-server,
xephyr, xorg-dmx, xorg-nestserver, xorg-vbserver and xwayland.

Enable the UDEV backend by default, instead of the DEVD backend, for
autoconfiguration of input devices on FreeBSD 12 and later.
FreeBSD 11 lacks the needed support in base and will keep on using the DEVD
backend.
Support for the HAL backend is dropped completely, it has been deprecated
for a long time.
Update and improve the DEVD backend.
Add a pkg message about sysctl configuration that might be needed when using
UDEV.

Use the upstream fix for glamour issues.

Use evdev xkb rules by default in xwayland [2]

Add x11-drivers/xf86-input-libinput to the list installed by default by
x11-drivers/xorg-drivers.

Fix net/tigervnc-server and emulators/virtualbox-ose

Bump portrevision of all x11 drivers, as well as other ports dependent on
xorg-server.

This represents work by many people over a long period.  These include
wulf, ak, dumbbell, hselasky pete AT nomadlogic DOT org, jbeich, manu,
myself and possibly others (I tried to look through history, but might have
missed people. If so, I am sorry.)

PR:             196678 [1], 244129 [2]
Submitted by:   hselasky, wulf [1], jbeich [2]
Obtained from:	https://github.com/FreeBSDDesktop/freebsd-ports/tree/feature/xserver-1.20 (in part)
2020-02-20 21:15:44 +00:00

56 lines
2.2 KiB
C

* 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-15 18:05:25 UTC
+++ config/udev.c
@@ -29,6 +29,7 @@
#include <libudev.h>
#include <ctype.h>
+#include <fcntl.h>
#include <unistd.h>
#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,18 @@ device_added(struct udev_device *udev_de
}
}
+ if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) {
+ if (!feature_present("evdev_support"))
+ 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 {
+ if (!feature_present("evdev_support"))
+ 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 */