![]() |
LINUX SDK ADU Command Line Utility The adu command line utility allows an ADU device to be Download the adu binary executable Download the adu source code The adu source code is liberally licenced so you adu Command Line Utility DocumentationInput commands can be placed on the command line, Results are written to stdout so they can be piped to Usageadu -f filename -i id -r -v command Options -f filename the name of a file containg commands to
be written to the ADU device
-i id the id of the ADU device, This is used to
form the path used to access the ADU.
(ie -i 0 means /dev/adutux0)
-r Causes adu to read the response from the
ADU device. If a command is present on the
command line then it is written to the ADU
device before the read is attempted. If no
command is present on the command line then
you must request a response from the ADU
with a prior operation first.
-v Causes adu to print its version number.
command Command that is sent to the ADU device.
Modesadu can be used in 5 ways
(1) specify a command on the command line
eg adu mk3
(2) place commands in a file identified by the -f option
eg adu -f command.file
(3) enter commands through the console interactively
eg adu
Command Formats
NOTE: In console or file mode the action MUST be the first Example (using ADU208, other models may use different commands) w mk3
w pk
r
r pk
Buffering
If you write a responsive commands without an accompanying Example: w db1
w db
w mk3
w pk
r
r
It does not hurt to do extra reads to insure that the buffers Scripting Example(Gasp.... an example ..... Richard Stallman will NOT be pleased.)
#!/bin/bash
echo == ADU bash shell script event counter demo ==
while [ 1 -eq 1 ]
do
# the re0 response is piped to the basic calculator
Count0=$(./adu -r re0 | bc)
echo count is $Count0
if [ $Count0 -gt 20 ]
then
echo counter exceeds 20 hits -- value is $Count0
# toggle relay k0 to simulate an action
./adu mk1
sleep 1 # keep relay k0 on for a while
./adu mk0
echo now resetting the counter
./adu -r rc0
fi
sleep 1 # for a real application you may want to
# be more responsive
done
Demonstration of the ScriptA wire was hooked up to the VDD terminal of an ADU208. $ ./demo.sh
== ADU bash shell script event counter demo ==
count is 1
count is 6
count is 10
count is 21
:counter exceeds 20 hits -- value is 21
now resetting the counter
00027
count is 8
count is 15
count is 21
counter exceeds 20 hits -- value is 21
now resetting the counter
00030
count is 2
count is 13
count is 23
counter exceeds 20 hits -- value is 23
now resetting the counter
00025
count is 0
count is 0
count is 0
CreditsThanks to Steven Haigh for instigating the development. LicensingI am not a lawyer. The adu utility is not a copy of Fedora Coreadu was developed on a Fedora Core Linux distribution. |
|