Files
genode/tool/run/power_on/energenie
Roman Iten 5ebcf36d69 tool/run: introduce '[have_]cmd_arg'-procs
Renaming 'get_cmd_switch' and 'get_cmd_arg' to 'have_cmd_arg' and
'cmd_arg' respectively blends in nicely with the now omnipresent pattern
with 'have_[spec|board|installed|include]'.

This commit deprecates 'get_cmd_switch' and 'get_cmd_arg', which will be
removed in a later commit.

Issue #5432
2025-02-24 16:39:20 +01:00

39 lines
988 B
Plaintext

##
# Reset the target machine via EnerGenie poweplug by Gembird
#
# \param --power-on-energenie-host network address of device
# \param --power-on-energenie-password password for device
# \param --power-on-energenie-port target port of device
#
proc power_on_energenie_host { } {
return [cmd_arg_first --power-on-energenie-host 1]
}
proc power_on_energenie_password { } {
return [cmd_arg_first --power-on-energenie-password 1]
}
proc power_on_energenie_port { } {
return [cmd_arg_first --power-on-energenie-port 1]
}
proc run_power_on { } {
set host [power_on_energenie_host]
set password [power_on_energenie_password]
set power_port [power_on_energenie_port]
puts "switch port $power_port on"
# login - switch - logout
exec curl -s -o /dev/null -d pw=$password http://$host/login.html
exec curl -s -o /dev/null -d ctl$power_port=1 http://$host/status.html
exec curl -s -o /dev/null http://$host/login.html
return true
}