debian/0000755000000000000000000000000012222736730007172 5ustar debian/qcontrol-udeb.dirs0000644000000000000000000000015312141225714012625 0ustar etc etc/qcontrol lib/debian-installer-startup.d usr/lib/base-installer.d usr/lib/finish-install.d usr/sbin debian/qcontrol.postrm0000644000000000000000000000041412211437662012300 0ustar #! /bin/sh set -e if [ "$1" = purge ]; then rm -f /etc/qcontrol.conf /etc/qcontrol.conf.dpkg* fi if dpkg-maintscript-helper supports rm_conffile; then dpkg-maintscript-helper rm_conffile \ /etc/default/qcontrol 0.5.1-4~ qcontrol -- "$@" fi #DEBHELPER# debian/qcontrol.postinst0000755000000000000000000000173012222736667012655 0ustar #! /bin/sh set -e if [ ! -e /etc/qcontrol.conf ]; then device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \ head -n1 | sed "s/^[^:]*: //") case $device in "QNAP TS-109/TS-209") ln -s qcontrol/ts209.lua /etc/qcontrol.conf ;; "QNAP TS-119/TS-219") ln -s qcontrol/ts219.lua /etc/qcontrol.conf ;; "QNAP TS-409") ln -s qcontrol/ts409.lua /etc/qcontrol.conf ;; "QNAP TS-41x") ln -s qcontrol/ts41x.lua /etc/qcontrol.conf ;; esac fi # Lenny stable update version included custom rules file if [ -e /etc/udev/rules.d/z60-qcontrol.rules ]; then echo "Removing no longer needed udev rules file" rm /etc/udev/rules.d/z60-qcontrol.rules fi if dpkg-maintscript-helper supports rm_conffile; then dpkg-maintscript-helper rm_conffile \ /etc/default/qcontrol 0.5.1-4~ qcontrol -- "$@" fi case "$1" in configure) if [ -x /usr/sbin/update-initramfs ]; then update-initramfs -u fi ;; esac #DEBHELPER# debian/source/0000755000000000000000000000000012141225714010465 5ustar debian/source/format0000644000000000000000000000001412141225714011673 0ustar 3.0 (quilt) debian/README.Debian0000644000000000000000000000177612141225713011240 0ustar qcontrol for Debian --------------------------- The qcontrol program is still in alpha stage. It is for example missing a proper daemon mode that would enable it to run permanently in the background. Because of the missing daemon mode, the functionality to monitor temperature and control fan speed (TS-209/219/409) has been disabled in the config file. See the original config file in ./examples/ for how it could be done. This Debian package includes an init script that will change the leds and sound the buzzer at the end of the boot process and at the beginning of the shutdown or reboot process. The init script only runs the control process as long as needed to make these changes. There is no permanently running daemon to listen for commands, which means that qcontrol also does not yet respond to button presses. For further information, see the man page or the upstream webpage: http://qnap.nas-central.org/index.php/PIC_Control_Software -- Frans Pop Thu, 12 Jun 2008 18:36:54 +0200 debian/qcontrol.preinst0000644000000000000000000000064612211437662012447 0ustar #! /bin/sh set -e # For upgrade from versions < 0.4.2 if [ "$2" ] && dpkg --compare-versions "$2" lt 0.4.2 && \ [ -f /etc/qcontrol.conf ] && [ ! -L /etc/qcontrol.conf ]; then mkdir -p /etc/qcontrol mv /etc/qcontrol.conf /etc/qcontrol/ts209.lua fi if dpkg-maintscript-helper supports rm_conffile; then dpkg-maintscript-helper rm_conffile \ /etc/default/qcontrol 0.5.1-4~ qcontrol -- "$@" fi #DEBHELPER# debian/TODO0000644000000000000000000000024312141225713007653 0ustar * Check for gpio_keys module on install; load it and add to /etc/modules * Update manpage * Update package description * File ITP * Add useful content to the udeb debian/qcontrol.install0000644000000000000000000000002312222736667012427 0ustar qcontrol usr/sbin/ debian/compat0000644000000000000000000000000212141225713010362 0ustar 9 debian/rules0000755000000000000000000000235012222736667010263 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 PACKAGES = $(shell dh_listpackages -s) UDEB_DIRS = lib/debian-installer-startup.d \ usr/lib/base-installer.d \ usr/lib/finish-install.d %: dh $@ override_dh_auto_install: dh_install # Install the following "manually" as they need a rename $(foreach PACKAGE, $(PACKAGES), \ install -m0644 debian/configs/* \ debian/$(PACKAGE)/etc/qcontrol; ) install -m0755 qcontrol-static \ debian/qcontrol-udeb/usr/sbin/qcontrol install -m0755 debian/initramfs/hook \ debian/qcontrol/usr/share/initramfs-tools/hooks/qcontrol install -m0755 debian/initramfs/init-bottom \ debian/qcontrol/usr/share/initramfs-tools/scripts/init-bottom/qcontrol # Install the following "manually" as they need permissions set install -m0755 debian/udeb/qcommand \ debian/qcontrol-udeb/usr/sbin/ $(foreach UDEB_DIR, $(UDEB_DIRS), \ install -m0755 debian/udeb/$$(basename $(UDEB_DIR))/* \ debian/qcontrol-udeb/$(UDEB_DIR); ) override_dh_installinit: dh_installinit --name=qcontrold # This initscript just changes the LEDs and sounds the buzzer. No need # to do this on install or upgrade. dh_installinit --no-start --no-restart-on-upgrade debian/patches/0000755000000000000000000000000012222617160010614 5ustar debian/patches/series0000644000000000000000000000002012222617160012021 0ustar multiarch.patch debian/patches/multiarch.patch0000644000000000000000000000116112222617160013624 0ustar --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CFLAGS += -Os -Wall CPPFLAGS += -DQCONTROL_VERSION=\"$(VERSION)\" LIBS += -lpthread -LIBS_STATIC += /usr/lib/liblua5.1.a -lpthread -lm -ldl +LIBS_STATIC += /usr/lib/$$(dpkg-architecture -qDEB_HOST_MULTIARCH)/liblua5.1.a -lpthread -lm -ldl CFLAGS += $(shell pkg-config --cflags lua5.1) LIBS += $(shell pkg-config --libs lua5.1) @@ -18,7 +18,7 @@ OBJECTS=$(SOURCES:.c=.o) EXECUTABLE=qcontrol -all: $(SOURCES) $(EXECUTABLE) +all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE)-static $(EXECUTABLE): $(OBJECTS) $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ debian/copyright0000644000000000000000000000232512141225713011121 0ustar This package was debianized by Frans Pop on Sun, 23 Mar 2008 18:14:35 +0100. It was downloaded from http://byronbradley.co.uk/piccontrol/. Upstream Author: Byron Bradley Copyright: Copyright (C) 2007-2008 Byron Bradley License: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License can be found in '/usr/share/common-licenses/GPL'. The Debian packaging is (C) 2008, Frans Pop and is licensed under the GPL, see above. debian/qcontrol.init0000644000000000000000000000226112211437662011721 0ustar #!/bin/bash # ### BEGIN INIT INFO # Provides: qcontrol # Required-Start: qcontrold $remote_fs $all # Required-Stop: qcontrold $remote_fs # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Change status leds for QNAP Turbo Station devices ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/qcontrol NAME=qcontrol PIDFILE=/var/run/$NAME.pid test -x $DAEMON || exit 0 . /lib/lsb/init-functions # Include defaults if available if [ -f /etc/default/$NAME ] ; then . /etc/default/$NAME fi if [ ! -e /etc/qcontrol.conf ] ; then exit 0 fi set -e case "$1" in start) # TODO: check that daemon is running log_action_msg "System boot completed" # Change status led to show green etc qcontrol system-status start ;; stop) # TODO: check that daemon is running log_action_msg "Preparing for shutdown" # Change status led to show red etc qcontrol system-status stop ;; force-stop|restart|force-reload|status|reload) ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 debian/qcontrol.qcontrold.init0000644000000000000000000000243112211437775013731 0ustar #!/bin/bash # ### BEGIN INIT INFO # Provides: qcontrold # Required-Start: $local_fs $remote_fs $syslog # Required-Stop: $local_fs $remote_fs $syslog # Should-Start: # Should-Stop: # Default-Start: S # Default-Stop: 0 1 6 # Short-Description: Start qcontrol daemon ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/qcontrol NAME=qcontrol PIDFILE=/var/run/$NAME.pid test -x $DAEMON || exit 0 . /lib/lsb/init-functions SOUND_BUZZER=yes # Include defaults if available if [ -f /etc/default/$NAME ] ; then . /etc/default/$NAME fi # Only run if config exists. if [ ! -e /etc/qcontrol.conf ] ; then exit 0 fi set -e case "$1" in start) log_daemon_msg "Starting qcontrol daemon" "qcontrol" if start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- -d; then log_end_msg 0 else log_end_msg 1 fi ;; stop|force-stop) log_daemon_msg "Stopping qcontrol daemon" "qcontrol" if start-stop-daemon --stop --quiet --oknodo --exec $DAEMON; then log_end_msg 0 else log_end_msg 1 fi ;; restart|reload|force-reload) $0 stop sleep 1 $0 start ;; status) ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 debian/control0000644000000000000000000000253412222736667010612 0ustar Source: qcontrol Section: utils Priority: optional Maintainer: Ian Campbell Build-Depends: debhelper (>= 9), liblua5.1-0-dev, pkg-config Standards-Version: 3.9.4 Vcs-Git: git://git.debian.org/collab-maint/qcontrol.git Vcs-Browser: http://git.debian.org/?p=collab-maint/qcontrol.git Homepage: https://gitorious.org/qcontrol/pages/Home Package: qcontrol Architecture: armel armhf Depends: ${shlibs:Depends}, ${misc:Depends}, udev (>= 0.141-2) Description: hardware control for QNAP Turbo Station devices Allows one to send commands to the microcontroller of supported devices, for example to change leds or sound a buzzer. . Depending on the device it can also monitor for example for button presses or temperature, with events triggering actions defined in the configuration file. . Supported devices at this time are the QNAP TS-109, TS-110, TS-119, TS-209, TS-210, TS-219, TS-219P, TS-409, TS-409U, TS-410, TS-410U, TS-419P and TS-419U but the code is extensible so more devices may be added in future releases. Package: qcontrol-udeb Section: debian-installer Architecture: armel armhf Depends: ${shlibs:Depends}, ${misc:Depends}, udev-udeb (>= 0.141-2), event-modules [armel] XC-Package-Type: udeb Description: hardware control for QNAP Turbo Station devices Allows one to change status leds or sound the buzzer of supported devices. debian/initramfs/0000755000000000000000000000000012203162174011160 5ustar debian/initramfs/init-bottom0000755000000000000000000000116612203162174013357 0ustar #!/bin/sh # Qcontrol boot script, disables watchdog PREREQ="" prereqs() { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac . /scripts/functions # Begin real processing below this line # Only needed on TS-219P II and TS-419P II, safe to call on any TS-x19 though. device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \ head -n1 | sed "s/^[^:]*: //") case $device in "QNAP TS-119/TS-219") break ;; "QNAP TS-41x") break ;; *) exit 0 ;; esac if [ ! -x "/sbin/qcontrol" ]; then exit 0 fi /sbin/qcontrol --direct watchdog off || true exit 0 debian/initramfs/hook0000755000000000000000000000057012203162026012044 0ustar #!/bin/sh PREREQ="" prereqs() { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac if [ ! -x /usr/sbin/qcontrol ] || [ ! -f /etc/qcontrol.conf ] ; then exit 0 fi . /usr/share/initramfs-tools/hook-functions # Begin real processing below this line copy_exec /usr/sbin/qcontrol /sbin cp /etc/qcontrol.conf ${DESTDIR}/etc/qcontrol.conf exit 0 debian/NEWS0000644000000000000000000000236412141225713007670 0ustar qcontrol (0.4.2-2) unstable; urgency=low * Input device changed With udev (0.141-2) the persistent input device created by udev has changed to: /dev/input/by-path/platform-gpio-keys-event. -- Frans Pop Fri, 21 Aug 2009 01:54:46 +0200 qcontrol (0.4.2-1) unstable; urgency=low qcontrol config file compatibility with Linux kernel With Debian kernel 2.6.26 and upstream 2.6.27 a change has been made in the values for restart and media buttons. This version of qcontrol uses the *new* values. As the daemon function of qcontrol is currently not supported this does not really matter. However, if users want to experiment with the daemon mode and button actions and are using older kernel versions, the following changes should be made in the config file that is used. # Values for Debian kernel 2.6.26 and upstream 2.6.27 (or higher) register("evdev", "/dev/input/by-path/platform-gpio-keys-event-", 408, "restart_button", 133, "media_button") # Values for Debian kernel 2.6.25 and upstream 2.6.26 register("evdev", "/dev/input/by-path/platform-gpio-keys-event-", 116, "restart_button", 408, "media_button") -- Frans Pop Mon, 11 Aug 2008 13:56:30 +0200 debian/udeb/0000755000000000000000000000000012141225714010104 5ustar debian/udeb/qcommand0000644000000000000000000000160712141225714011632 0ustar #!/bin/sh # Wrapper script for qcontrol to execute single commands # If called with -t, it only tests if the device is supported # Test if device is supported device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \ head -n1 | sed "s/^[^:]*: //") case $device in "QNAP TS-109/TS-209" | "QNAP TS-119/TS-219" | "QNAP TS-409" | "QNAP TS-41x") # Success or continue [ "$1" = "-t" ] && exit 0 || true ;; *) # Failure or silently exit [ "$1" = "-t" ] && exit 1 || exit 0 ;; esac # The gpio_keys character device is required with the default # Debian configuration file. test_event_dev() { [ -c /dev/input/by-path/platform-gpio-keys-event ] || return 1 } case $device in "QNAP TS-409" | "QNAP TS-41x") if [ "$1" = powerled ]; then exit 0 fi ;; esac test_event_dev || exit 0 # Returns 1 even on success (TODO: is that still true?) qcontrol --direct "$@" || true exit 0 debian/udeb/debian-installer-startup.d/0000755000000000000000000000000012141225714015243 5ustar debian/udeb/debian-installer-startup.d/S99qcontrol0000644000000000000000000000127212141225714017336 0ustar #! /bin/sh if qcommand -t; then watchdog="no" device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \ head -n1 | sed "s/^[^:]*: //") case $device in "QNAP TS-109/TS-209") mv /etc/qcontrol/ts209.lua /etc/qcontrol.conf ;; "QNAP TS-119/TS-219") watchdog="yes" mv /etc/qcontrol/ts219.lua /etc/qcontrol.conf ;; "QNAP TS-409") mv /etc/qcontrol/ts409.lua /etc/qcontrol.conf ;; "QNAP TS-41x") watchdog="yes" mv /etc/qcontrol/ts41x.lua /etc/qcontrol.conf ;; esac rm -rf /etc/qcontrol/ modprobe -q gpio_keys >/dev/null 2>&1 sleep 1 if [ X"$watchdog" = X"yes" ]; then qcommand watchdog off fi qcommand powerled on qcommand statusled green1hz fi debian/udeb/finish-install.d/0000755000000000000000000000000012141225714013252 5ustar debian/udeb/finish-install.d/21qcontrol0000644000000000000000000000012612141225714015200 0ustar #! /bin/sh if qcommand -t; then qcommand powerled 1hz qcommand statusled red1hz fi debian/udeb/base-installer.d/0000755000000000000000000000000012141225714013233 5ustar debian/udeb/base-installer.d/10qcontrol0000644000000000000000000000043712141225714015164 0ustar #! /bin/sh if qcommand -t; then # Queue qcontrol for installation on supported devices apt-install qcontrol # qcontrol requires the gpio_keys module; add it in /etc/modules printf "\n\n# Required for qcontrol\n" >>/target/etc/modules printf "gpio_keys\n" >>/target/etc/modules fi debian/qcontrol.dirs0000644000000000000000000000016712222736667011733 0ustar etc etc/qcontrol etc/qcontrol.d usr/sbin usr/share/initramfs-tools/hooks usr/share/initramfs-tools/scripts/init-bottom debian/changelog0000644000000000000000000001506312222736727011057 0ustar qcontrol (0.5.2-2) UNRELEASED; urgency=low * Superceded unintentional upload of 0.5.2-1~exp1 to unstable instead of experimental. No changes from 0.5.2-1. -- Ian Campbell Wed, 02 Oct 2013 07:31:24 +0100 qcontrol (0.5.2-1) unstable; urgency=low * New upstream release. - Move confdir to end of configuration file, making it useful for local overrides (Closes: #713046) - New system-status module to handle system start/stop notification. Sounding of the buzzer is now controlled in /etc/qcontrol.conf. * Update homepage link in debian/control (Closes: #712190) * Do not pass obsolete parameters to update-rc.d * Simplify qcontrold initscript, use presence of /etc/qcontrol.conf to decide when to start the daemon. -- Ian Campbell Tue, 01 Oct 2013 19:52:44 +0100 qcontrol (0.5.1-3) unstable; urgency=low * Ignore 0x43 (RTC wakeup command) from PIC to avoid spamming logs. * Implement hysteresis for fan control. (Closes: #709095) -- Ian Campbell Sat, 01 Jun 2013 15:02:26 +0100 qcontrol (0.5.1-2) unstable; urgency=low * Remove alpha warning from description * Fix memory corruption bug in confdir handling (Closes: #708376) -- Ian Campbell Sat, 18 May 2013 10:55:39 +0100 qcontrol (0.5.1-1) unstable; urgency=low * New upstream release. - Wake-on-Lan support. (Closes: #703888) - Support for qcontrol.d directories. (Closes: #697574) - Disable buffering when stdout/err is not a tty. (Closes: #703894) - Patches merged upstream. * Only require event-modules udeb on armel. * Add /etc/qcontrol.d include to config files and package the directory -- Ian Campbell Sun, 12 May 2013 19:25:57 +0100 qcontrol (0.5.0-1) unstable; urgency=low * New upstream release. - Several patches merged upstream. * Add lcd_button function to ts41x default configuration. (Closes: #702763) * Sanity check the arguments to functions called from lua. (Closes: #698543) -- Ian Campbell Sun, 12 May 2013 16:41:08 +0100 qcontrol (0.4.2+svn-r40-3) unstable; urgency=low * Fix typo in S99qcontrol installer hook. * Disable firmware watchdog on TS-419p II as well. -- Ian Campbell Sun, 25 Nov 2012 11:51:20 +0000 qcontrol (0.4.2+svn-r40-2) unstable; urgency=low * Disable firmware watchdog on TS-219p II. (Closes: #693263) * Enable LCD on TS-419P II based on GPIO status. (Closes: #689912) -- Ian Campbell Sat, 17 Nov 2012 12:08:50 +0000 qcontrol (0.4.2+svn-r40-1) unstable; urgency=low [ Ian Campbell ] * New maintainer (Closes: #617749) * Incorporate unreleased changes by Frans Pop: - Update to new upstream snapshot r31 (Closes: #513344). - Add an initscript to start daemon on boot. - Enable temperature and fan support. * Switch to 3.0 (quilt) source format. * Switch to debhelper 9 and dh(1). * Update version in --version (Closes: #636325). * Build on armhf (Closes: 645670). * New upstream snapshot r40 (Closes: #600333). * Bump standards version to 3.9.4 (no changes needed). * Enable hardening flags. -- Ian Campbell Sat, 06 Oct 2012 13:45:22 +0100 qcontrol (0.4.2-7) unstable; urgency=medium * QA upload. * Set maintainer to QA group * Apply patch from Matthias Klose to fix FTBFS with ld --as-needed and with multiarched lua (Closes: #643604) * Set urgency to medium due to rc bug fix * Fix lintian detected spelling error in package descriptions (s/Allows\ to/Allows one to/) * Add recommended targets build-arch and build-indep to debian/rules * Add $remote_fs to the Required-Stop of the debian/init.d * Bump standards to 3.9.2 (no furhter changes needed) -- Alexander Reichle-Schmehl Wed, 07 Dec 2011 13:51:09 +0100 qcontrol (0.4.2-6) unstable; urgency=low * qcontrol-udeb: depend on event-modules instead of input-modules. Closes: #589581 -- Martin Michlmayr Tue, 31 Aug 2010 21:59:57 +0100 qcontrol (0.4.2-5) unstable; urgency=low * Also add support for TS-419U to udeb. Closes: #557523. -- Frans Pop Mon, 23 Nov 2009 18:11:02 +0100 qcontrol (0.4.2-4) unstable; urgency=low * Let USB headers match default update-rc.d stop levels. Closes: #554796. * Add support for QNAP TS-419U. Closes: #556206. Many thanks to Martin Michlmayr for the patch. * Update supported devices in documentation. Closes: #556210. Thanks to Martin Michlmayr for the patch. -- Frans Pop Sat, 14 Nov 2009 13:35:41 +0100 qcontrol (0.4.2-3) unstable; urgency=low * Remove custom udev rules file added in Lenny update (0.4.2-1lenny1). -- Frans Pop Thu, 10 Sep 2009 12:15:04 +0200 qcontrol (0.4.2-2) unstable; urgency=low * Use quilt to manage patches against upstream. * Update input device for udev (0.141-2). Closes: #524505. * Use bash for the init script as dash does not support disown. Closes: #538321. * Add support for the QNAP TS-119 and TS-219. Closes: #525721. Many thanks to Martin Michlmayr for the patch. * Add support for autopower feature. Closes: #526932. Thanks to Martin Michlmayr for the patch. -- Frans Pop Fri, 21 Aug 2009 01:55:45 +0200 qcontrol (0.4.2-1) unstable; urgency=low * New upstream version: - support for QNAP TS-409 (closes: #491567) * Update config values for restart and media buttons in line with change in Debian kernel 2.6.26 (upstream 2.6.27). Thanks to Martin Michlmayr for alerting me to the change. * udeb: Modify /etc/modules during base-installer instead of finish-install; it is slightly more logical to do this at the same time as installing the package. -- Frans Pop Mon, 11 Aug 2008 15:21:21 +0200 qcontrol (0.4.1-3) unstable; urgency=low * Add gpio_keys to /etc/modules in target instead of D-I environment. * Remove workaround for missing persistent-input rules. It was added in udev 0.124-1. -- Frans Pop Mon, 14 Jul 2008 17:39:43 +0200 qcontrol (0.4.1-2) unstable; urgency=low * Update watch file for rename from piccontrol to qcontrol. * Fix errors in udeb. Closes: #488394. * Add temporary workaround in udeb for #488439 (missing persistent-input rules in udev-udeb). * Improve the way additional scripts are included in the udeb. -- Frans Pop Thu, 03 Jul 2008 20:21:23 +0200 qcontrol (0.4.1-1) unstable; urgency=low * Initial release. Closes: #483721. -- Frans Pop Thu, 12 Jun 2008 18:46:42 +0200 debian/README.source0000644000000000000000000000036312141225713011345 0ustar This package uses quilt to manage all modifications to the upstream source. Changes are stored in the source package as diffs in debian/patches and applied during the build. See /usr/share/doc/quilt/README.source for a detailed explanation. debian/watch0000644000000000000000000000044612141225714010222 0ustar # Example watch control file for uscan # Rename this file to "watch" and then you can run the "uscan" command # to check for upstream updates and more. # See uscan(1) for format # Compulsory line, this is a version 3 file version=3 http://byronbradley.co.uk/piccontrol/qcontrol-(.*)\.tar\.gz debian/qcontrol.10000644000000000000000000001007512141225714011113 0ustar .TH QCONTROL 1 "2009-12-07" "Debian Project" "" .SH NAME qcontrol \- Hardware control for QNAP Turbo Station .SH SYNOPSIS \fBqcontrol\fB -d .PP \fBqcontrol\fB \fIcommand\fP \fIvalue\fP .SH DESCRIPTION The utility can be used to control leds or fan speed, or sound the buzzer. As a daemon it can monitor the device for example for button presses or temperature values and trigger actions defined in the LUA configuration file, for example to power off the system or to modify the fan speed. .PP Note: the current version does not have a real daemon mode. Caution is therefore advised when using qcontrol as a real daemon to monitor and control a device. .PP Currently supported devices are the QNAP TS-109, QNAP TS-110, QNAP TS-119, QNAP TS-209, QNAP TS-210, QNAP TS-219, QNAP TS-219P, QNAP TS-409, QNAP TS-409U, QNAP TS-410, QNAP TS-410U, QNAP TS-419P and QNAP TS-419U but support for additional devices may be added in future releases. .SH BASIC USAGE Normally a control process will be started when the system is booted. This control process opens a socket through which the actual commands can be passed. A control proces is started using either the \fB\-\-daemon\fP or \fB\-\-foreground\fP options. .PP After that, the actual commands to control devices can be entered: # qcontrol .PP Because the socket file is created in /var/run, all commands must be run as root. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). An overview of supported options is included below. .IP "\fB\-d\fP, \fB\-\-daemon\fP" Starts the control process as a background process (daemon mode). Messages will be logged in the syslog. .IP "\fB\-f\fP, \fB\-\-foreground\fP" Starts the control process as a foreground process. Mainly useful for testing. .IP "\fB\-\-direct\fP" Allows to execute a qcontrol command without a running control process. .IP "\fB\-?\fP, \fB\-\-help\fP" Print command help and info. .IP "\fB\-V\fP, \fB\-\-version\fP" Print program version. .SH SUPPORTED CLIENT COMMANDS Below an overview of the supported commands that can be sent using the program in client mode, and the allowed values for each. Commands (these and others) can also be programmed in response to events using the LUA configuration file. For the leds, values including `1hz' and `2hz' will result in the led flashing on/off in the default or specified color, with the `hz' value determining the speed of the flashes. In the case of `greenred', the led will alternate between green and red instead of on and off. .IP "\fBpowerled\fP" Controls the power led (not available on TS-409 and TS-409U). Values: off | on | 1hz | 2hz .IP "\fBstatusled\fP" Controls the status led. Values: off | greenon | redon | green1hz | red1hz | greenred1hz | green2hz | red2hz | greenred2hz .IP "\fBusbled\fP" Controls the usb led. Values: off | on | 8hz .IP "\fBbuzzer\fP" Sounds the buzzer. Values: short | long .IP "\fBfanspeed\fP" Controls the speed of the fan (if present). Values: stop | silence | low | medium | high | full .IP "\fBautopower\fP" Controls the automatic power mechanism. Values: on | off .SH KNOWN ISSUES After running the control process and killing it, the socket file will still exist. This will cause the following error when the control process is started again: `Error binding to socket: Address already in use'. .PP The solution is to remove the socket file and then try again: # rm /var/run/qcontrol.sock .PP The program is not yet very robust against errors in the configuration file. .SH FILES .IP \fB/etc/qcontrol.conf\fP LUA configuration file for qcontrol .IP \fB/etc/default/qcontrol\fP Configuration file for qcontrol init script .IP \fB/var/run/qcontrol.sock\fP Socket file for communication between daemon precess and client .SH SEE ALSO .IP \fB/usr/share/doc/qcontrol/examples\fP Example LUA configuration file containing more advanced commands .SH AUTHOR qcontrol was written by Byron Bradley . .PP This manual page was written by Frans Pop for the Debian project (but may be used by others). debian/qcontrol.prerm0000644000000000000000000000035412210661400012070 0ustar #! /bin/sh set -e # For downgrade to versions < 0.4.2 if [ "$1" = upgrade ] && dpkg --compare-versions "$2" lt 0.4.2; then rm -f /etc/qcontrol.conf mv /etc/qcontrol/ts209.lua /etc/qcontrol.conf rm -rf /etc/qcontrol/ fi #DEBHELPER# debian/manpages0000644000000000000000000000002212141225714010675 0ustar debian/qcontrol.1 debian/configs/0000755000000000000000000000000012222736667010633 5ustar debian/configs/ts409.lua0000644000000000000000000000542712211437662012220 0ustar --[[ Debian configuration file for qcontrol (LUA syntax) Supports the QNAP TS-409. --]] register("ts409") -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and -- the kernel module gpio_keys to be loaded. register("evdev", "/dev/input/by-path/platform-gpio-keys-event", 408, "restart_button", 133, "media_button") register("system-status") -- Set to "false" to suppress the sounding of the buzzer buzzer = true function system_status( status ) logprint("System status: "..status) if status == "start" then piccmd("statusled", "greenon") piccmd("powerled", "on") if buzzer then piccmd("buzzer", "short") end elseif status == "stop" then piccmd("statusled", "redon") piccmd("powerled", "1hz") if buzzer then piccmd("buzzer", "short") end else logprint("Unknown system status") end end function power_button( time ) os.execute("poweroff") end function restart_button( time ) os.execute("reboot") end function media_button( time ) piccmd("usbled", "8hz") end fanfail = 0 function fan_error( ) fanfail = fanfail + 1 if fanfail == 3 then logprint("ts409: fan error") piccmd("statusled", "red2hz") piccmd("buzzer", "long") else if fanfail == 10 then fanfail = 0 end end end function fan_normal( ) piccmd("statusled", "greenon") fanfail = 0 end last_temp_log = nil last_temp_value = 0 function logtemp( temp ) now = os.time() -- Log only every 5 minutes or if the temperature has changed by -- more than 5. if ( ( not last_temp_log ) or ( os.difftime(now, last_temp_log) >= 300 ) or ( math.abs( temp - last_temp_value ) >= 5 ) ) then logprint(string.format("ts409: temperature %d", temp)) last_temp_log = now last_temp_value = temp end end last_fan_setting = nil function setfan( speed ) if ( ( not last_fan_setting ) or ( last_fan_setting ~= speed ) ) then logprint(string.format("ts409: setting fan to \"%s\"", speed)) end piccmd("fanspeed", speed) last_fan_setting = speed end -- hysteresis implementation: -- - - > 35 > - - - > 40 > - - - > 50 > - - - > 65 > - - - -- silence -- low -- medium -- high -- full | -- - - < 32 < - - - < 35 < - - - < 45 < - - - < 55 < - - - function temp( temp ) logtemp(temp) if last_fan_setting == "full" then if temp < 55 then setfan("high") end elseif last_fan_setting == "high" then if temp > 65 then setfan("full") elseif temp < 45 then setfan("medium") end elseif last_fan_setting == "medium" then if temp > 50 then setfan("high") elseif temp < 35 then setfan("low") end elseif last_fan_setting == "low" then if temp > 40 then setfan("medium") elseif temp < 32 then setfan("silence") end elseif last_fan_setting == "silence" then if temp > 35 then setfan("low") end else setfan("high") end end confdir("/etc/qcontrol.d") debian/configs/ts209.lua0000644000000000000000000000322412211437662012207 0ustar --[[ Debian configuration file for qcontrol (LUA syntax) Supports both QNAP TS-109 and TS-209. --]] register("ts209") -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and -- the kernel module gpio_keys to be loaded. register("evdev", "/dev/input/by-path/platform-gpio-keys-event", 408, "restart_button", 133, "media_button") register("system-status") -- Set to "false" to suppress the sounding of the buzzer buzzer = true function system_status( status ) logprint("System status: "..status) if status == "start" then piccmd("statusled", "greenon") piccmd("powerled", "on") if buzzer then piccmd("buzzer", "short") end elseif status == "stop" then piccmd("statusled", "redon") piccmd("powerled", "1hz") if buzzer then piccmd("buzzer", "short") end else logprint("Unknown system status") end end function power_button( time ) os.execute("poweroff") end function restart_button( time ) os.execute("reboot") end function media_button( time ) piccmd("usbled", "8hz") end fanfail = 0 function fan_error( ) fanfail = fanfail + 1 if fanfail == 3 then logprint("ts209: fan error") piccmd("statusled", "red2hz") piccmd("buzzer", "long") else if fanfail == 10 then fanfail = 0 end end end function fan_normal( ) piccmd("statusled", "greenon") fanfail = 0 end last_fan_setting = nil function setfan( speed ) if ( ( not last_fan_setting ) or ( last_fan_setting ~= speed ) ) then logprint(string.format("ts209: setting fan to \"%s\"", speed)) end piccmd("fanspeed", speed) last_fan_setting = speed end function temp_low( ) setfan("silence") end function temp_high( ) setfan("full") end confdir("/etc/qcontrol.d") debian/configs/ts41x.lua0000644000000000000000000001062612211437662012315 0ustar --[[ Debian configuration file for qcontrol (LUA syntax) Supports the QNAP TS-410, TS-410U, TS-419P and TS-419U. --]] register("ts41x") -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and -- the kernel module gpio_keys to be loaded. register("evdev", "/dev/input/by-path/platform-gpio-keys-event", 408, "restart_button", 133, "media_button") register("system-status") -- Set to "false" to suppress the sounding of the buzzer buzzer = true function system_status( status ) logprint("System status: "..status) if status == "start" then piccmd("statusled", "greenon") piccmd("powerled", "on") if buzzer then piccmd("buzzer", "short") end elseif status == "stop" then piccmd("statusled", "redon") piccmd("powerled", "1hz") if buzzer then piccmd("buzzer", "short") end else logprint("Unknown system status") end end function power_button( time ) os.execute("poweroff") end function restart_button( time ) os.execute("reboot") end function media_button( time ) piccmd("usbled", "8hz") end function lcd_button( state, down, up ) -- exactly key 1 and 2 pressed switches backlight off if state == 3 then piccmd("lcd-backlight", "off") else -- any key pressed activates the backlight if down ~= 0 then piccmd("lcd-backlight", "on") end -- pressing key 1 switches off the usbled the media-key enables... if down == 1 then piccmd("usbled", "off") end end end -- If argument is a function then call it, else return it. function evalfn(f) if type(f) == "function" then return f( ) else return f end end -- Select a value based on the state of a GPIO pin. -- -- results == list of result to return for each state -- value=0 => results[1] -- value=1 => results[2] -- value unknown => results[3] -- -- If result[N] is a function it will be called, -- otherwise it is simply returned as is. function gpio_select(number, results) local path=string.format("/sys/class/gpio/gpio%d/value", number) local gpio=io.open(path) if not gpio then logprint("ts41x: "..path.." does not exist, trying to enable") g = io.open("/sys/class/gpio/enable") if not g then logprint("ts41x: unable to open gpio control file") return evalfn(results[3]) end g:write(number) gpio=io.open(path) end if not gpio then logprint("ts41x: unable to open gpio file") return evalfn(results[3]) end local v=gpio:read("*n") if v == 0 then return evalfn(results[1]) elseif v == 1 then return evalfn(results[2]) else return evalfn(results[3]) end end -- MPP45_GPIO, JP1: 0: LCD, 1: serial console gpio_select(45, { function () register("a125", "/dev/ttyS0") end, nil, nil}) fanfail = 0 function fan_error( ) fanfail = fanfail + 1 if fanfail == 3 then logprint("ts41x: fan error") piccmd("statusled", "red2hz") piccmd("buzzer", "long") else if fanfail == 10 then fanfail = 0 end end end function fan_normal( ) piccmd("statusled", "greenon") fanfail = 0 end last_temp_log = nil last_temp_value = 0 function logtemp( temp ) now = os.time() -- Log only every 5 minutes or if the temperature has changed by -- more than 5. if ( ( not last_temp_log ) or ( os.difftime(now, last_temp_log) >= 300 ) or ( math.abs( temp - last_temp_value ) >= 5 ) ) then logprint(string.format("ts41x: temperature %d", temp)) last_temp_log = now last_temp_value = temp end end last_fan_setting = nil function setfan( speed ) if ( ( not last_fan_setting ) or ( last_fan_setting ~= speed ) ) then logprint(string.format("ts41x: setting fan to \"%s\"", speed)) end piccmd("fanspeed", speed) last_fan_setting = speed end -- hysteresis implementation: -- - - > 35 > - - - > 40 > - - - > 50 > - - - > 65 > - - - -- silence -- low -- medium -- high -- full | -- - - < 32 < - - - < 35 < - - - < 45 < - - - < 55 < - - - function temp( temp ) logtemp(temp) if last_fan_setting == "full" then if temp < 55 then setfan("high") end elseif last_fan_setting == "high" then if temp > 65 then setfan("full") elseif temp < 45 then setfan("medium") end elseif last_fan_setting == "medium" then if temp > 50 then setfan("high") elseif temp < 35 then setfan("low") end elseif last_fan_setting == "low" then if temp > 40 then setfan("medium") elseif temp < 32 then setfan("silence") end elseif last_fan_setting == "silence" then if temp > 35 then setfan("low") end else setfan("high") end end confdir("/etc/qcontrol.d") debian/configs/ts219.lua0000644000000000000000000000546712211437662012223 0ustar --[[ Debian configuration file for qcontrol (LUA syntax) Supports QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P. --]] register("ts219") -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and -- the kernel module gpio_keys to be loaded. register("evdev", "/dev/input/by-path/platform-gpio-keys-event", 408, "restart_button", 133, "media_button") register("system-status") -- Set to "false" to suppress the sounding of the buzzer buzzer = true function system_status( status ) logprint("System status: "..status) if status == "start" then piccmd("statusled", "greenon") piccmd("powerled", "on") if buzzer then piccmd("buzzer", "short") end elseif status == "stop" then piccmd("statusled", "redon") piccmd("powerled", "1hz") if buzzer then piccmd("buzzer", "short") end else logprint("Unknown system status") end end function power_button( time ) os.execute("poweroff") end function restart_button( time ) os.execute("reboot") end function media_button( time ) piccmd("usbled", "8hz") end fanfail = 0 function fan_error( ) fanfail = fanfail + 1 if fanfail == 3 then logprint("ts219: fan error") piccmd("statusled", "red2hz") piccmd("buzzer", "long") else if fanfail == 10 then fanfail = 0 end end end function fan_normal( ) piccmd("statusled", "greenon") fanfail = 0 end last_temp_log = nil last_temp_value = 0 function logtemp( temp ) now = os.time() -- Log only every 5 minutes or if the temperature has changed by -- more than 5. if ( ( not last_temp_log ) or ( os.difftime(now, last_temp_log) >= 300 ) or ( math.abs( temp - last_temp_value ) >= 5 ) ) then logprint(string.format("ts219: temperature %d", temp)) last_temp_log = now last_temp_value = temp end end last_fan_setting = nil function setfan( speed ) if ( ( not last_fan_setting ) or ( last_fan_setting ~= speed ) ) then logprint(string.format("ts219: setting fan to \"%s\"", speed)) end piccmd("fanspeed", speed) last_fan_setting = speed end -- hysteresis implementation: -- - - > 35 > - - - > 40 > - - - > 50 > - - - > 65 > - - - -- silence -- low -- medium -- high -- full | -- - - < 32 < - - - < 35 < - - - < 45 < - - - < 55 < - - - function temp( temp ) logtemp(temp) if last_fan_setting == "full" then if temp < 55 then setfan("high") end elseif last_fan_setting == "high" then if temp > 65 then setfan("full") elseif temp < 45 then setfan("medium") end elseif last_fan_setting == "medium" then if temp > 50 then setfan("high") elseif temp < 35 then setfan("low") end elseif last_fan_setting == "low" then if temp > 40 then setfan("medium") elseif temp < 32 then setfan("silence") end elseif last_fan_setting == "silence" then if temp > 35 then setfan("low") end else setfan("high") end end confdir("/etc/qcontrol.d") debian/docs0000644000000000000000000000013512141225713010036 0ustar # Upstream README not included as its contents are not relevant #README debian/README.Debian