[Xorg] Input device hotplug

Kristian Høgsberg krh at bitplanet.net
Wed Jun 23 17:00:47 PDT 2004


Ely Levy wrote:
> doesn't it require also adding the ability to change configuration on the
> fly?
> like if I'm adding a new usb mouse and want to map the scroll to something
> else?

That's what the option array is for.  You would do something like

   XF86MiscDriverOption mouse_options[] = {
     { "ZAxisMapping", "1 2" }
   };

   XF86MiscAddInputDevice(dpy, "mouse3", "mouse",
                          mouse_options, ArrayLength(mouse_options));

So you have the same options available as you have in the config file.

> if it does, wouldn't people want a way to keep the configuration to a
> file?
> wouldn't that totally change the idea behind xorg.conf and would finally
> let people configure those things per user?

Yeah, this would also open up for per user settings.

Kristian

> Ely Levy
> System group
> Hebrew University
> Jerusalem Israel
> 
> 
> 
> On Wed, 23 Jun 2004, [ISO-8859-1] Kristian H�gsberg 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
> 
>>
> 





More information about the xorg mailing list