summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvivek <vivek.ellur@samsung.com>2014-09-26 08:06:05 -0400
committerChris Michael <cp.michael@samsung.com>2014-09-26 08:06:05 -0400
commitf15f875fa90cd66955ad16095a49e630d80093b0 (patch)
tree52f30b9cf1bd1b883b5f5fcee934544576158097
parent96f53fc69dbec76e17d74b39b3dbee317f545750 (diff)
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
-rw-r--r--src/lib/eeze/Eeze.h11
-rw-r--r--src/lib/eeze/eeze_udev_syspath.c25
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
537EAPI Eina_Bool eeze_udev_syspath_check_sysattr(const char *syspath, const char *sysattr, const char *value); 537EAPI Eina_Bool eeze_udev_syspath_check_sysattr(const char *syspath, const char *sysattr, const char *value);
538 538
539/** 539/**
540 * Set the sysattr value of a device from the /sys/ path.
541 *
542 * @param syspath The /sys/ path with or without the /sys/
543 * @param sysattr The sysattr to set;
544 * @param value The value of sysattr to be set
545 * @return @c EINA_TRUE if the sysattr value is set
546 * @Since 1.12
547 */
548EAPI Eina_Bool eeze_udev_syspath_set_sysattr(const char *syspath, const char *sysattr, double value);
549
550/**
540 * Checks whether the device is a mouse. 551 * Checks whether the device is a mouse.
541 * 552 *
542 * @param syspath The /sys/ path with or without the /sys/ 553 * @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,
201} 201}
202 202
203EAPI Eina_Bool 203EAPI Eina_Bool
204eeze_udev_syspath_set_sysattr(const char *syspath,
205 const char *sysattr,
206 double value)
207{
208 _udev_device *device;
209 char val[16];
210 Eina_Bool ret = EINA_FALSE;
211 int test;
212
213 if (!syspath || !sysattr)
214 return EINA_FALSE;
215
216 if (!(device = _new_device(syspath)))
217 return EINA_FALSE;
218
219 sprintf(val, "%f", value);
220 test = udev_device_set_sysattr_value(device, sysattr, val);
221 if (test == 0)
222 ret = EINA_TRUE;
223
224 udev_device_unref(device);
225 return ret;
226}
227
228EAPI Eina_Bool
204eeze_udev_syspath_is_mouse(const char *syspath) 229eeze_udev_syspath_is_mouse(const char *syspath)
205{ 230{
206 _udev_device *device = NULL; 231 _udev_device *device = NULL;