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

Peter Hutterer peter.hutterer at who-t.net
Wed Aug 3 16:28:19 PDT 2011


On Wed, Aug 03, 2011 at 10:04:08AM +0200, Michael Thayer wrote:
> On Wed, 2011-08-03 at 09:00 +1000, Peter Hutterer wrote:
> > On Mon, Aug 01, 2011 at 11:18:48PM +0200, Michael Thayer wrote:
> > > On Thu, 2011-07-21 at 09:40 +1000, Peter Hutterer wrote:
> > > > On Wed, Jul 20, 2011 at 05:52:16AM -0700, Dan Nicholson wrote:
> > > > > On Mon, Jul 18, 2011 at 12:17 PM, Lennart Poettering
> > > > > <lennart at poettering.net> wrote:
> > > > > > Don't enumerate/monitor all devices of the system (since that can be
> > > > > > quite a few), but limit our search to devices from the "input"
> > > > > > subsystem, as well as the "tty" subsystem (to cover Wacom tablets).
> > > > > >
> > > > > > This should make X start up a bit faster and reduce the number of
> > > > > > unnecessary wake-ups of the X server.
> > > > > > ---
> > > > > >  config/udev.c |    7 +++++++
> > > > > >  1 files changed, 7 insertions(+), 0 deletions(-)
> > > > > >
> > > > > > diff --git a/config/udev.c b/config/udev.c
> > > > > > index 5ac52a1..0763cc9 100644
> > > > > > --- a/config/udev.c
> > > > > > +++ b/config/udev.c
> > > > > > @@ -281,6 +281,9 @@ config_udev_init(void)
> > > > > >     if (!udev_monitor)
> > > > > >         return 0;
> > > > > >
> > > > > > +    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
> > > > > > +    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
> > > > > > +
> > > > > >     if (udev_monitor_enable_receiving(udev_monitor)) {
> > > > > >         ErrorF("config/udev: failed to bind the udev monitor\n");
> > > > > >         return 0;
> > > > > > @@ -289,6 +292,10 @@ config_udev_init(void)
> > > > > >     enumerate = udev_enumerate_new(udev);
> > > > > >     if (!enumerate)
> > > > > >         return 0;
> > > > > > +
> > > > > > +    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.
> > > > 
> > > > At this point, all input devices that I've seen* are either supported by the
> > > > kernel or are legacy serial devices that don't have a kernel driver (yet).
> > > > I think we'll be fine filtering for those two only.
> > > Sorry for the late response - I was rather behind on reading this list.
> > > I would greatly appreciate it if you could add the "misc" subsystem for
> > > the sake of the VirtualBox mouse integration.
> > 
> > Not that I know anything about the details, but can we make the VirtualBox
> > mouse integration appear in the input subsystem? that seems to be the better
> > fix here.
> Not (as far as I can see) without writing a proper kernel input driver -
> which is something I do intend to do as soon as possible, but I hadn't
> actually planned to do it immediately.  Of course if you say that
> enumerating "misc" is not acceptable to you then I will probably have to
> give it a priority boost.

imo it seems to be the better solution than just whitelisting "misc", which
at least partially defeats the purpose of restricting to input subsystems
only.

Cheers,
  Peter


More information about the xorg-devel mailing list