Signed-off-by: Grant Likely <[email protected]>
---
 conmux/drivers/dli-lpc   |   52 ++++++++++++++++++++++++++++++++++++++++++++++
 conmux/drivers/module.mk |    2 +-
 2 files changed, 53 insertions(+), 1 deletions(-)
 create mode 100755 conmux/drivers/dli-lpc

diff --git a/conmux/drivers/dli-lpc b/conmux/drivers/dli-lpc
new file mode 100755
index 0000000..edf09e2
--- /dev/null
+++ b/conmux/drivers/dli-lpc
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# Port control script for Digital Loggers Inc. Web Power Switch II and III
+#
+# Written by: Grant Likely <[email protected]>
+# Copyright 2010 Secret Lab Technologies Ltd.
+#
+# Usage: dli-pscontrol.sh <admin:pas...@host> <port> {on|off|cycle}
+#
+# <port> is in the range 1..8.
+# 'cycle' will turn a port off and on with a 1 second delay.
+#
+# The Web Power Switch uses a simple http request protocol for controlling
+# the port state.  The action simply gets encoded into the url in the form:
+#
+#   http://<user>:<passwd>@<host[:port]>/outlet?<port-number>={ON|OFF|CCW}
+#
+# ON and OFF are self explanatory.
+# CCW means cycle power, but only has effect when the port is already on.
+#
+# The protocol is simple enough that wget is sufficient to control ports.
+
+baseurl="http://${1}";
+porturl="${baseurl}/outlet?${2}"
+
+wget_cmd="wget --auth-no-challenge -O /dev/null"
+
+port_set() {
+       ${wget_cmd} "${porturl}=${1}" > /dev/null 2>&1
+}
+
+case "$3" in
+  on)
+       port_set ON
+       ;;
+  off)
+       port_set OFF
+       ;;
+  cycle)
+       # The CCW command *could* be used here, but the command has no
+       # effect if the port is in the OFF state.
+       port_set OFF
+       sleep 1s
+       port_set ON
+       ;;
+  *)
+       echo "Usage: $0 <admin:pas...@host> <port> {on|off|cycle}"
+       exit 1;
+       ;;
+esac
+
+exit 0
diff --git a/conmux/drivers/module.mk b/conmux/drivers/module.mk
index 4d17ca6..7c36663 100644
--- a/conmux/drivers/module.mk
+++ b/conmux/drivers/module.mk
@@ -3,7 +3,7 @@
 #
 # The Console Multiplexor is released under the GNU Public License V2
 
-DRIVERS:=blade hmc reboot-netfinity reboot-newisys reboot-numaq \
+DRIVERS:=blade dli-lpc hmc reboot-netfinity reboot-newisys reboot-numaq \
        reboot-rsa reboot-rsa2 zseries-console x3270_glue.expect \
        reboot-acs48 reboot-apc reboot-laurel fence_apc_snmp.py
 

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to