forked from enlightenment/enlightenment
move battery fetching/polling of info to its own sub process, pipe of stdout
to read like tempget. this means e cant hang hen polling - much better for the mainloop. also clean up the code a lot. all battery specific "driver" code is now in batget - this means it much nicer to later add hal battery info fetching as that is also a remote service (and just not execute batget). i also fixed up (in theory) the new 2.6.24+ /sys/class/power_supply parsing to i think work better in more situations. i'm testing on a device i have that does it - let me know if its wrong... SVN revision: 33903
This commit is contained in:
parent
b5260fd925
commit
16b851a43c
|
@ -26,5 +26,18 @@ module_la_LIBADD = @e_libs@ @cf_libs@ @dlopen_libs@
|
||||||
module_la_LDFLAGS = -module -avoid-version
|
module_la_LDFLAGS = -module -avoid-version
|
||||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
|
||||||
|
batgetdir = $(pkgdir)
|
||||||
|
batget_DATA = \
|
||||||
|
batget$(EXEEXT)
|
||||||
|
|
||||||
|
x_mode = a=rx,u+x
|
||||||
|
install-data-hook:
|
||||||
|
@chmod $(x_mode) $(DESTDIR)$(batgetdir)/batget$(EXEEXT) || true
|
||||||
|
|
||||||
|
noinst_PROGRAMS = batget
|
||||||
|
batget_SOURCES = batget.c
|
||||||
|
batget_LDFLAGS = @BATTERY_LIBS@
|
||||||
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -25,40 +25,13 @@ struct _Config
|
||||||
Evas_List *instances;
|
Evas_List *instances;
|
||||||
E_Menu *menu;
|
E_Menu *menu;
|
||||||
int alarm_triggered;
|
int alarm_triggered;
|
||||||
int battery_check_mode;
|
Ecore_Exe *batget_exe;
|
||||||
Ecore_Poller *battery_check_poller;
|
Ecore_Event_Handler *batget_data_handler;
|
||||||
int battery_prev_drain;
|
Ecore_Event_Handler *batget_del_handler;
|
||||||
int battery_prev_ac;
|
int full;
|
||||||
int battery_prev_battery;
|
int time_left;
|
||||||
int battery_prev_level;
|
int have_battery;
|
||||||
};
|
int have_power;
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#define BATTERY_STATE_NONE 0
|
|
||||||
#define BATTERY_STATE_DISCHARGING 1
|
|
||||||
#define BATTERY_STATE_CHARGING 2
|
|
||||||
#define BATTERY_STATE_REMOVED 7
|
|
||||||
#else
|
|
||||||
#define BATTERY_STATE_NONE 0
|
|
||||||
#define BATTERY_STATE_CHARGING 1
|
|
||||||
#define BATTERY_STATE_DISCHARGING 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _Status
|
|
||||||
{
|
|
||||||
/* Low battery */
|
|
||||||
unsigned char alarm;
|
|
||||||
/* Is there a battery? */
|
|
||||||
unsigned char has_battery;
|
|
||||||
/* charging, discharging, none */
|
|
||||||
unsigned char state;
|
|
||||||
/* Battery level */
|
|
||||||
double level;
|
|
||||||
/* Text */
|
|
||||||
/* reading == % left */
|
|
||||||
char *reading;
|
|
||||||
/* time == time left to empty / full */
|
|
||||||
char *time;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI extern E_Module_Api e_modapi;
|
EAPI extern E_Module_Api e_modapi;
|
||||||
|
|
Loading…
Reference in New Issue