Syntax enhancements for Match statements

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 24 17:36:54 PDT 2011


On Mon, Oct 17, 2011 at 09:00:26PM +0300, Oleh Nykyforchyn wrote:
> 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.

right, looking at this configuration I've got a few comments, but the main
one is that at least for your config negations aren't really necessary. The
main reason for those is that .conf file overwrite the 

> /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]+$/"

this one isn't really necessary. you can just skip this statement since
it'll get overwritten by the next one anyway.

>         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]+$/"

same here

> 	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$/"

I'd argue that this can be done with simple substring matching (same with
the mouse) but well.

>     MatchLayout    "regex:/^Seat[0-9]+$/"

This is the only one where I see the need for regex. If you have more than
10 seats. Though I doubt that you have, given the rest of the configuration.
So you could just as well use a simple MatchLayout "Seat" and match against
the substring.

So yeah, I can somewhat see the need for regex but all the more complicated
seem over the top. All this is code that we need to maintain once it's out
there and unless we have some _very_ good testcases, I'd rather not merge
them.

Cheers,
  Peter



More information about the xorg-devel mailing list