src/power/linux/SDL_syspower.c
changeset 3207 65fdb0961d7c
parent 3206 f735edf338d3
child 3697 f7b03b6838cb
equal deleted inserted replaced
3206:f735edf338d3 3207:65fdb0961d7c
    32 #include <dirent.h>
    32 #include <dirent.h>
    33 #include <fcntl.h>
    33 #include <fcntl.h>
    34 
    34 
    35 #include "SDL_power.h"
    35 #include "SDL_power.h"
    36 
    36 
       
    37 static const char *proc_apm_path = "/proc/apm";
    37 static const char *proc_acpi_battery_path = "/proc/acpi/battery";
    38 static const char *proc_acpi_battery_path = "/proc/acpi/battery";
    38 static const char *proc_acpi_ac_adapter_path = "/proc/acpi/ac_adapter";
    39 static const char *proc_acpi_ac_adapter_path = "/proc/acpi/ac_adapter";
    39 
    40 
    40 static int open_acpi_file(const char *base, const char *node, const char *key)
    41 static int open_acpi_file(const char *base, const char *node, const char *key)
    41 {
    42 {
   331     int ac_status = 0;
   332     int ac_status = 0;
   332     int battery_status = 0;
   333     int battery_status = 0;
   333     int battery_flag = 0;
   334     int battery_flag = 0;
   334     int battery_percent = 0;
   335     int battery_percent = 0;
   335     int battery_time = 0;
   336     int battery_time = 0;
   336     const int fd = open("/proc/apm", O_RDONLY);
   337     const int fd = open(proc_apm_path, O_RDONLY);
   337     char buf[128];
   338     char buf[128];
   338     char *ptr = &buf[0];
   339     char *ptr = &buf[0];
   339     char *str = NULL;
   340     char *str = NULL;
   340     ssize_t br;
   341     ssize_t br;
   341 
   342