mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
evdev: Close the device gracefully in case of a read() error
Even with udev, the read fails before udev has a chance to signal the change. Hence (and to handle errors gracefully anyway), let's remove the device from the device manager in case of a read() error.
This commit is contained in:
parent
afd279dd76
commit
7cd6ba2828
@ -157,7 +157,25 @@ clutter_event_dispatch (GSource *g_source,
|
||||
{
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
g_warning ("Could not read device (%d)", errno);
|
||||
ClutterDeviceManager *manager;
|
||||
ClutterInputDevice *device;
|
||||
const gchar *device_path;
|
||||
|
||||
device = CLUTTER_INPUT_DEVICE (source->device);
|
||||
|
||||
if (CLUTTER_HAS_DEBUG (EVENT))
|
||||
{
|
||||
device_path =
|
||||
_clutter_input_device_evdev_get_device_path (source->device);
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Could not read device (%s), removing.",
|
||||
device_path);
|
||||
}
|
||||
|
||||
/* remove the faulty device */
|
||||
manager = clutter_device_manager_get_default ();
|
||||
_clutter_device_manager_remove_device (manager, device);
|
||||
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user