First of all, replace the proprietary power controller with a simpler custom one. Sources for the controller and a convenience binary are at [LINK]. TFTP the binary to /bin/serial and chmod a+x it:
$ tftp -g -r /srv/tftp/serial -l /bin/serial 10.0.0.300Next, replace the proprietary application with the open source one:
$ chmod a+x /bin/serial
# ls -la /bin/serial
-rwxr-xr-x 1 root root 79481 Jan 1 01:23 /bin/serial
$ vi /etc/inittabLocate the line
::respawn:/bin/switchand replace it with
::respawn:/bin/serial -l 6666or whatever port you desire. The setting used above is 6666. To control the strip through this interface, use ie. netcat. The message format is "t:mmmmmm:vvvvvv", where "t" stands for "toggle", "m" is a mask of which sockets to toggle and "v" is the value to set on the sockets which had m=1. Both "m" and "v" values are either "0" or "1". Example:
$ echo "t:011000:101000" | nc 10.0.0.300 6666
Finally, albeit optional, disable the WiFi and start DHCP client on the wired ethernet port instead:
$ vi /etc/init.d/rcSLocate the line
$ cfg init &and replace it with
mac=`grep -ri "^DEV_MAC" /etc/ | cut -d "=" -f 2`
mac1=`echo "$mac" | grep -o "............$" | grep -o "^.."`
mac2=`echo "$mac" | grep -o "..........$" | grep -o "^.."`
mac3=`echo "$mac" | grep -o "........$" | grep -o "^.."`
mac4=`echo "$mac" | grep -o "......$" | grep -o "^.."`
mac5=`echo "$mac" | grep -o "....$" | grep -o "^.."`
mac6=`echo "$mac" | grep -o "..$" | grep -o "^.."`
ifconfig eth0 hw ether ${mac1}:${mac2}:${mac3}:${mac4}:${mac5}:${mac6}
udhcpc -i eth0 -p /var/run/udhcpc.pid -s /etc/udhcpc.script
Indeed, the MAC address is stored in a configuration file within the filesystem and is configured into the ethernet interface by this "cfg" tool. This can be supplemented by
The reason for the arcane MAC address parsing is because the system on the power strip doesn't have sed or any other useful tool to transform the MAC and the format of the MAC address entry in the configuration file is DEV_MAC=ABCDEF012345.$ ifconfig eth0 hw ether MA:CA:DD:RR:EE:SS
2 comments:
Hey, did u check the blog ? i have some information to ask about the revogi :)
Thx! Reconfigured today and works great! :)
In your howto you using "serial", but GitHub project/file is "reserial". ;)
And I may have encountered one problem - it does not respect / force the execution of the same command again if it has been switched manually in the meantime.
Post a Comment