[Xorg] Input device hotplug

Kristian Høgsberg krh at bitplanet.net
Wed Jun 23 11:20:41 PDT 2004


Jon Smirl wrote:
> On Linux 2.6 you can put an executable in /etc/hotplug.d/input and it
> will be run whenever a new device is add/removed. The program/script
> could check if xserver is running and tell it about the new device.

Yeah, that's a more lean solution, but HAL has some nice features I 
think could be useful: you can attach persistent, per-user properties to 
HAL devices, for example, if you want X to ignore a device, you could 
set xorg.ignore=true.

Another nice feature is device info files (.fdi files), which is a way 
to add properties to a device that match certain criteria.  For example, 
if a device has usb.vendor="wacom", the fdi-file could add a 
xorg.driver="wacom" property.

The daemon that listen to HAL events would use these properties to avoid 
adding devices the user wants to ignore and load the right driver for 
wacom tablets etc.

In any case, whatever the device discovery mechanism is, it needs some 
way to inform the X server of the new input device, which what my post 
was about.

> This doesn't work for PS/2 devices right now but that is a known
> problem and on the queue to be fixed.

That's interesting, how is that done?  Is there an interrupt when PS/2 
devices are plugged in or is it solved by polling?

Kristian

> 
> --- Kristian_Høgsberg <krh at bitplanet.net> wrote:
> 
>>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
>>
>>
>>_______________________________________________
>>xorg mailing list
>>xorg at freedesktop.org
>>http://freedesktop.org/mailman/listinfo/xorg
>>
> 
> 
> 
> =====
> Jon Smirl
> jonsmirl at yahoo.com
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> 





More information about the xorg mailing list