diff options
author | vivek <vivek.ellur@samsung.com> | 2014-09-26 08:06:05 -0400 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2014-09-26 08:06:05 -0400 |
commit | f15f875fa90cd66955ad16095a49e630d80093b0 (patch) | |
tree | 52f30b9cf1bd1b883b5f5fcee934544576158097 /src/lib/eeze | |
parent | 96f53fc69dbec76e17d74b39b3dbee317f545750 (diff) | |
download | efl-f15f875fa90cd66955ad16095a49e630d80093b0.tar.gz |
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 <vivek.ellur@samsung.com>
Reviewers: devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1491
Diffstat (limited to 'src/lib/eeze')
-rw-r--r-- | src/lib/eeze/Eeze.h | 11 | ||||
-rw-r--r-- | src/lib/eeze/eeze_udev_syspath.c | 25 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/eeze/Eeze.h b/src/lib/eeze/Eeze.h index b141003ee9..186d0c87d4 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 322ff31c52..0075f2a279 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; |