[PATCH 2/4] xserver: limit the kernel subsystems we look for devices in

Lennart Poettering lennart at poettering.net
Wed Jul 20 06:52:08 PDT 2011


On Wed, 20.07.11 05:52, Dan Nicholson (dbn.lists at gmail.com) wrote:

> > +    udev_enumerate_add_match_subsystem(enumerate, "input");
> > +    udev_enumerate_add_match_subsystem(enumerate, "tty");
> > +
> >     udev_enumerate_scan_devices(enumerate);
> >     devices = udev_enumerate_get_list_entry(enumerate);
> >     udev_list_entry_foreach(device, devices) {
> 
> Last time this came up, we were a little uneasy about limiting the
> subsystems. I guess this should work for devices we care about, and
> any future input devices should fall under the input subsystem (I
> hope). One thing we could use help on in upstream udev is marking the
> appropriate serial devices with ID_INPUT* in
> 60-persistent-input.rules. I'm cc'ing Thomas since he was the one who
> originally requested that we not just filter to input.

If this comes up again and there indeed is another kernel subsystem that
X should listen for devices in, then the best is to use udev tags. Tags
are a relatively new feature and allow you to mark devices orthogonal
to their categorization in subsystems. libudev has optimized
enumerating/monitoring code for tagged devices. udev rules would then
mark specific devices to be picked up by X11 via TAGS+="x11-input" or
so. And X would use udev_enumerate_add_match_tag(enumerate,
"x11-input") to then enumerate these devices.

However, since we cannot optimize huge numbers of tags well (the backing
data structure is a bloom filter), it's a good idea to continue using
subsystem matches for a while, and only replace them by tag matches if
we'd otherwise have to match too many subsystems. Or in other words: two
or three explicit subsystem matches are fine. if there's going to be a
fourth one, then let's use tags instead.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the xorg-devel mailing list