local powerlib implementations
[Libpower]


Classes

struct  apm_info
 apm related header holding apm information More...
struct  capacity_snapshot
 An array of this one is used to estimate the remaining battery capacity in minutes. More...

Functions

int getDevicesNum (const char *dir_name)
 get amount of entries in a directory
int getColonValue (FILE *file, char *value, const size_t value_size, char *def, const size_t def_size)
 get next value which is seperated by a colon
int getDirEntry (const int num, char *file, const size_t size_file, const char *dir_in)
 get a directory entry
int _write_line (const char *filename, const char *fmt,...)
 write a line to a file
int read_apm_info (apm_info *i)
 reads out information from /proc/apm
int check_ACPI_dir (const char *dir)
 check whether module has been loaded and device is available

Function Documentation

int _write_line const char *  filename,
const char *  fmt,
  ...
 

write a line to a file

(e.g.: write "3\n" to /acpi/sleep)

Parameters:
filename the filename to write to
fmt format rule
... lines to write
Returns:
< 0 on error

int check_ACPI_dir const char *  dir  )  [inline]
 

check whether module has been loaded and device is available

Parameters:
dir acpi directory
Return values:
1 on success
NO_MODULE_ERROR 
NO_DEVICE_ERROR 

int getColonValue FILE *  file,
char *  value,
const size_t  value_size,
char *  def,
const size_t  def_size
 

get next value which is seperated by a colon

reads a line and parsed it according to:

"def[spaces]*:[spaces]*value[spaces]*

e.g.: var: 56 mWh returns 56 mWh in value and var in def

Parameters:
file the filename
value value to store the left side of the colon
value_size the size of the value
def value to store the right side of the colon
def_size size of def
Return values:
-1 if no colon ':' if found

int getDevicesNum const char *  dir_name  ) 
 

get amount of entries in a directory

use this to determine available devices

Parameters:
dir_name directory
Returns:
number of devices, < 0 on error

int getDirEntry const int  num,
char *  file,
const size_t  size_file,
const char *  dir_in
 

get a directory entry

file: directory entry searched, e.g.: BAT0

give directory and position of the searched file

position is determined by just looping over the directory

directory . and .. are not counted.

Parameters:
num 0-(number of directories - 1)
file the filename to search for
size_file the size of the file
dir_in the directory the file is in
Return values:
1 if num directory entry(e.g. BAT0) has beend found
-1 if the num directory entry does not exist

int read_apm_info apm_info i  ) 
 

reads out information from /proc/apm

Parameters:
i apm_info struct which gets filled with information
Returns:
< 0 on error
Return values:
1 on success,
-1 if APM notinstalled
-2 if APM installed, but old version.


Generated on Mon Mar 27 09:27:20 2006 for Powersave Daemon by  doxygen 1.4.6