1 |
armin76 08/12/26 18:21:59 |
2 |
|
3 |
Added: conf.d qcontrol.1 ts409.lua 0.4.2-Makefile.patch |
4 |
init.d ts209.lua |
5 |
Log: |
6 |
Initial import, ebuild by me |
7 |
(Portage version: 2.1.6.3/cvs/Linux 2.6.27-gentoo-r7 i686) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-apps/qcontrol/files/conf.d |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/conf.d?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/conf.d?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: conf.d |
16 |
=================================================================== |
17 |
# /etc/conf.d/qcontrol: config file for /etc/init.d/qcontrol |
18 |
|
19 |
# Set to "no" to suppress the sounding of the buzzer |
20 |
#SOUND_BUZZER=no |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
1.1 sys-apps/qcontrol/files/qcontrol.1 |
26 |
|
27 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/qcontrol.1?rev=1.1&view=markup |
28 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/qcontrol.1?rev=1.1&content-type=text/plain |
29 |
|
30 |
Index: qcontrol.1 |
31 |
=================================================================== |
32 |
.TH QCONTROL 1 "2008-08-10" "Debian Project" "" |
33 |
|
34 |
.SH NAME |
35 |
qcontrol \- Hardware control for QNAP TS-109, TS-209 and TS-409 |
36 |
|
37 |
.SH SYNOPSIS |
38 |
\fBqcontrol\fB -d |
39 |
.PP |
40 |
\fBqcontrol\fB \fIcommand\fP \fIvalue\fP |
41 |
|
42 |
.SH DESCRIPTION |
43 |
The utility can be used to control leds or fan speed, or sound the buzzer. |
44 |
As a daemon it can monitor the device for example for button presses or |
45 |
temperature values and trigger actions defined in the LUA configuration |
46 |
file, for example to power off the system or to modify the fan speed. |
47 |
.PP |
48 |
Note: the current version does not have a real daemon mode. Caution is |
49 |
therefore advised when using qcontrol as a real daemon to monitor and |
50 |
control a device. |
51 |
.PP |
52 |
Currently supported devices are the QNAP TS-109, QNAP TS-209 and QNAP |
53 |
TS-409, but support for additional devices may be added in future releases. |
54 |
|
55 |
.SH BASIC USAGE |
56 |
First a control process needs to be started that opens a socket through |
57 |
which the actual commands can be passed. The control proces is be started |
58 |
using the \fB\-d\fP option: |
59 |
# qcontrol \-d |
60 |
.PP |
61 |
Or, to start the control process in a pseudo daemon mode: |
62 |
# qcontrol \-d >/dev/null & disown |
63 |
.PP |
64 |
After that, the actual commands to control devices can be entered (if the |
65 |
first syntax to start the control process was used, this should be done |
66 |
from a separate console): |
67 |
# qcontrol <command> <value> |
68 |
.PP |
69 |
Because the socket file is created in /var/run, all commands must be run |
70 |
as root. |
71 |
|
72 |
.SH OPTIONS |
73 |
This program follows the usual GNU command line syntax, with long options |
74 |
starting with two dashes (`-'). |
75 |
An overview of supported options is included below. |
76 |
|
77 |
.IP "\fB\-d\fP, \fB\-\-daemon\fP" |
78 |
Daemon mode; starts the control process. |
79 |
|
80 |
.IP "\fB\-?\fP, \fB\-\-help\fP" |
81 |
Print command help and info. |
82 |
|
83 |
.IP "\fB\-V\fP, \fB\-\-version\fP" |
84 |
Print program version. |
85 |
|
86 |
.SH SUPPORTED CLIENT COMMANDS |
87 |
Below an overview of the supported commands that can be sent using the |
88 |
program in client mode, and the allowed values for each. |
89 |
|
90 |
Commands (these and others) can also be programmed in response to events |
91 |
using the LUA configuration file. |
92 |
|
93 |
For the leds, values including `1hz' and `2hz' will result in the led |
94 |
flashing on/off in the default or specified color, with the `hz' value |
95 |
determining the speed of the flashes. In the case of `greenred', the led |
96 |
will alternate between green and red instead of on and off. |
97 |
|
98 |
.IP "\fBpowerled\fP" |
99 |
Controls the power led (not available on TS-409). |
100 |
|
101 |
Values: off | on | 1hz | 2hz |
102 |
|
103 |
.IP "\fBstatusled\fP" |
104 |
Controls the status led. |
105 |
|
106 |
Values: |
107 |
off | greenon | redon | |
108 |
green1hz | red1hz | greenred1hz | |
109 |
green2hz | red2hz | greenred2hz |
110 |
|
111 |
.IP "\fBusbled\fP" |
112 |
Controls the usb led. |
113 |
|
114 |
Values: off | on | 8hz |
115 |
|
116 |
.IP "\fBbuzzer\fP" |
117 |
Sounds the buzzer. |
118 |
|
119 |
Values: short | long |
120 |
|
121 |
.IP "\fBfanspeed\fP" |
122 |
Controls the speed of the fan (if present). |
123 |
|
124 |
Values: stop | silence | low | medium | high | full |
125 |
|
126 |
.SH KNOWN ISSUES |
127 |
After running the control process and killing it, the socket file will still |
128 |
exist. This will cause the following error when the control process is started |
129 |
again: `Error binding to socket: Address already in use'. |
130 |
.PP |
131 |
The solution is to remove the socket file and then try again: |
132 |
# rm /var/run/qcontrol.sock |
133 |
.PP |
134 |
The program is not yet very robust against errors in the configuration file. |
135 |
|
136 |
.SH FILES |
137 |
.IP \fB/etc/qcontrol.conf\fP |
138 |
LUA configuration file for qcontrol |
139 |
.IP \fB/etc/default/qcontrol\fP |
140 |
Configuration file for qcontrol init script |
141 |
.IP \fB/var/run/qcontrol.sock\fP |
142 |
Socket file for communication between daemon precess and client |
143 |
|
144 |
.SH SEE ALSO |
145 |
.IP \fB/usr/share/doc/qcontrol/examples\fP |
146 |
Example LUA configuration file containing more advanced commands |
147 |
|
148 |
.SH AUTHOR |
149 |
qcontrol was written by Byron Bradley <byron.bbradley@×××××.com>. |
150 |
.PP |
151 |
This manual page was written by Frans Pop <fjp@××××××.org> |
152 |
for the Debian project (but may be used by others). |
153 |
|
154 |
|
155 |
|
156 |
1.1 sys-apps/qcontrol/files/ts409.lua |
157 |
|
158 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/ts409.lua?rev=1.1&view=markup |
159 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/ts409.lua?rev=1.1&content-type=text/plain |
160 |
|
161 |
Index: ts409.lua |
162 |
=================================================================== |
163 |
--[[ |
164 |
Debian configuration file for qcontrol (LUA syntax) |
165 |
Supports QNAP TS-409. |
166 |
--]] |
167 |
|
168 |
register("ts409") |
169 |
|
170 |
-- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and |
171 |
-- the kernel module gpio_keys to be loaded. |
172 |
register("evdev", "/dev/input/by-path/platform-gpio-keys-event-", |
173 |
408, "restart_button", |
174 |
133, "media_button") |
175 |
|
176 |
function power_button( time ) |
177 |
os.execute("poweroff") |
178 |
end |
179 |
|
180 |
function restart_button( time ) |
181 |
os.execute("reboot") |
182 |
end |
183 |
|
184 |
function media_button( time ) |
185 |
piccmd("usbled", "8hz") |
186 |
end |
187 |
|
188 |
--[[ |
189 |
Fan and temperature control are left disabled until qcontrol |
190 |
gets a proper daemon mode. |
191 |
Empty functions are needed to avoid errors. |
192 |
--]] |
193 |
function fan_error( ) |
194 |
end |
195 |
|
196 |
function fan_normal( ) |
197 |
end |
198 |
|
199 |
function temp( temp ) |
200 |
print("ts409 temperature:", temp) |
201 |
end |
202 |
|
203 |
|
204 |
|
205 |
1.1 sys-apps/qcontrol/files/0.4.2-Makefile.patch |
206 |
|
207 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/0.4.2-Makefile.patch?rev=1.1&view=markup |
208 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/0.4.2-Makefile.patch?rev=1.1&content-type=text/plain |
209 |
|
210 |
Index: 0.4.2-Makefile.patch |
211 |
=================================================================== |
212 |
--- Makefile.orig 2008-11-23 12:44:33.000000000 +0000 |
213 |
+++ Makefile 2008-11-23 12:45:35.000000000 +0000 |
214 |
@@ -1,5 +1,4 @@ |
215 |
-CFLAGS=-Os -Wall -I /usr/include/lua5.1 |
216 |
-LDFLAGS=-llua5.1 -lpthread |
217 |
+LDFLAGS=-llua -lpthread |
218 |
SOURCES=qcontrol.c ts209.c ts409.c evdev.c |
219 |
OBJECTS=$(SOURCES:.c=.o) |
220 |
EXECUTABLE=qcontrol |
221 |
|
222 |
|
223 |
|
224 |
1.1 sys-apps/qcontrol/files/init.d |
225 |
|
226 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/init.d?rev=1.1&view=markup |
227 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/init.d?rev=1.1&content-type=text/plain |
228 |
|
229 |
Index: init.d |
230 |
=================================================================== |
231 |
#!/sbin/runscript |
232 |
# Copyright 1999-2008 Gentoo Foundation |
233 |
# Distributed under the terms of the GNU General Public License v2 |
234 |
# Header: $ |
235 |
|
236 |
# Init script from Debian |
237 |
|
238 |
depend() { |
239 |
after local |
240 |
} |
241 |
|
242 |
start() { |
243 |
einfo "System boot completed" |
244 |
if [ ! -c /dev/input/by-path/platform-gpio-keys-event- ]; then |
245 |
eerror "qcontrol error: gpio_keys device not available" |
246 |
return 1 |
247 |
fi |
248 |
start-stop-daemon --start --quiet --background --pidfile /var/run/qcontrol.pid --make-pidfile --exec /usr/sbin/qcontrol -- -d |
249 |
# Change status led to show green |
250 |
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \ |
251 |
head -n1 | sed "s/^[^:]*: //") |
252 |
case $device in |
253 |
"QNAP TS-109/TS-209") |
254 |
qcontrol statusled greenon || true |
255 |
qcontrol powerled on || true |
256 |
if [ "$SOUND_BUZZER" != no ]; then |
257 |
qcontrol buzzer short || true |
258 |
fi |
259 |
;; |
260 |
"QNAP TS-409") |
261 |
qcontrol statusled greenon || true |
262 |
if [ "$SOUND_BUZZER" != no ]; then |
263 |
qcontrol buzzer short || true |
264 |
fi |
265 |
;; |
266 |
*) |
267 |
eerror "qcontrol error: device is not supported" |
268 |
;; |
269 |
esac |
270 |
start-stop-daemon --stop --quiet --pidfile /var/run/qcontrol.pid --name qcontrol |
271 |
rm /var/run/qcontrol.sock |
272 |
} |
273 |
|
274 |
stop() { |
275 |
einfo "Shutting down system" |
276 |
if [ ! -c /dev/input/by-path/platform-gpio-keys-event- ]; then |
277 |
eerror "qcontrol error: gpio_keys device not available" |
278 |
return 1 |
279 |
fi |
280 |
start-stop-daemon --start --quiet --background --pidfile /var/run/qcontrol.pid --make-pidfile --exec /usr/sbin/qcontrol -- -d |
281 |
# Change status led to show red |
282 |
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \ |
283 |
head -n1 | sed "s/^[^:]*: //") |
284 |
case $device in |
285 |
"QNAP TS-109/TS-209") |
286 |
qcontrol statusled rednon || true |
287 |
qcontrol powerled 1hz || true |
288 |
if [ "$SOUND_BUZZER" != no ]; then |
289 |
qcontrol buzzer short || true |
290 |
fi |
291 |
;; |
292 |
"QNAP TS-409") |
293 |
qcontrol statusled redon || true |
294 |
if [ "$SOUND_BUZZER" != no ]; then |
295 |
qcontrol buzzer short || true |
296 |
fi |
297 |
;; |
298 |
*) |
299 |
eerror "qcontrol error: device is not supported" |
300 |
;; |
301 |
esac |
302 |
start-stop-daemon --stop --quiet --pidfile /var/run/qcontrol.pid --name qcontrol |
303 |
rm /var/run/qcontrol.sock |
304 |
} |
305 |
|
306 |
|
307 |
|
308 |
1.1 sys-apps/qcontrol/files/ts209.lua |
309 |
|
310 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/ts209.lua?rev=1.1&view=markup |
311 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/qcontrol/files/ts209.lua?rev=1.1&content-type=text/plain |
312 |
|
313 |
Index: ts209.lua |
314 |
=================================================================== |
315 |
--[[ |
316 |
Debian configuration file for qcontrol (LUA syntax) |
317 |
Supports both QNAP TS-109 and TS-209. |
318 |
--]] |
319 |
|
320 |
register("ts209") |
321 |
|
322 |
-- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and |
323 |
-- the kernel module gpio_keys to be loaded. |
324 |
register("evdev", "/dev/input/by-path/platform-gpio-keys-event-", |
325 |
408, "restart_button", |
326 |
133, "media_button") |
327 |
|
328 |
function power_button( time ) |
329 |
os.execute("poweroff") |
330 |
end |
331 |
|
332 |
function restart_button( time ) |
333 |
os.execute("reboot") |
334 |
end |
335 |
|
336 |
function media_button( time ) |
337 |
piccmd("usbled", "8hz") |
338 |
end |
339 |
|
340 |
--[[ |
341 |
Fan and temperature control are left disabled until qcontrol |
342 |
gets a proper daemon mode. |
343 |
Empty functions are needed to avoid errors. |
344 |
--]] |
345 |
function fan_error( ) |
346 |
end |
347 |
|
348 |
function fan_normal( ) |
349 |
end |
350 |
|
351 |
function temp_low( ) |
352 |
end |
353 |
|
354 |
function temp_high( ) |
355 |
end |