eeze: Add code for eeze_udev_syspath_get_sysnum function
authorChris Michael <cp.michael@samsung.com>
Tue, 23 Sep 2014 16:59:54 +0000 (12:59 -0400)
committerChris Michael <cp.michael@samsung.com>
Tue, 23 Sep 2014 17:01:14 +0000 (13:01 -0400)
Summary: This adds an API function to return the sysnum of a device
based on syspath. This is needed in ecore-drm to return the id
(sysnum) of a drm device.

@feature

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

index 7177b97..40dbf3a 100644 (file)
@@ -314,3 +314,24 @@ eeze_udev_devpath_get_syspath(const char *devpath)
    udev_enumerate_unref(en);
    return ret;
 }
+
+EAPI int 
+eeze_udev_syspath_get_sysnum(const char *syspath)
+{
+   _udev_device *device;
+   const char *test;
+   int ret = -1;
+
+   if (!syspath)
+     return NULL;
+
+   if (!(device = _new_device(syspath)))
+     return NULL;
+
+   if ((test = udev_device_get_sysnum(device)))
+     ret = atoi(test);
+
+   udev_device_unref(device);
+   return ret;
+}
+