1 |
ottxor 13/11/04 04:05:31 |
2 |
|
3 |
Added: tpacpi-bat.initd.1 |
4 |
Log: |
5 |
fixes for new call syntax (bug #485526#c2) |
6 |
|
7 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key C2000586) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-laptop/tpacpi-bat/files/tpacpi-bat.initd.1 |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tpacpi-bat/files/tpacpi-bat.initd.1?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tpacpi-bat/files/tpacpi-bat.initd.1?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: tpacpi-bat.initd.1 |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
# Copyright (C) 2012-2013 Christoph Junghans <ottxor@g.o> |
19 |
# |
20 |
# Distributed under the terms of the GNU General Public License, v2 or later |
21 |
|
22 |
extra_started_commands="low high info" |
23 |
|
24 |
BATS="1" |
25 |
|
26 |
depend() { |
27 |
after modules |
28 |
} |
29 |
|
30 |
start() { |
31 |
local state1 |
32 |
|
33 |
ebegin "Making sure that module 'acpi_call' is loaded" |
34 |
modprobe acpi_call |
35 |
state1=$? |
36 |
eend ${state1} |
37 |
|
38 |
[ "${state1}" -ne "0" ] && return 1 |
39 |
|
40 |
ebegin "Starting ${SVCNAME}" |
41 |
set_all ${TPACPI_BAT_THRESH_START} ${TPACPI_BAT_THRESH_STOP} |
42 |
eend $? |
43 |
} |
44 |
|
45 |
stop() { |
46 |
einfo "Nothing required to be done to stop ${SVCNAME}" |
47 |
} |
48 |
|
49 |
require_started() { |
50 |
if ! service_started; then |
51 |
"${RC_SERVICE}" start || return $? |
52 |
fi |
53 |
} |
54 |
|
55 |
high() { |
56 |
require_started |
57 |
|
58 |
einfo "Switching ${SVCNAME} to high thesholds" |
59 |
set_all ${TPACPI_BAT_HIGH_THRESH_START} ${TPACPI_BAT_HIGH_THRESH_STOP} |
60 |
} |
61 |
|
62 |
low() { |
63 |
require_started |
64 |
|
65 |
einfo "Switching ${SVCNAME} to low thesholds" |
66 |
set_all ${TPACPI_BAT_LOW_THRESH_START} ${TPACPI_BAT_LOW_THRESH_STOP} |
67 |
} |
68 |
|
69 |
set_all() { |
70 |
local tstart=$1 |
71 |
local tstop=$2 |
72 |
local bat |
73 |
|
74 |
for bat in ${BATS}; do |
75 |
ebegin " setting thresholds for ${bat}: $tstart $tstop" |
76 |
/usr/bin/tpacpi-bat -s startChargeThreshold ${bat} ${tstart} |
77 |
/usr/bin/tpacpi-bat -s stopChargeThreshold ${bat} ${tstop} |
78 |
eend $? |
79 |
done |
80 |
} |
81 |
|
82 |
info() { |
83 |
local tstart |
84 |
local tstop |
85 |
local bat |
86 |
|
87 |
require_started |
88 |
|
89 |
for bat in ${BATS}; do |
90 |
tstart=$(/usr/bin/tpacpi-bat -g startChargeThreshold ${bat}) |
91 |
tstop=$(/usr/bin/tpacpi-bat -g stopChargeThreshold ${bat}) |
92 |
einfo "Battery ${bat}: ${tstart} ${tstop}" |
93 |
done |
94 |
} |