From Electron Cloud
(New page: This is a convention I wish somebody else had thought of and publicized widely a long time ago... there should be one memorable command to see the most relevant power and sensor info on ev...) |
(→Apple Intel systems) |
||
Line 36: | Line 36: | ||
==Apple Intel systems== | ==Apple Intel systems== | ||
+ | Apple uses SMC (system management whatchamacallit) rather than ACPI. If the kernel has support for that, there will be some nodes under /sys/devices/platform/applesmc.768 on a mac mini; not sure if the 768 is different on other systems, or what. |
Revision as of 15:27, 22 June 2009
This is a convention I wish somebody else had thought of and publicized widely a long time ago... there should be one memorable command to see the most relevant power and sensor info on every Linux box. My convention is to call this pow
. It has to be implemented differently on different systems, although that could be automated in some kind of complicated "pow" package which noone has written, AFAIK.
ACPI-compatible PCs
A shell alias might be good enough:
alias pow='cat /proc/acpi/battery/BAT1/info | grep last | cat - /proc/acpi/battery/BAT1/state /proc/acpi/thermal_zone/THRM/temperature'
or you could use a script:
#!/bin/sh CHARGE_NOW=`cat /sys/class/power_supply/BAT0/charge_now` CHARGE_FULL=`cat /sys/class/power_supply/BAT0/charge_full` CHARGE_PERCENT=$(( $CHARGE_NOW * 100 / $CHARGE_FULL )) CHARGE_NOW=`cat /proc/acpi/battery/BAT0/state | grep remaining | cut -c26-` CHARGE_FULL=`cat /proc/acpi/battery/BAT0/info | grep last | cut -c26-` cat /proc/acpi/battery/BAT0/state | grep -v remaining echo "Charge: $CHARGE_NOW / $CHARGE_FULL = $CHARGE_PERCENT%" cat /proc/acpi/thermal_zone/TZS0/temperature /proc/acpi/thermal_zone/TZS1/temperature
which produces output like this:
[acer][02:10:26 PM] pow present: yes capacity state: ok charging state: charging present rate: 2200 mA present voltage: 11663 mV Charge: 1606 mAh / 3799 mAh = 42% temperature: 45 C temperature: 48 C
Apple Intel systems
Apple uses SMC (system management whatchamacallit) rather than ACPI. If the kernel has support for that, there will be some nodes under /sys/devices/platform/applesmc.768 on a mac mini; not sure if the 768 is different on other systems, or what.