Syntax enhancements for Match statements

Oleh Nykyforchyn oleh.nyk at gmail.com
Mon Oct 17 11:00:26 PDT 2011


Hi colleagues,

It has been written a long time ago about my patches, which introduced
negation, "|"+"&" and regexes to Match statements:

On Thu, 23 Jun 2011 12:06:46 +1000
Peter Hutterer <peter.hutterer at who-t.net> wrote:

> 
> sorry if you've already done this in another thread but do you have an
> example of a configuration you're trying to attempt? As in, not a made up
> one but an actual configuration. It would help greatly to see the
> shortfalls of the current options and who knows even show other ways of
> getting this configuration.
> 

Since then I had software/hardware troubles (related to nouveau/ati drivers)
and was not able to test suggested patches and configs. Now I have two working
dualseat and several single-seat systems, which are configured in a unified
manner. They are driven by xorg-server-1.11.1 with the latest patches submitted
by me to the list.

I am going not to submit them now again, but to post some actual config files
to show how syntax enhancements can be convenient for Xorg administration.
We leave standard input classes for mice+keyboards in all layouts but Seat0,
Seat1, Seat 2 etc. Thus we can separate errors in custom XKB configs from
troubles with X itself.

/etc/X11/xorg.conf.d/10-evdev.conf
------------------------
#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.

Section "InputClass"
        Identifier "evdev pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        MatchLayout "!regex:/^Seat[0-9]+$/"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        MatchLayout "!regex:/^Seat[0-9]+$/"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection


/etc/X11/xorg.conf.d/90-keyboard.conf
------------------------
#
Section "InputClass"
	Identifier "keyboard-all"
	MatchIsKeyboard "on"
	MatchDevicePath "/dev/input/event*"
	MatchLayout "!regex:/^Seat[0-9]+$/"
	Driver "evdev"
	Option "XkbLayout" "us"
	#Option "XkbVariant" ""
	Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Custom config for all seats (including one-seat systems):

/etc/X11/xorg.conf.d/91-seats.conf
------------------------
Section "Module"
	Load  "glx"
	Load  "extmod"
	Load  "dri2"
	Load  "dbe"
	Load  "dri"
EndSection

Section "InputClass"
    Identifier     "Keyboard-at-seat"
    MatchProduct   "regex:/^AT.*Set 2 keyboard$/"
    MatchLayout    "regex:/^Seat[0-9]+$/"
    Option         "XkbRules" "evdev"
    Option         "XkbModel" "evdev"
#    Option         "XkbLayout" "us_de,us_pl,ua_koi,ua_ru_by"
    Option         "XkbLayout" "us_de,ua_ru_by"
    Option         "XkbOptions" "overlay,terminate:ctrl_alt_bksp"
    Option         "AutoRepeat" "500 3"
EndSection

Section "InputClass"
    Identifier     "Mouse-at-seat"
    MatchProduct   "regex:/ Mouse$/"
    MatchLayout    "regex:/^Seat[0-9]+$/"
    Option         "Buttons" "5"
    Option         "ZAxisMapping" "4 5"
    Option         "Emulate3Buttons"
EndSection

Section "ServerFlags"
    Option "DontZap" "off"
    Option "Xinerama" "off"
    Option "Log" "flush"
EndSection


Real input devices assignment is only here:

/etc/X11/xorg.conf.d/xorg-both.conf
------------------------
Section "ServerLayout"
    Identifier     "Seat0"
    Screen         "GeForce VGA+TV" 0 0
EndSection

Section "ServerLayout"
    Identifier     "Seat1"
    Screen         "Matrox" 0 1
EndSection

Section "InputClass"
    Identifier     "Keyboard0"
    Driver         "evdev"
    MatchProduct   "AT Translated Set 2 keyboard"
    MatchLayout    "Seat0"
EndSection

Section "InputClass"
    Identifier     "Mouse0"
    Driver         "evdev"
    MatchProduct   "A4Tech PS/2+USB Mouse"
    MatchLayout    "Seat0"
EndSection

Section "InputClass"
    Identifier     "Keyboard1"
    Driver         "evdev"
    MatchProduct   "AT Raw Set 2 keyboard"
    MatchLayout    "Seat1"
EndSection

Section "InputClass"
    Identifier     "Mouse1"
    Driver         "evdev"
    MatchProduct   "Logitech USB-PS/2 Optical Mouse"
    MatchLayout    "Seat1"
EndSection

Section "InputClass"
    Identifier     "Power Button"
    Driver         "evdev"
    MatchProduct   "Power Button"
    MatchLayout    "Seat0|Seat1"
EndSection

Comments, please.

Best regards,
Oleh Nykyforchyn <oleh.nyk at gmail.com>


More information about the xorg-devel mailing list