eeze: Added API to set sysattr values
authorvivek <vivek.ellur@samsung.com>
Fri, 26 Sep 2014 12:06:05 +0000 (08:06 -0400)
committerChris Michael <cp.michael@samsung.com>
Fri, 26 Sep 2014 12:06:05 +0000 (08:06 -0400)
Summary:
Added eeze_udev_set_sysattr API to set value of various
system attributes of a device

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

Subscribers: cedric

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

src/lib/eeze/Eeze.h
src/lib/eeze/eeze_udev_syspath.c

index b141003..186d0c8 100644 (file)
@@ -537,6 +537,17 @@ EAPI const char      *eeze_udev_syspath_get_sysattr(const char *syspath, const c
 EAPI Eina_Bool eeze_udev_syspath_check_sysattr(const char *syspath, const char *sysattr, const char *value);
 
 /**
+ * Set the sysattr value of a device from the /sys/ path.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @param sysattr The sysattr to set;
+ * @param value The value of sysattr to be set
+ * @return @c EINA_TRUE if the sysattr value is set
+ * @Since 1.12
+ */
+EAPI Eina_Bool eeze_udev_syspath_set_sysattr(const char *syspath, const char *sysattr, double value);
+
+/**
  * Checks whether the device is a mouse.
  *
  * @param syspath The /sys/ path with or without the /sys/
index 322ff31..0075f2a 100644 (file)
@@ -201,6 +201,31 @@ eeze_udev_syspath_get_sysattr(const char *syspath,
 }
 
 EAPI Eina_Bool
+eeze_udev_syspath_set_sysattr(const char *syspath,
+                              const char *sysattr,
+                              double value)
+{
+   _udev_device *device;
+   char val[16];
+   Eina_Bool ret = EINA_FALSE;
+   int test;
+
+   if (!syspath || !sysattr)
+     return EINA_FALSE;
+
+   if (!(device = _new_device(syspath)))
+     return EINA_FALSE;
+
+   sprintf(val, "%f", value);
+   test = udev_device_set_sysattr_value(device, sysattr, val);
+   if (test == 0)
+     ret = EINA_TRUE;
+
+  udev_device_unref(device);
+  return ret;
+}
+
+EAPI Eina_Bool
 eeze_udev_syspath_is_mouse(const char *syspath)
 {
    _udev_device *device = NULL;