Change-Id: I8eca9fe1bb1f0c95954d0439d0f398795a5421db
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
#endif
int sys_get_str(const char *fname, char *str);
+int sysfs_get_int(char *path, int *val);
const char *get_string_from_object(json_object *obj, const char *key);
const int get_int_from_object(json_object *obj, const char *key);
return -1;
}
+int sysfs_get_int(char *path, int *val)
+{
+ char buf[BUFF_MAX + 1];
+ int r;
+
+ if ((!path) || (!val))
+ return -EINVAL;
+
+ r = sys_read_buf(path, buf);
+ if (r < 0)
+ return r;
+
+ *val = atoi(buf);
+ return 0;
+}
+
const char *get_string_from_object(json_object *obj, const char *key)
{
json_object *tmp = NULL;