ecore_drm: Added internal function to check if drm device is hotplug device
authorvivek <vivek.ellur@samsung.com>
Wed, 22 Oct 2014 12:14:26 +0000 (08:14 -0400)
committerChris Michael <cp.michael@samsung.com>
Wed, 22 Oct 2014 12:14:42 +0000 (08:14 -0400)
Summary:
Added _ecore_drm_output_device_is_hotplug API to check if the
drm device is hotplug device. It returns EINA_TRUE if device is
hotplug else returns EINA_FALSE

@feature

Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewers: devilhorns

Subscribers: cedric

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

src/lib/ecore_drm/ecore_drm_output.c

index 67f8f0cefef2e214af54bd40eee0990afef896c6..1b46e6bec8fcf5d8fb211730841e26a5c21582fd 100644 (file)
@@ -623,6 +623,26 @@ finish:
    _ecore_drm_output_frame_finish(output);
 }
 
+static Eina_Bool
+_ecore_drm_output_device_is_hotplug(Ecore_Drm_Output *output)
+{
+   const char *syspath;
+   const char *val;
+   int sysnum;
+
+   syspath = output->dev->drm.path;
+   sysnum = eeze_udev_syspath_get_sysnum(syspath);
+
+   if ((sysnum == -1) || (sysnum != output->dev->id))
+     return EINA_FALSE;
+
+   val = eeze_udev_syspath_get_property(syspath, "HOTPLUG");
+   if (!val)
+     return EINA_FALSE;
+
+   return (strcmp(val, "1") == 0);
+}
+
 static void
 _ecore_drm_output_event(const char *device, Eeze_Udev_Event event, void *data, Eeze_Udev_Watch *watch EINA_UNUSED)
 {
@@ -630,7 +650,10 @@ _ecore_drm_output_event(const char *device, Eeze_Udev_Event event, void *data, E
 
    if (!(output = data)) return;
 
-   /* TODO: Check if device is hotplug and update outputs */
+   if (_ecore_drm_output_device_is_hotplug(output))
+     {
+        DBG("Output Hotplug Event");
+     }
 }
 
 /**