231
Chapter 15: Advanced Configuration
Here is a brief description of the elements of the XML entries in /etc/config/powerstrips.xml.
<powerstrip>
<id>Name or ID of the device support</id>
<outlet port="port-id-1">Display Port 1 in menu</outlet>
<outlet port="port-id-2">Display Port 2 in menu</outlet>
...
<on>script to turn power on</on>
<off>script to power off</off>
<cycle>script to cycle power</cycle>
<status>script to write power status to /var/run/power-status</status>
<speed>baud rate</speed>
<charsize>character size</charsize>
<stop>stop bits</stop>
<parity>parity setting</parity>
</powerstrip>
The id appears on the web page in the list of available devices types to configure.
Theoutletsdescribetargetsthatthescriptscancontrol.Forexample,apowercontrolboardmaycontrolseveraldifferent
outlets.Theport-idisthenativenameforidentifyingtheoutlet.Thisvaluewillbepassedtothescriptsintheenvironment
variable outlet,allowingthescripttoaddressthecorrectoutlet.
There are four possible scripts: on, off, cycle and status
Whenascriptisrun,itsstandardinputandoutputisredirectedtotheappropriateserialport.Thescriptreceivestheoutlet
and port in the outlet and port environment variables respectively.
The script can be anything that can be executed within the shell.
All of the existing scripts in /etc/powerstrips.xml use the pmchat utility.
pmchatworksjustlikethestandardunix"chat"program,onlyitensuresinteroperationwiththeportmanager.
Thenaloptions,speed, charsize, stop and parity define the recommended or default settings for the attached device.