Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
f636f1b4
Commit
f636f1b4
authored
Jul 30, 2007
by
David Johnson
Browse files
Add support for hex keys.
parent
c3b144b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/power_rmcp.pm.in
View file @
f636f1b4
...
...
@@ -30,6 +30,29 @@ $| = 1;
my
%
portinfo
=
();
#
#
Quick
conversion
from
hex
to
char
.
Note
that
if
there
's an odd number of
# chars, we just process the last char c as "0x0c".
#
sub hextostr($) {
my $hstr = shift;
if (!defined($hstr)) {
return '';
}
my $retval = "";
my $len = length($hstr);
for (my $i = 0; $i < $len; $i += 2) {
my $ch = substr($hstr,$i,(($i + 2) == $len)?1:2);
$retval .= chr(hex($ch));
print "" . hex($ch) . ",";
}
print "\n";
print "converted $hstr to $retval\n";
return $retval;
}
# usage: rmcpctrl(type, cmd, nodes)
# type = { "asf" } # can probably be extended to ipmi
# cmd = { "cycle" | "on" | "off" }
...
...
@@ -111,6 +134,14 @@ sub rmcpctrl($$@) {
}
}
# if keys are in hex, convert them to char strings:
if ($rkey =~ /^0x/) {
$rkey = hextostr(substr($rkey,2));
}
if ($gkey =~ /^0x/) {
$gkey = hextostr(substr($gkey,2));
}
if ($parallelize) {
if (my $pid = fork()) {
push @kids, $pid;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment