home
/
code
/
khatus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support arbitrary parameter passing to sensor function
[khatus.git]
/
x5
/
khatus_sensor_battery.c
diff --git
a/x5/khatus_sensor_battery.c
b/x5/khatus_sensor_battery.c
index
7871245
..
e4625c6
100644
(file)
--- a/
x5/khatus_sensor_battery.c
+++ b/
x5/khatus_sensor_battery.c
@@
-19,8
+19,6
@@
char *argv0;
char *argv0;
-char path[PATH_MAX];
-
double opt_interval = 1.0;
char *opt_battery = "BAT0";
char *opt_fifo = NULL;
double opt_interval = 1.0;
char *opt_battery = "BAT0";
char *opt_fifo = NULL;
@@
-79,7
+77,7
@@
opt_parse(int argc, char **argv)
}
int
}
int
-get_capacity(char *buf)
+get_capacity(char *buf
, char *path
)
{
FILE *fp;
int cap;
{
FILE *fp;
int cap;
@@
-104,6
+102,7
@@
main(int argc, char **argv)
argv0 = argv[0];
char buf[10];
argv0 = argv[0];
char buf[10];
+ char path[PATH_MAX];
char *path_fmt = "/sys/class/power_supply/%s/capacity";
struct timespec ti = timespec_of_float(opt_interval);
char *path_fmt = "/sys/class/power_supply/%s/capacity";
struct timespec ti = timespec_of_float(opt_interval);
@@
-111,5
+110,11
@@
main(int argc, char **argv)
memset(path, '\0', PATH_MAX);
snprintf(path, PATH_MAX, path_fmt, opt_battery);
memset(path, '\0', PATH_MAX);
snprintf(path, PATH_MAX, path_fmt, opt_battery);
- loop(&ti, opt_fifo, buf, &get_capacity);
+ loop(
+ &ti,
+ opt_fifo,
+ buf,
+ (SENSOR_FUN_T) get_capacity,
+ (SENSOR_PARAMS_T) path
+ );
}
}
This page took
0.029965 seconds
and
4
git commands to generate.