####################################################################### # Sample PARSLED configuration file # # Matthias Gaertner, 04. July 2001, 21. December 2002 # # Empty lines and lines starting with # are considered comments and # are ignored. # You can get a listing of the relevant lines in this file by issuing # grep -v '^[-#]' parsled.conf | grep -v '^$' ####################################################################### # GENERAL SECTION # The initial part of the config file which is not below a section # indication is considered the (one) general section. # DEVICE lists the port where the 'circuit' is attached. # Use command setserial -g /dev/ttyS* to see available ttyS devices. # See /dev/lp* for parallel devices. # Recommended setting: /dev/ttyS0 or /dev/ttyS1. The device must be # read- and writable for the user running parsled. # There is no default for this setting. # # Device detection works as follows: First a TIOCMSET ioctl is used. # If this succeeds, a serial port is assumed. Then a LPGETSTATUS # ioctl is used to see if it is a parallel port. DEVICE=/dev/ttyS1 #DEVICE=/dev/lp0 # PARSLED uses a simple polling structure. INTERVAL indicates the amount # of time to wait between polls. The value is given in milliseconds. # An amount between 100ms and 1000ms is recommended. This ensure a # near-immediate reaction on your keypresses. # Note that sections below always specify multiply factors so that # actual events are delayed. For example, only after a number (MIN) of # cycles (of INTERVAL length each) have elapsed does something happen. # The LEDs, though, gets updated during each cycle. # The default is 100ms. INTERVAL=200 # When forking to the background, PARSLED allows to write the background # process PID to a file. This can be used to kill the process. # If this is not desired, leave the setting empty or comment it. # The default is not to write a PID file. Note that the file must be # writable for the user running parsled. # Suggested value: /var/run/parsled.pid #PIDFILE=/var/run/parsled.pid PIDFILE=pid ####################################################################### # PARSLED has the notion of a group. A group reacts on continous button # activations whose length fall inside a specified window. # In plain language: You state here how long the button may be pressed # for the next action of the group to be executed. # A group is named so that subsequent action definitions can be # associated with a specific group. # PARSLED supports arbitrarily many groups. It is suggested that all # group windows are pairwise disjoint. Otherwise, the group gets # activated which is listed first in the file. [GROUP] # The group name may be any string. It is used to associate ACTION # sections to this group. # There is no default name. NAME=SHORT # Every group mainains an internal state. After activation, only # action sections whose state precondition match the internal state # are electable for execution. This setting sets the initial state. # The default is 1. START=1 # The MIN and MAX settings determine the group activation window. # Button activations whose length fall inside this window select this # group. These values are integer multipliers of the general section's # INTERVAL setting. # If MAX is less than MIN, the group will never be activated. This can # be used to disable the group (set MAX=0). # There are no defaults for MIN and MAX. MIN=5 MAX=10 # Each groups contains zero, one or more ACTION definitions. When # there are none, the group is of little use. [ACTION] # The group setting basically associates the action definition with # a certain button press duration and internal group state. # There is no default group association for an action definition. GROUP=SHORT # The STATE setting identifies the group internal state that must be # present for this action definition to be electable for execution. # This is a precondition. If it is not met, the action definition is # ignored. When there are no action definitions for the internal group # state, the group effectively is disabled. Take care when setting the # group start state! # The default for this setting is 1. STATE=1 # After this action definition has been executed, the internal group # state is set to the value specified in the NEXT setting. This allows # different actions to be initiated by a sequence of similar button # presses. It is intended for outputting a warning before doing the # 'real' action with a 2nd button press or for 'switching' between two # or more states (e.g. toggle modem on or off with one kind of button # press). # For more elaborate sequencing it is definitely preferable to use # shell scripts that maintain their own state somewhere. # The default for this setting is 1. NEXT=2 # Now what happens when the button is pressed for a duration inside # the group window and if the action state precondition is met? # The command specified here is executed using the 'system' function # call. # The configured file or script must be executable by the user # running parsled. Attention: normally, this will be root! # If this setting is left empty, nothing will gets executed, but I # fail to think up something where this might be useful. # There is no default for this setting. # # In this version, parsled does NOT check whether the file is owned by # user running parsled or indeed whether it is not world- or # group-writable. Please take care. You have been warned. COMMAND=/home/mgr/tmp/exec1 # There can be any number of action definitions for any given group. [ACTION] GROUP=SHORT STATE=2 NEXT=1 COMMAND=/home/mgr/tmp/exec2 ####################################################################### # There can be any number of group definitions. [GROUP] NAME=LONG START=1 MIN=20 MAX=30 [ACTION] GROUP=LONG STATE=1 NEXT=1 COMMAND=/home/mgr/tmp/exec3 ####################################################################### # The LED sections specify what is to be displayed by the two LEDs. # I am aware that all this is a slight configuration overkill, but # maybe I upgrade the hardware one day to support more than two LEDs. # The software supports it, but right now there must be at most two # LED definition, one having PHYICAL=0 and one having PHYSICAL=1. [LED] # The LED name is not yet used. It is intended to be able to identify # LED objects by their given name. NAME=YELLOW # This setting associates the LED object with a hardware LED. # Available values at this time are 0 and 1 only, since we only # have two LEDs. PHYSICAL=0 # Every LED can be in one of a number of modes. The mode determines # what is being displayed by the LED. If more than one mode is # specifed, it will be the last one that gets chosen. # Here is a description of the modes available so far: # # In BLINK mode, the LED blinks at a certain frequency defined by # duty cycle. The DUTY_CYCLE_ON and DUTY_CYCLE_OFF settings below # determine the amount of time that the LED is on or off, # respectively. The duty cycle is given as a multiple of the # INTERVAL time span. #MODE=BLINK # In ON mode, the LED is switched ON constantly. #MODE=ON # Now guess what OFF mode is? #MODE=OFF # In BUTTON mode, the LED shows whether the button is depressed # (LED on) or not (LED off). This is handy when the button does not # give sufficient tactile feedback to activate reliably. #MODE=BUTTON # In COMMAND mode, the LED is on if and only if some action would be # executed when the button would be released now. Action state # preconditions and group activation windows apply. This is handy as # a visual feedback because it gives a clear indication on when the # button press is long enough. MODE=COMMAND # In RUNLEVEL mode, the LED 'flashes' a pattern that indicates the # current runlevel the system is in. The runlevel (a number between # 0 and 6, usually) is read and converted to a sequencs of LED # activations. The LED is switched on and off n times where n is the # current runlevel. The length of the individual flashes (both on and # off state) is given by the DUTY_CYCLE_ON setting. After every such # sequence, PARSLED waits for a number of cycles (given by DUTY_CYCLE_OFF) # with the LED switched off. # In effect, the LED could now be part of the array of LEDs from the # venerable KI machine in 'War Games' :-) Well, not really, but wait # for the next version of PARSLED... # # Note: RUNLEVEL mode does not work reliably at this time. Do not use. #MODE=RUNLEVEL # The duty cycle settings are interpreted depending on the selected # LED mode. They are given as multipiers for the INTERVAL setting. DUTY_CYCLE_ON=2 DUTY_CYCLE_OFF=3 [LED] NAME=GREEN PHYSICAL=1 MODE=BLINK #MODE=ON #MODE=OFF #MODE=BUTTON #MODE=COMMAND #MODE=RUNLEVEL DUTY_CYCLE_ON=1 DUTY_CYCLE_OFF=1 #######################################################################