Package: battery-stats Version: 0.3.6-1 Severity: wishlist Hi.
What about rewriting battery-status as a shell script? The current version is dead upstream and thanks to a misfeature in libacpi not working very wel. I made my own battery stats package using a shell script called from cron every 10 minutes (not calling it more often, to keep the disk writes low (save power on laptops). I also added pm-utils hooks to call it before and after the machine is hibernated, and when the external power supply is inserted or disconnected, allowing very detailed collection of battery status. Would it be an idea to rewite battery-status along those lines? This is my collector script, creating a csv file: #!/bin/sh # Inspired by # http://www.ifweassume.com/2013/08/the-de-evolution-of-my-laptop-battery.html logfile=/var/log/hjemmenett-battery-status.log files="manufacturer model_name technology serial_number \ energy_full energy_full_design energy_now cycle_count status" if [ ! -e "$logfile" ] ; then ( printf "timestamp," for f in $files; do printf "%s," $f done echo ) > "$logfile" fi log_battery() { printf "%s," $(date +%s) for f in $files; do printf "%s," $(cat $f) done echo } cd /sys/class/power_supply for bat in BAT*; do (cd $bat && log_battery >> "$logfile") done This is the script in /usr/lib/pm-utils/sleep.d/: #!/bin/sh # Action script to collect battery status just before and just after # going to sleep. # # Copyright: Copyright (c) 2013 Petter Reinholdtsen # License: GPL-2+ # PATH=/sbin:/usr/sbin:/bin:/usr/bin case "${1}" in hibernate|suspend|resume|thaw) if [ -x /usr/sbin/collect-battery-status ]; then /usr/sbin/collect-battery-status fi ;; esac This is the script in /usr/lib/pm-utils/power.d/: #!/bin/sh # Action script to collect battery status when the power connector is # inserted or removed. # # Copyright: Copyright (c) 2013 Petter Reinholdtsen # License: GPL-2+ # PATH=/sbin:/usr/sbin:/bin:/usr/bin case "${1}" in false|true) if [ -x /usr/sbin/collect-battery-status ]; then /usr/sbin/collect-battery-status fi ;; esac The cron.d entry look like this: # Collect battery status ever 10 minutes */10 * * * * root if [ -x /usr/sbin/collect-battery-status ]; then /usr/sbin/collect-battery-status ; fi My home made system lack graph support (I just pull the CSV file into a spreadsheet), so perhaps those parts could be reused from the current battery-status package? -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

