diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-20 18:07:12 +1000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-25 17:47:32 -0700 |
commit | 531ff40301975519af7b20109c17d296312d3f2b (patch) | |
tree | 181c01e61b9ed5311d69834675e1a3f16ea8bf33 /dix/devices.c | |
parent | c2d0b3b437b7ce6ce975f2ead4d8bb8295ef0ddc (diff) |
Add a "flags" field to DeleteInputDeviceRequest.
Some input drivers need to implement an internal hotplugging scheme for
dependent devices to provide multiple X devices off one kernel device file.
Such dependent devices can be added with NewInputDeviceRequest() but they are
not removed when the config backend calls DeleteInputDeviceRequest(),
leaving the original device to clean up.
Example of the wacom driver:
config/udev calls NewInputDeviceRequest("stylus")
wacom PreInit calls
NewInputDeviceRequest("eraser")
NewInputDeviceRequest("pad")
NewInputDeviceRequest("cursor")
PreInit finishes.
When the device is removed, the config backend only calls
DeleteInputDeviceRequest for "stylus". The driver needs to call
DeleteInputDeviceRequest for the dependent devices eraser, pad and cursor to
clean up properly.
However, when the server terminates, DeleteInputDeviceRequest is called for
all devices - the driver must not remove the dependent devices to avoid
double-frees. There is no method for the driver to detect why a device is
being removed, leading to elaborate guesswork and some amount of wishful
thinking.
Though the input driver's UnInit already supports flags, they are unused.
This patch uses the flags to supply information where the
DeleteInputDeviceRequest request originates from, allowing a driver to
selectively call DeleteInputDeviceRequest when necessary.
Also bumps XINPUT ABI.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix/devices.c')
-rw-r--r-- | dix/devices.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/dix/devices.c b/dix/devices.c index cf23bc6d0..27840240d 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -891,7 +891,7 @@ CloseDeviceList(DeviceIntPtr *listHead) while (dev != NULL) { freedIds[dev->id] = TRUE; - DeleteInputDeviceRequest(dev); + DeleteInputDeviceRequest(dev, DEVICE_REMOVE_ALL); dev = *listHead; while (dev != NULL && freedIds[dev->id]) |