ecore-drm: implement function to disable ecore drm inputs on vt
authorMinJeong Kim <minjjj.kim@samsung.com>
Mon, 4 Aug 2014 12:47:10 +0000 (08:47 -0400)
committerChris Michael <cp.michael@samsung.com>
Mon, 4 Aug 2014 12:50:40 +0000 (08:50 -0400)
switching

Summary:
When vt is released by SIGUSR1, drm_inputs have to be disabled.
For that this revision includes,
    1. Unrefer udev monitor
    2. Remove fd handler for udev monitor
    3. Release dbus device

Reviewers: stefan_schmidt, devilhorns, gwanglim

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1268

src/lib/ecore_drm/ecore_drm_dbus.c
src/lib/ecore_drm/ecore_drm_inputs.c
src/lib/ecore_drm/ecore_drm_private.h

index 1998602..d6276f8 100644 (file)
@@ -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);
+}
index 1f6c1c9..9879209 100644 (file)
@@ -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);
 }
index 1cba3bd..34484cc 100644 (file)
@@ -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);