devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f15f875fa90cd66955ad16095a49e630d80093b0
commit f15f875fa90cd66955ad16095a49e630d80093b0 Author: vivek <[email protected]> Date: Fri Sep 26 08:06:05 2014 -0400 eeze: Added API to set sysattr values Summary: Added eeze_udev_set_sysattr API to set value of various system attributes of a device Signed-off-by: vivek <[email protected]> Reviewers: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1491 --- src/lib/eeze/Eeze.h | 11 +++++++++++ src/lib/eeze/eeze_udev_syspath.c | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/lib/eeze/Eeze.h b/src/lib/eeze/Eeze.h index b141003..186d0c8 100644 --- a/src/lib/eeze/Eeze.h +++ b/src/lib/eeze/Eeze.h @@ -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/ diff --git a/src/lib/eeze/eeze_udev_syspath.c b/src/lib/eeze/eeze_udev_syspath.c index 322ff31..0075f2a 100644 --- a/src/lib/eeze/eeze_udev_syspath.c +++ b/src/lib/eeze/eeze_udev_syspath.c @@ -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; --
