[RFC PATCH] Handle hotplugged devices from xorg.conf

Peter Hutterer peter.hutterer at who-t.net
Thu Dec 4 17:05:26 PST 2008


On Thu, Dec 04, 2008 at 03:52:26PM -0800, Dan Nicholson wrote:
> > Most people claiming that their options are being ignored - they're trying to
> > configure devices that don't actually exist anymore (like the
> > /dev/input/mice).
> > Want 3 button emulation? On which of the 3 mice you actually have?
> > Having xorg.conf entries for each device isn't really feasable anymore.
> 
> I will definitely concede that if you're plugging in a lot of devices
> that writing configuration in xorg.conf would be tedious. Here's a
> case where someone has a totally acceptable looking (except for using
> the non-persistent device file) InputDevice section:
> 
> http://lists.freedesktop.org/archives/xorg/2008-November/040247.html
> 
> Looking at evdev(4), I would expect that would work. And yet what he
> got was bizarre behavior with VT switches.

AFAICT, it does work until he unplugs the device. A read error simply disables
the device. We can't remove it, because we just don't remove devices that are
explictly configured by the user, and we don't remove HAL devices because we
just wait for HAL to tell us to remove it.

A VT switch disables the devices too, and a VT switch back to the server
re-enables all previously known devices. That's why the device comes back.

Bizarre, maybe. Logical - yes, if you know why :)
 
> >> But I think all the Core business can be ignored if we just check if that
> >> identifier has already been added. So, iterate inputInfo.device, comparing
> >> idev->identifier and dev->name. If they match, then it was handled as part
> >> of the layout or whatever and can be ignored. Does that make sense? Does
> >> dev->name get set from idev->identifier?
> >
> > dev->name for HAL devices is the input.product line which (usually) is the
> > same for the same hardware. If you plug in three of the same mice, they'll all
> > be called "Generic USB Mouse" or similar. That's why matching on "Synaptics
> > PS/2 Touchpad" works, they're all called that way.
> >
> > Anyway, what I'm trying to say is that matching on dev->name only gets you so
> > far before it becomes iffy.
> 
> Right. However, I'm not trying to match devices added by config/hal.
> I'm trying to match devices that have been added from xorg.conf via
> HandleConfigFile. In that case, idev->identifier is the Identifier
> tag. My question is, does idev->identifier always become dev->name? It
> seems that this is actually handled by the driver, who could set it to
> anything they wanted.

Correct. You have no guarantee what the name will be but it is reasonable to
assume that drivers set it to the identifier. Quick peek at mouse, kbd, evdev
and synaptics shows that those 4 do it, and that covers the vast majority of
devices.

> Even so, it's still hacky because you could make your Identifier the
> same as info.product. One reliable way to handle this is to make the
> HandleConfigFile devices set config_info to something like
> "layout:Identifier".

you could use config:<identifier> or xfree86:<identifier> or something.
not sure about layout, it seems a bit too ambiguous (monitors have a layout
too).

Cheers,
  Peter



More information about the xorg mailing list