The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_GetPowerInfo undetermined result w. Debian
jmcfarlane


Joined: 03 Aug 2012
Posts: 14
Location: Seattle
I suspect that the interface that SDL2 uses to determine power status under Linux has been deprecated and removed. I'm running Debian GNU/Linux 7.4 (wheezy) on a ThinkPad T410. SDL_GetPowerInfo returns SDL_POWERSTATE_UNKNOWN and the secs and pct parameters both come back as -1. It looks like the file paths specified in power/linux/SDL_syspower.c are no longer used. I spent a little time trying to redirect things but didn't have any luck.
SDL_GetPowerInfo undetermined result w. Debian
Ryan C. Gordon
Guest

On 4/1/14, 1:50 AM, jmcfarlane wrote:
Quote:
I suspect that the interface that SDL2 uses to determine power status
under Linux has been deprecated and removed. I'm running Debian
GNU/Linux 7.4 (wheezy)

What does "uname -a" report for Wheezy?

(Specifically, what kernel version does Wheezy use?)

--ryan.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_GetPowerInfo undetermined result w. Debian
Daniel Gibson
Guest

Am 01.04.2014 18:09, schrieb Ryan C. Gordon:
Quote:
On 4/1/14, 1:50 AM, jmcfarlane wrote:
Quote:
I suspect that the interface that SDL2 uses to determine power status
under Linux has been deprecated and removed. I'm running Debian
GNU/Linux 7.4 (wheezy)

What does "uname -a" report for Wheezy?

(Specifically, what kernel version does Wheezy use?)

By default Wheezy uses 3.2, there are backports of newer Kernels though.
See also https://packages.debian.org/wheezy/linux-image-amd64

Cheers,
Daniel

Quote:

--ryan.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
jmcfarlane


Joined: 03 Aug 2012
Posts: 14
Location: Seattle
Yup:
Quote:
Linux tp-debian 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux
SDL_GetPowerInfo undetermined result w. Debian
Ryan C. Gordon
Guest

Quote:
By default Wheezy uses 3.2, there are backports of newer Kernels though.
See also https://packages.debian.org/wheezy/linux-image-amd64

Ah, okay, apparently /proc/acpi is deprecated (too!), and now they want
us to use D-Bus or something. I'll put it on the TODO list.

--ryan.



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_GetPowerInfo undetermined result w. Debian
Daniel Gibson
Guest

Am 01.04.2014 19:16, schrieb Ryan C. Gordon:
Quote:

Quote:
By default Wheezy uses 3.2, there are backports of newer Kernels though.
See also https://packages.debian.org/wheezy/linux-image-amd64

Ah, okay, apparently /proc/acpi is deprecated (too!), and now they want
us to use D-Bus or something. I'll put it on the TODO list.

--ryan.

Percentage:
$ cat /sys/class/power_supply/BAT0/energy_full
53650000
$ cat /sys/class/power_supply/BAT0/energy_now
52500000

Generic:
$ cat /sys/class/power_supply/BAT0/type
Battery
caedes@Cyberdemon:~$ cat /sys/class/power_supply/AC/type
Mains
# power cable currently not plugged in:
$ cat /sys/class/power_supply/AC/online
0
$ cat /sys/class/power_supply/BAT0/status
Discharging

Not sure about seconds, seems like you have to calculate that yourself
(get energy_now, wait a minute, get it again, interpolate remaining time
from delta)

Cheers,
Daniel

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org