mirror of
https://github.com/amiwm/amiwm.git
synced 2026-03-24 01:24:15 +00:00
[battery] Tie into the periodic function to update APM info
Tie into the periodic function so we can get the APM info. For now it's not checking that some time has elapsed, the hope is that it'll just be driven by md_main_loop() / 5 second select timeout.
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
|
||||
#include "libami.h"
|
||||
|
||||
/* XXX should be an md method */
|
||||
extern void (*md_periodic_func)(void);
|
||||
|
||||
/*
|
||||
* Test battery module for FreeBSD, using APM.
|
||||
*/
|
||||
@@ -45,21 +48,29 @@ get_apm_info(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
periodic_func(void)
|
||||
{
|
||||
fprintf(stderr, "Ha!\n");
|
||||
get_apm_info();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *arg=md_init(argc, argv);
|
||||
char *arg;
|
||||
|
||||
arg = md_init(argc, argv);
|
||||
|
||||
progname=argv[0];
|
||||
|
||||
md_periodic_func = periodic_func;
|
||||
|
||||
apm_fd = open(APM_DEV, O_RDONLY);
|
||||
if (apm_fd < 0) {
|
||||
err(127, "open");
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX TODO: how do I actually get this to run once
|
||||
* a second in the main loop?
|
||||
*/
|
||||
/* initial battery info */
|
||||
get_apm_info();
|
||||
|
||||
md_main_loop();
|
||||
|
||||
Reference in New Issue
Block a user