ecore-drm: Fix issue with ecore_drm_evdev->path being incorrect
authorChris Michael <cp.michael@samsung.com>
Tue, 17 Feb 2015 21:18:13 +0000 (16:18 -0500)
committerChris Michael <cp.michael@samsung.com>
Tue, 17 Feb 2015 21:19:55 +0000 (16:19 -0500)
Summary: When we try to ReleaseDevice of our evdev structure, the
'path' which was getting passed to our logind code was incorrect. This
was due to libinput not providing a function to get the full device
path. We fix this by making some eeze udev calls to find this device
and get the full device path.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_drm/ecore_drm_evdev.c

index fbc5959..2358a8d 100644 (file)
@@ -545,6 +545,7 @@ Ecore_Drm_Evdev *
 _ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *device)
 {
    Ecore_Drm_Evdev *edev;
+   Eina_List *devices;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL);
 
@@ -555,6 +556,26 @@ _ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *dev
    edev->device = device;
    edev->path = eina_stringshare_add(libinput_device_get_sysname(device));
 
+   devices = eeze_udev_find_by_filter("input", NULL, edev->path);
+   if (eina_list_count(devices) >= 1)
+     {
+        Eina_List *l;
+        const char *dev, *name;
+
+        EINA_LIST_FOREACH(devices, l, dev)
+          {
+             name = eeze_udev_syspath_get_devname(dev);
+             if (strstr(name, edev->path))
+               {
+                  eina_stringshare_replace(&edev->path, eeze_udev_syspath_get_devpath(dev));
+                  break;
+               }
+          }
+
+        EINA_LIST_FREE(devices, dev)
+          eina_stringshare_del(dev);
+     }
+
    if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
      {
         edev->seat_caps |= EVDEV_SEAT_KEYBOARD;