mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
539e5212ab
The run plugin is not generic and works for NETIO4/NETIO230 powerplugs only. Further, this opens the path for other vendor-specific powerplug plugins. Note, the plugin parameter for the addressed powerplug was renamed to --power-on-netio-host resp. --power-off-netio-host
55 lines
1.4 KiB
Plaintext
55 lines
1.4 KiB
Plaintext
##
|
|
# Reset the target machine via NETIO4/NETIO230 powerplug by Koukaam
|
|
#
|
|
# \param --power-on-netio-host network address of device
|
|
# \param --power-on-netio-user user for device
|
|
# \param --power-on-netio-password password for device
|
|
# \param --power-on-netio-port target port of device
|
|
#
|
|
|
|
source [genode_dir]/tool/run/power_netio.inc
|
|
|
|
|
|
proc power_on_netio_host { } {
|
|
return [get_cmd_arg_first --power-on-netio-host 1]
|
|
}
|
|
|
|
|
|
proc power_on_netio_user { } {
|
|
return [get_cmd_arg_first --power-on-netio-user 1]
|
|
}
|
|
|
|
|
|
proc power_on_netio_password { } {
|
|
return [get_cmd_arg_first --power-on-netio-password 1]
|
|
}
|
|
|
|
|
|
proc power_on_netio_port { } {
|
|
return [get_cmd_arg_first --power-on-netio-port 1]
|
|
}
|
|
|
|
|
|
|
|
proc run_power_on { } {
|
|
set host [power_on_netio_host]
|
|
set user_name [power_on_netio_user]
|
|
set password [power_on_netio_password]
|
|
set power_port [power_on_netio_port]
|
|
|
|
set connection_id [power_netio_connect $host $user_name $password]
|
|
|
|
send -i $connection_id "port $power_port\n"
|
|
expect -i $connection_id -re {250 [0-9]+.*\n}
|
|
regexp -all {[0-9]+} $expect_out(0,string) power_status
|
|
if {!$power_status} {
|
|
puts "port $power_port is off - switching it on"
|
|
send -i $connection_id "port $power_port 1\n"
|
|
expect -i $connection_id "250 OK"
|
|
} else {
|
|
puts "port $power_port is on - reset port"
|
|
send -i $connection_id "port $power_port int\n"
|
|
expect -i $connection_id "250 OK"
|
|
}
|
|
}
|