[PATCH XIT] Provide and explain a udev rule and config snippet to ignore devices

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 20 15:52:50 PST 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Still a sledgehammer, but should make it easier for those that are just
running the tests and don't need to worry about evemu in their normal
day-to-day usage.

 99-ignore-virtual-devices.conf | 11 +++++++++++
 99-tag-virtual-devices.rules   | 12 ++++++++++++
 Makefile.am                    |  2 +-
 README                         | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 99-ignore-virtual-devices.conf
 create mode 100644 99-tag-virtual-devices.rules

diff --git a/99-ignore-virtual-devices.conf b/99-ignore-virtual-devices.conf
new file mode 100644
index 0000000..33600ad
--- /dev/null
+++ b/99-ignore-virtual-devices.conf
@@ -0,0 +1,11 @@
+# Ignore virtual devices tagged as such by a udev rule
+#
+# Note that this ignores any virtual device tagged, it does not differ
+# between devices created by tests and those created by hand through
+# evemu-device
+#
+Section "InputClass"
+  Identifier "ignore virtual devices"
+  MatchTag "virtualdevice"
+  Option "Ignore" "on"
+EndSection
diff --git a/99-tag-virtual-devices.rules b/99-tag-virtual-devices.rules
new file mode 100644
index 0000000..92b1620
--- /dev/null
+++ b/99-tag-virtual-devices.rules
@@ -0,0 +1,12 @@
+# tag all virtual devices as virtual devices, so an xorg.conf snippet can be
+# set up to ignore those.
+#
+# Note that this tags _any_ virtual input device. The tag itself has no
+# effect unless matched by a xorg.conf.d snippet
+
+ACTION!="add|change", GOTO="tag_virtual_devices_end"
+KERNEL!="event[0-9]*", GOTO="tag_virtual_devices_end"
+
+ENV{DEVPATH}=="/devices/virtual/*", ENV{ID_INPUT.tags}+="virtualdevice"
+
+LABEL="tag_virtual_devices_end"
diff --git a/Makefile.am b/Makefile.am
index 8a17668..e20b300 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,5 +2,5 @@ ACLOCAL_AMFLAGS = -Im4
 
 SUBDIRS = tests recordings doc
 
-EXTRA_DIST = autogen.sh HACKING
+EXTRA_DIST = autogen.sh HACKING 99-ignore-virtual-devices.conf 99-tag-virtual-devices.rules
 
diff --git a/README b/README
index 1202ca4..23e46a0 100644
--- a/README
+++ b/README
@@ -57,5 +57,40 @@ allows to investigate logs or attach gdb to the server process.
 For further environment variables please refer to the xorg-gtest README
 http://cgit.freedesktop.org/xorg/test/xorg-gtest/tree/README
 
+=== Avoiding interference with your running server ===
+Many of the tests will create uinput devices that, usually, will also be picked
+up as devices in your current X session. This will result in pointer movement,
+random clicks, etc. in your current session. This is not a fault of the tests.
+
+To avoid this interference the current X server must be configured to either
+ignore input device hotplugging altogether (Option AutoAddDevices off, see
+xorg.conf(5)) or, a smaller sledgehammer, be configured to ignore virtual
+devices. The udev rule below applies a tag to every virtual device. An
+xorg.conf snippet (below) matches against this tag and tells the server to
+ignore those. Restart the X server to let the changes take effect.
+
+BEWARE: adding this xorg.conf snippet will disable _all_ virtual input
+devices in your current X session.
+
+$> cat /etc/udev/rules.d/99-tag-virtual-devices.rules
+# tag all virtual devices as virtual devices, so an xorg.conf snippet can be
+# set up to ignore those.
+
+ACTION!="add|change", GOTO="tag_virtual_devices_end"
+KERNEL!="event[0-9]*", GOTO="tag_virtual_devices_end"
+
+ENV{DEVPATH}=="/devices/virtual/*", ENV{ID_INPUT.tags}+="virtualdevice"
+
+LABEL="tag_virtual_devices_end"
+
+$> cat /etc/X11/xorg.conf.d/99-ignore-virtual-devices.conf
+# Ignore all devices with ID_INPUT.tags set to "virtualdevice"
+Section "InputClass"
+  Identifier "ignore virtual devices"
+  MatchTag "virtualdevice"
+  Option "Ignore" "on"
+EndSection
+
+
 == Writing tests ==
 Please refer to the HACKING document
-- 
1.7.11.7



More information about the xorg-devel mailing list