[Xorg] Input device hotplug

Kristian Høgsberg krh at bitplanet.net
Tue Jun 29 04:36:53 PDT 2004


Egbert Eich wrote:
> Kristian Høgsberg writes:
>  > Hi all,
>  > 
>  > I've been working on making the X.org server hotplug aware with respect
>  > to input devices.  The current situation is that all devices must be 
>  > setup in the config file and adding new devices requires config file 
>  > editing and server restart.  What I've been trying to implement is that 
>  > you can plug in an input device while the X server is running and it 
>  > will show up as a new XInput device.
>  > 
>  > The overall design I'm thinking of is to keep the device discovery 
>  > mechanism out of the X server.  By adding requests to add and remove
>  > devices a client program can monitor hotplug events and tell the server 
>  > to add or remove devices accordingly.
> 
> Having the discover mechanism live outside of the X server is only useful if
> it is generic to the system and not specific to X. Any program interested
> in input devices should be able to take advantage of its services.
> 
> While currently it is not possible to run multiple X servers on the
> same system (multi seat) it might well be in the future. In this
> case it must be made sure that only one of these servers connects to
> the device and that after a replug the same server gets the device
> reassigned.

Yeah, that's a good point.  The discovery mechanism should remember 
which server to add the device to.

[...]

>  > One thing I'ld like to discuss is where to add the add and remove device 
>  > interface -- I dont think XFree86-Misc is the right place.  My first 
>  > approach to this was that the new functionality should be an Xorg 
>  > private interface, but I'm thinking that maybe it would be better if it 
>  > was a standardized extension to XInput.  In that case, is the proposed 
>  > interface too Xorg specific?
> 
> No, adding this to an extension would only make sense if a functionality
> is to be network transparent. This doesn't seem to be the case for input
> devices. Input devices pysically live on the machine the server exists
> on. Therefore a local interface should suffice.
> I basically had the same idea like you when I implemented the interface
> for APM years ago. My first implementation used an extension however it
> didn't seem to make much sense in using an X client which would communicate
> with the server just to send information across that could be obtained
> by the Xserver itself.
> Therefore I decided to add an interface to the DDX splitting it into
> a OS independent and OS dependent part.

Even if you only need local access, I think it makes sense to implement 
it as an X request.  This avoids adding another ad-hoc IPC mechanism; 
you could create a unix socket and make a protocol for sending these 
requests back and forth, but I'ld rather just sidestep possible security 
implications and use what is already in place.

But I think there might be a case for remote access, e.g. if you run a 
remote X session and the client wants to add/remove devices...

> The XInput extension may have to be extended to be able to send events
> to notify clients about the new device. Also it may be useful to provide
> more information about the device to the clients (for example some ID
> or serial number) so the client is able to (re)identify devices.
> 
>  > 
>  > Comments are welcome.  I'm currently trying to get my prototype cleaned 
>  > up, and then I'll attach it to a bugzilla entry
>  > 
> 
> I hope my comments have been helpful. This is certainly an importand issue
> which should be discussed.

Definitely, thanks.

Kristian




More information about the xorg mailing list