[PATCH 4/4] xserver: Add negation and regexes in Match entries to man page

Oleh Nykyforchyn oleh.nyk at gmail.com
Sat Jun 4 22:54:07 PDT 2011


Add negation and regexes in Match entries to man page

Signed-off-by: Oleh Nykyforchyn <oleh.nyk at gmail.com>
---
 hw/xfree86/man/xorg.conf.man |   49 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index f406f82..cafc07f 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1069,20 +1069,31 @@ these entries appear, they all must match for the configuration to apply.
 .PP
 There are two types of match entries used in
 .B InputClass
-sections. The first allows various tokens to be matched against attributes
-of the device. An entry can be constructed to match attributes from different
-devices by separating arguments with a '|' character. Multiple entries of the
-same type may be supplied to add multiple matching conditions on the same
+sections. The first allows attributes of the device to be matched against
+various patterns. An entry can be constructed to match attributes from
+different devices by supplying several (at least one) patterns, which are
+applied to each attribute in the order of appearance in the entry. Usually,
+an attribute that matches a pattern is accepted, and further patterns
+are not considered. A pattern prepended with '!' is negated, which means
+that an attribute that matches it is rejected (this does not affect
+attributes accepted by previous patterns). If the end of an entry is
+reached, everything is determined by the last (not matched) pattern: if it
+is negated, the attribute is accepted, otherwise it is rejected.
+
+Multiple entries of the same type may appear in one
+.B InputClass
+section to add different matching conditions on the same
 attribute. For example:
 .PP
 .RS 4
 .nf
 .B  "Section \*qInputClass\*q"
 .B  "    Identifier   \*qMy Class\*q"
-.B  "    # product string must contain example and
+.B  "    # product string must not contain wrong,
+.B  "    # must contain example, and
 .B  "    # either gizmo or gadget
-.B  "    MatchProduct \*qexample\*q
-.B  "    MatchProduct \*qgizmo|gadget\*q
+.B  "    MatchProduct \*q!wrong\*q \*qexample\*q
+.B  "    MatchProduct \*qgizmo\*q \*qgadget\*q
 .I  "    ..."
 .B  "EndSection"
 .fi
@@ -1151,6 +1162,30 @@ if no named
 .B ServerLayout
 sections have been found.
 .PP
+To apply a more specific condition, e.g. to select devices with product
+names that start with "Advanced" and end with "Gadget", extended regular
+expressions (see
+.BR regex (7)
+), prefixed by "regex:", can be used as patterns:
+.PP
+.RS 4
+.nf
+.B  "    MatchProduct \*qregex:^Advanced.*Gadget$\*q"
+.fi
+.RE
+.PP
+Finally, it is allowed to join via '|' any adjacent patterns, except
+regular expressions, in which '|' has a special meaning, so a match
+entry can look like
+.PP
+.RS 4
+.nf
+.B  "    MatchProduct \*q!regex:^USB\*q \*qOptical Mouse|Touchpad\*q"
+.fi
+.RE
+.PP
+and select non-USB optical mice and touchpads.
+
 The second type of entry is used to match device types. These entries take a
 boolean argument similar to
 .B Option
-- 
1.7.0.1



More information about the xorg-devel mailing list