Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.1
pm-utils
pm-utils-1.4.1-vtXX-upower-battery-AC-adapter.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pm-utils-1.4.1-vtXX-upower-battery-AC-adapter.patch of Package pm-utils
*** pm-utils-suse/bin/powersave 2011-03-01 21:18:38.351062624 +0100 *** pm-utils-suse/bin/powersave 2011-03-01 21:25:43.213064195 +0100 *************** *** 54,60 **** continue fi # type 2 is battery ! if upower_device_get_property "${DEVICE}" String:Type 2>/dev/null | grep -q "2$"; then echo "${DEVICE}" fi done --- 54,60 ---- continue fi # type 2 is battery ! if upower_device_get_property "${DEVICE}" string:Type 2>/dev/null | grep uint | grep -q "2$"; then echo "${DEVICE}" fi done *************** *** 63,69 **** # print the ac_adapter found on system # Note: it prints the first match, as it expects only one per machine function upower_find_ac_adapter() { ! for DEVICE in $(upower_call_method org.freedesktop.UPower.EnumerateDevices); do # type 1 is Line Power if upower_device_get_property "${DEVICE}" string:Type 2>/dev/null | grep -q "1$"; then echo "${DEVICE}" --- 63,69 ---- # print the ac_adapter found on system # Note: it prints the first match, as it expects only one per machine function upower_find_ac_adapter() { ! for DEVICE in $(upower_call_method org.freedesktop.UPower.EnumerateDevices | grep -o '/org[A-Za-z0-9/_]*'); do # type 1 is Line Power if upower_device_get_property "${DEVICE}" string:Type 2>/dev/null | grep -q "1$"; then echo "${DEVICE}" *************** *** 193,212 **** done } function upower_battery_info { C=1 for BATTERY in `upower_enumerate_batteries`; do ! SEC=`upower_device_get_property "${BATTERY}" TimeToEmpty` if [ $SEC -ne 0 ]; then let MIN=SEC/60 else MIN=0 fi ! PERC=`upower_device_get_property "${BATTERY}" Percentage` ! case `upower_device_get_property "${BATTERY}" State` in 1) STATE="Charging" ;; 2) STATE="Discharging" ;; 3) STATE="Empty" ;; --- 193,216 ---- done } + function dbus-getv { + sed -n "s#.*[ \t]*$1[0-9]*[ \t]*##p" + } + function upower_battery_info { C=1 for BATTERY in `upower_enumerate_batteries`; do ! let SEC="`upower_device_get_property "${BATTERY}" string:TimeToEmpty | dbus-getv int`" if [ $SEC -ne 0 ]; then let MIN=SEC/60 else MIN=0 fi ! PERC=`upower_device_get_property "${BATTERY}" string:Percentage | dbus-getv double` ! case `upower_device_get_property "${BATTERY}" string:State | dbus-getv uint` in 1) STATE="Charging" ;; 2) STATE="Discharging" ;; 3) STATE="Empty" ;; *************** *** 217,223 **** esac echo "Battery$C:" ! echo -e "\t Remaining percent: $PERC" echo -e "\t Remaining minutes: $MIN" echo -e "\t Charging state: $STATE" --- 221,227 ---- esac echo "Battery$C:" ! echo -e "\t Remaining percent: $PERC%" echo -e "\t Remaining minutes: $MIN" echo -e "\t Charging state: $STATE"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor