Skip to content

Commit

Permalink
Rename online/offline to adp/bat
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrd committed May 9, 2013
1 parent 8dee2df commit 83bae64
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
58 changes: 29 additions & 29 deletions ftw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@

_defaults() {
MODULES=(uvcvideo videodev)
config-offline() {
config-adp() {
CPUFREQ_GOVERNOR=ondemand
NMI_WATCHDOG=1
BUS_CONTROL=on
PCIE_ASPM_POLICY=default
LAPTOP_MODE=0
DIRTY_RATIO=30
DIRTY_BACKGROUND_RATIO=10
DIRTY_EXPIRE_CENTISECS=300
DIRTY_WRITEBACK_CENTISECS=3000
SCSI_HOST_POLICY=max_performance
REMOUNT_OPTIONS=relatime
BLOCKDEV_READAHEAD=256
HD_POWER_MANAGEMENT=127
HD_SPINDOWN_TIMEOUT=120
SND_INTEL_POWER_SAVE=0
SND_AC97_POWER_SAVE=0
WIRELESS_POWER_SAVE=off
}
config-bat() {
CPUFREQ_GOVERNOR=ondemand
NMI_WATCHDOG=0
BUS_CONTROL=auto
Expand All @@ -22,25 +41,6 @@ _defaults() {
SND_AC97_POWER_SAVE=1
WIRELESS_POWER_SAVE=on
}
config-online() {
CPUFREQ_GOVERNOR=ondemand
NMI_WATCHDOG=1
BUS_CONTROL=on
PCIE_ASPM_POLICY=default
LAPTOP_MODE=0
DIRTY_RATIO=30
DIRTY_BACKGROUND_RATIO=10
DIRTY_EXPIRE_CENTISECS=300
DIRTY_WRITEBACK_CENTISECS=3000
SCSI_HOST_POLICY=max_performance
REMOUNT_OPTIONS=relatime
BLOCKDEV_READAHEAD=256
HD_POWER_MANAGEMENT=127
HD_SPINDOWN_TIMEOUT=120
SND_INTEL_POWER_SAVE=0
SND_AC97_POWER_SAVE=0
WIRELESS_POWER_SAVE=off
}
}

_init() {
Expand Down Expand Up @@ -149,35 +149,35 @@ _common() {
}

case $1 in
offline)
adp)
_init
_call_func config-offline
_call_func config-adp
_common

if [[ $MODULES ]]; then
for i in $MODULES; do
modprobe -r $i &> /dev/null
modprobe $i &> /dev/null
done
fi

_call_func custom-offline
_call_func custom-adp
exit 0
;;
online)
bat)
_init
_call_func config-online
_call_func config-bat
_common

if [[ $MODULES ]]; then
for i in $MODULES; do
modprobe $i &> /dev/null
modprobe -r $i &> /dev/null
done
fi

_call_func custom-online
_call_func custom-bat
exit 0
;;
*)
echo 'usage: ftw [offline|online]'
echo 'usage: ftw [adp|bat]'
exit 1
esac
6 changes: 3 additions & 3 deletions ftw.rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/bin/ftw offline"
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/bin/ftw online"
SUBSYSTEM=="block", ENV{POWER_SUPPLY_ONLINE}=="0", ENV{UDISKS_DISABLE_POLLING}="1"
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/bin/ftw adp"
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/bin/ftw bat"
SUBSYSTEM=="block", ENV{POWER_SUPPLY_ONLINE}=="1", ENV{UDISKS_DISABLE_POLLING}="0"
SUBSYSTEM=="block", ENV{POWER_SUPPLY_ONLINE}=="0", ENV{UDISKS_DISABLE_POLLING}="1"
12 changes: 6 additions & 6 deletions ftwrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PARTITIONS=/dev/sd*
# and HD_SPINDOWN_TIMEOUT.
DEVICES=/dev/sd?

config-offline() {
config-bat() {
# CPU power scheme governor.
CPUFREQ_GOVERNOR=ondemand

Expand Down Expand Up @@ -80,10 +80,7 @@ config-offline() {
WIRELESS_POWER_SAVE=on
}

#custom-offline() {
#}

config-online() {
config-adp() {
CPUFREQ_GOVERNOR=ondemand
NMI_WATCHDOG=1
BUS_CONTROL=on
Expand All @@ -103,5 +100,8 @@ config-online() {
WIRELESS_POWER_SAVE=off
}

#custom-online() {
#custom-bat() {
#}

#custom-adp() {
#}

0 comments on commit 83bae64

Please sign in to comment.