AVR-EVTD(8) | System Manager's Manual | AVR-EVTD(8) |
NAME¶
avr-evtd - Linkstation AVR Event daemonSYNOPSIS¶
avr-evtd [ -d /dev/tty ] [i | c | v]DESCRIPTION¶
avr-evtd is a simple and small user space interface to the Linkstation AVR micro-controller. It doesn't have a lot of special features, but it's main task is to provide 'keep-alive' messages to the Linkstation's on-board AVR device. This device controls/monitors the fan, various LEDs, timed power up and two buttons. This daemon provides the necessary initialization to the device and also stimulates the LEDs depending on various fault conditions. It also monitors a power button (located at the front) and a reset button (located at the rear).OPTIONS¶
- -d
- /dev/tty Specifies the UART device used to
communicate with the AVR. This is normally taken care of by the scripts
but can be specified in the configuration file. See below for
details.
- -c
- Don't fork, i.e. run in the foreground (debug use only).
- -i
- Returns the port memory location for the device specified
by -d /dev/tty
- -v
- Display daemon version.
THE CONFIGURATION FILE¶
The avr-evtd configuration file is the fallback file in the event that the stock melco files do not exist. The file is read at initial start-up in order to determine if timed shutdown is required and if the disk usage is to be monitored. The file should be always located within the /etc/default directory and a sample file is provided. The file format is similar to other Unix configuration files - comments begin with a # character and extend to the end of the line; blank lines are ignored. Configuration commands consist of an initial keyword followed by an argument. Arguments may be strings or times written in HH:MM (UTC) format. Optional arguments are delimited by [ ] in the following descriptions, while alternatives are separated by |.-
- [ON | OFF]
-
- [YES | NO]
-
- [/dev/tty]
-
- [ON=HH:MM | ON= | OFF=HH:MM | OFF=]
MON-WED=ON=09:00,OFF=23:00
THR=ON=09:00
FRI=OFF=01:00
In this example, the first power on event is
Monday at 09:00. At 23:00 the Linkstation will power down. This is repeated
for Tuesday and Wednesday. On Thursday, the Linkstation will power on at 09:00
and will power off on Friday at 01:00. The unit will then remain off for
Saturday and Sunday and not power up again till 09:00 on Monday. The unit is
capable of sleeping for no more than 68 hours (due to the resolution of the
internal timer). Again, this time MUST be specified in UTC format and follow
HH:MM.
Five minutes before power off is required, a message is broadcast to all console
users. At shutdown, an event message is sent to the event script. See below
for more details.
-
- [HH:MM]
-
- [HH:MM]
If single or multiple day events are
specified, then this becomes the default power on time for any undefined
days.
-
- [OFF | 0..100]
-
- [hda1..9]
-
- [hda1..9]
-
- [1..300]
-
- [1..9]
-
- [ON | OFF]
- FANSTOP
- [OFF | 0..60]
BUTTON OPERATION¶
All events, whether mechanical button operation, or software reset/shutdown actions are routed through an event script located at /etc/avr-evtd/EventSCript-
- On press, a button event message is sent. On release, another event message is sent. If the button is held in for more than HOLD seconds, then a shutdown event request is sent. If the button is pressed twice within a period of one second, then a reset request event is sent.
-
- On press, a button event message is sent. On release,
another event message is sent. If the button is held in for more than
twenty seconds, then a EM-Mode event request is sent. If the button is
pressed twice within a period of one second, then a special event
is sent which in the default state will launch the telnet daemon.
MESSAGE EVENTS¶
The event system has been modified such that 99% of the daemon event system is pushed through the event script. A third parameter is supplied by the daemon out to the script detailing information relevant to the generated message. For example, for a disk full message, the third parameter would detail the percentage disk space used (worst of the two monitored partitions) and when this is cleared, then this parameter would be cleared to zero.-
- User has requested (by double press of reset button) to,
with the first press, launch the telnet daemon, or other client as
specified in the EventScript. The script also establishes a static
IP to an alias Ethernet device :EM at 192.168.11.150. If this IP is
already in-use, then it will not be created. If the Ethernet is not
running, then an alternative Ethernet configuration file is loaded
providing a static IP at 192.168.11.150. and also a DHCP provided IP. On
the THIRD double press, then a known set of group and user password
files are copied to /etc. Prior to the transfer, the relevant original
files are copied to .em. A file, recovery.tar, is extracted and the
LEDs are flashed to indicate this new mode. A user can now gain root
access using the password emergency and gain access via the telnet
port 1234 to their box.
-
- AVR micro-controller has requested a reset.
-
- Shutdown request from the shutdown timer event.
-
- Power button has been released event.
-
- Power button has been pressed event.
-
- Reset button (rear of unit) has been released.
-
- Reset button has been pressed.
-
- User has requested (by holding power button for more than
HOLD seconds) to shutdown the unit.
-
- User has requested (by double press of the power button) to
reset the unit.
-
- Disk usage greater than DISKCHECK. Parameter 3 set to
percentage used or zero.
-
- Fan has been stationary for FANSTOP seconds. Parameter 3 is
set to 4 when cleared.
-
- EM-Mode has been selected. The EM-Mode sequence is written
to the desired flash location and the system is issued a reboot request.
EM-Mode is an emergency boot mode that for the Linkstation it boots from
an image in flash and rebuilds files on the disk. This should only be
used by those who know what will happen to their disks when this Mode
is selected
-
- The system will shutdown in less than five minutes warning.
Parameter 3 indicates shutdown delay on power press.
-
- Error message handler. Parameter 3 indicates error number.
ERROR CODES¶
The following error messages maybe displayed in the log files during operation:-
- No stock or avr-evtd configuration files were located.
-
- Power off time greater than that supported by the AVR. As
this is calculated at the time the timer is established, this fault may
clear at shutdown as timers are re-validated.
-
- Timer declaration error in /etc/default/avr-evtd
configuration file
-
- Error in stock configuration file
FILES¶
/etc/default/avr-evtd
/etc/avr-evtd/EventScript
/etc/avr-evtd/emergency-eth0
/etc/default/events.log
/etc/avr-evtd/recovery.tar
AUTHORS¶
Bob Perry <lb-source@users.sourceforge.net> (2006), with some modifications by Rogério Brito <rbrito@users.sourceforge.net> (2008, 2009).COPYRIGHT¶
This program 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 2 of the License, or (at your option) any later version. This program 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 program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.28 Aug 2009 |