src/power/linux/SDL_syspower.c
changeset 3174 c8b9c6d27476
parent 3170 b7a48f533966
child 3186 51750b7a966f
equal deleted inserted replaced
3173:510e3f36c04a 3174:c8b9c6d27476
    24 #ifndef SDL_POWER_DISABLED
    24 #ifndef SDL_POWER_DISABLED
    25 #ifdef SDL_POWER_LINUX
    25 #ifdef SDL_POWER_LINUX
    26 
    26 
    27 #include <stdio.h>
    27 #include <stdio.h>
    28 #include <unistd.h>
    28 #include <unistd.h>
       
    29 
       
    30 #include <sys/types.h>
       
    31 #include <sys/stat.h>
       
    32 #include <fcntl.h>
    29 
    33 
    30 #include "SDL_power.h"
    34 #include "SDL_power.h"
    31 
    35 
    32 SDL_bool
    36 SDL_bool
    33 SDL_GetPowerInfo_Linux_sys_power(SDL_PowerState *state,
    37 SDL_GetPowerInfo_Linux_sys_power(SDL_PowerState *state,
    42     return SDL_TRUE;
    46     return SDL_TRUE;
    43 #endif
    47 #endif
    44 }
    48 }
    45 
    49 
    46 SDL_bool
    50 SDL_bool
    47 SDL_GetPowerInfo_Linux_sys_proc_acpi(SDL_PowerState *state,
    51 SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state,
    48                                      int *seconds, int *percent)
    52 				 int *seconds, int *percent)
    49 {
    53 {
    50     return SDL_FALSE;  /* !!! FIXME: write me. */
    54     return SDL_FALSE;  /* !!! FIXME: write me. */
    51 #if 0
    55 #if 0
    52     const int fd = open("/proc/acpi", O_RDONLY);
    56     const int fd = open("/proc/acpi", O_RDONLY);
    53     if (fd == -1) {
    57     if (fd == -1) {
    91     return ((*str != '\0') && (*endptr == '\0'));
    95     return ((*str != '\0') && (*endptr == '\0'));
    92 }
    96 }
    93 
    97 
    94 /* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
    98 /* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
    95 SDL_bool
    99 SDL_bool
    96 SDL_GetPowerInfo_Linux_sys_proc_apm(SDL_PowerState *state,
   100 SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state,
    97                                     int *seconds, int *percent)
   101 				int *seconds, int *percent)
    98 {
   102 {
    99     SDL_bool need_details = SDL_FALSE;
   103     SDL_bool need_details = SDL_FALSE;
   100     int ac_status = 0;
   104     int ac_status = 0;
   101     int battery_status = 0;
   105     int battery_status = 0;
   102     int battery_flag = 0;
   106     int battery_flag = 0;