[Xorg] Input device hotplug

Kristian Høgsberg krh at bitplanet.net
Wed Jun 23 10:36:46 PDT 2004


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.

I have a prototype running were I've added AddInputDevice() and
RemoveInputDevice() in the XFree86-Misc extension:

   typedef struct {
       char*	name;
       char*	value;
   } XF86MiscDriverOption;

   Status XF86MiscAddInputDevice(Display *dpy,
                                 const char *identifier,
                                 const char *driver,
                                 XF86MiscDriverOption *options,
                                 int option_count);

   Status XF86MiscRemoveInputDevice(Display *dpy,
                                    const char *identifier);

i.e. the AddInputDevice arguments correspond to the InputDevice section 
of the config file.  The implementation mimicks the server 
initialization sequence; it loads the driver, builds an option list from 
the given options, calls PreInit(), and adds the device.

In the prototype I'm using HAL (hal.freedesktop.org) on Linux to 
enumerate and discover devices.  Other systems could use other 
mechanisms, but HAL is intended to be cross platform, and a FreeBSD port 
is being discussed right now on the list.

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?

Comments are welcome.  I'm currently trying to get my prototype cleaned 
up, and then I'll attach it to a bugzilla entry

Kristian





More information about the xorg mailing list