diff --git a/src/lib/ecore_drm/ecore_drm_dbus.c b/src/lib/ecore_drm/ecore_drm_dbus.c index 19986025fb..d6276f8ce9 100644 --- a/src/lib/ecore_drm/ecore_drm_dbus.c +++ b/src/lib/ecore_drm/ecore_drm_dbus.c @@ -363,6 +363,18 @@ flag_err: return -1; } +static void +_dbus_device_close(const char *path) +{ + struct stat st; + int ret; + + if ((ret = stat(path, &st)) < 0) return; + if (!S_ISCHR(st.st_mode)) return; + + _dbus_device_release(major(st.st_rdev), minor(st.st_rdev)); +} + static DBusHandlerResult _dbus_cb_filter(DBusConnection *conn EINA_UNUSED, DBusMessage *msg, void *data EINA_UNUSED) { @@ -817,3 +829,9 @@ _ecore_drm_dbus_device_open(const char *device) { return _dbus_device_open(device); } + +void +_ecore_drm_dbus_device_close(const char *device) +{ + _dbus_device_close(device); +} diff --git a/src/lib/ecore_drm/ecore_drm_inputs.c b/src/lib/ecore_drm/ecore_drm_inputs.c index 1f6c1c9357..98792091ce 100644 --- a/src/lib/ecore_drm/ecore_drm_inputs.c +++ b/src/lib/ecore_drm/ecore_drm_inputs.c @@ -228,7 +228,10 @@ ecore_drm_inputs_destroy(Ecore_Drm_Device *dev) Ecore_Drm_Evdev *edev; EINA_LIST_FREE(seat->devices, edev) - _ecore_drm_evdev_device_destroy(edev); + { + _ecore_drm_dbus_device_close(edev->path); + _ecore_drm_evdev_device_destroy(edev); + } } } @@ -300,4 +303,15 @@ EAPI void ecore_drm_inputs_disable(Ecore_Drm_Input *input) { if (!input) return; + + udev_monitor_unref(input->monitor); + input->monitor = NULL; + + if (input->hdlr) + { + ecore_main_fd_handler_del(input->hdlr); + input->hdlr = NULL; + } + + ecore_drm_inputs_destroy(input->dev); } diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h index 1cba3bdd38..34484cc516 100644 --- a/src/lib/ecore_drm/ecore_drm_private.h +++ b/src/lib/ecore_drm/ecore_drm_private.h @@ -230,6 +230,7 @@ struct _Ecore_Drm_Sprite Eina_Bool _ecore_drm_dbus_init(const char *session); void _ecore_drm_dbus_shutdown(void); int _ecore_drm_dbus_device_open(const char *device); +void _ecore_drm_dbus_device_close(const char *device); Ecore_Drm_Evdev *_ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, const char *path, int fd); void _ecore_drm_evdev_device_destroy(Ecore_Drm_Evdev *evdev);