102 |
$amt_version = $sas->GetCoreVersion()->paramsout; |
$amt_version = $sas->GetCoreVersion()->paramsout; |
103 |
} |
} |
104 |
|
|
105 |
|
sub _soap { |
106 |
|
my $name = shift; |
107 |
|
|
108 |
|
my $proxybase = "http://$amt_host:$amt_port"; |
109 |
|
my $schemabase = "http://schemas.intel.com/platform/client"; |
110 |
|
|
111 |
|
warn "call_soap $proxybase $name ",dump( @_ ); |
112 |
|
|
113 |
|
my $soap = SOAP::Lite->new( |
114 |
|
proxy => "$proxybase/${name}Service", |
115 |
|
default_ns => "$schemabase/$name/2004/01"); |
116 |
|
|
117 |
|
$soap->autotype(0); |
118 |
|
|
119 |
|
if ( @_ ) { |
120 |
|
do_soap($soap, "RemoteControl", @_) |
121 |
|
} else { |
122 |
|
return $soap; |
123 |
|
} |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
############################################################################# |
############################################################################# |
128 |
# functions |
# functions |
245 |
printf "Powerstate: %s\n", $ps [ $powerstate & 0x0f ]; |
printf "Powerstate: %s\n", $ps [ $powerstate & 0x0f ]; |
246 |
} |
} |
247 |
|
|
|
use Intel::AMT::RemoteControl; |
|
|
|
|
|
sub describe { |
|
|
warn 'describe ',dump( @_ ) if $amt_debug; |
|
|
my ( $value, $map ) = @_; |
|
|
my $out; |
|
|
foreach my $name ( keys %$map ) { |
|
|
push @$out, $name if $value & $map->{$name}; |
|
|
} |
|
|
push @$out, sprintf("%x", $value) unless $out; |
|
|
return $out; |
|
|
} |
|
|
|
|
|
sub RemoteControlCapabilities { |
|
|
my @rccaps = $rcs->GetRemoteControlCapabilities()->paramsout; |
|
|
|
|
|
my $return = { |
|
|
IanaOemNumber => $rccaps[0], |
|
|
OemDefinedCapabilities => |
|
|
describe( $rccaps[1], $Intel::AMT::RemoteControl::OemDefinedCapabilitiesSupported ), |
|
|
SpecialCommand => |
|
|
describe( $rccaps[2], $Intel::AMT::RemoteControl::SpecialCommandSupported ), |
|
|
SystemCapabilities => |
|
|
describe( $rccaps[3], $Intel::AMT::RemoteControl::SystemCapabilitiesSupported ), |
|
|
SystemFirmwareCapabilities => |
|
|
describe( $rccaps[4], $Intel::AMT::RemoteControl::SystemFirmwareCapabilitiesSupported ), |
|
|
}; |
|
|
|
|
|
warn '# RemoteControlCapabilities ',dump( $return ); |
|
|
return $return; |
|
|
} |
|
|
|
|
|
sub RemoteControl { |
|
|
my @args; |
|
|
|
|
|
my $hostname = $nas->GetHostName()->paramsout; |
|
|
my $domainname = $nas->GetDomainName()->paramsout; |
|
|
|
|
|
warn $hostname, '.', $domainname, ' execute: ', dump( @_ ); |
|
|
|
|
|
my $BootOptions; |
|
|
my $SpecialCommandParameter; |
|
|
|
|
|
foreach my $command ( @_ ) { |
|
|
|
|
|
my $i; |
|
|
|
|
|
if ( $i = $Intel::AMT::RemoteControl::BootOptions->{$command} ) { |
|
|
if ( $BootOptions ) { |
|
|
$BootOptions |= $i; |
|
|
next; |
|
|
} else { |
|
|
$BootOptions = $i; |
|
|
$command = 'SetBootOptions'; |
|
|
} |
|
|
} elsif ( $i = $Intel::AMT::RemoteControl::SpecialCommandParameters->{$command} ) { |
|
|
$SpecialCommandParameter |= $i; |
|
|
} elsif ( $i = $Intel::AMT::RemoteControl::RemoteControlCommand->{$command} ) { |
|
|
push @args, SOAP::Data->name( 'Command' => $i ); |
|
|
} elsif ( $i = $Intel::AMT::RemoteControl::SpecialCommand->{$command} ) { |
|
|
push @args, SOAP::Data->name( 'SpecialCommand' => $i ); |
|
|
} elsif ( $i = $Intel::AMT::RemoteControl::OEMParameters->{$command} ) { |
|
|
push @args, SOAP::Data->name( 'OEMParameters' => $i ); |
|
|
} else { |
|
|
die "can't find $command"; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if ( $BootOptions ) { |
|
|
warn "invalid BootOptions $BootOptions" unless |
|
|
( $BootOptions & $Intel::AMT::RemoteControl::BootOptionsReservedBits ); |
|
|
push @args, SOAP::Data->name( 'BootOptions' => $BootOptions ); |
|
|
} |
|
|
|
|
|
if ( $SpecialCommandParameter ) { |
|
|
warn "invalid SpecialCommandParameter $SpecialCommandParameter" unless |
|
|
( $SpecialCommandParameter & $Intel::AMT::RemoteControl::SpecialCommandParametersReservedBits ); |
|
|
push @args, SOAP::Data->name( 'SpecialCommandParameter' => $SpecialCommandParameter ); |
|
|
} |
|
|
|
|
|
push @args, SOAP::Data->name( 'IanaOemNumber' => $Intel::AMT::RemoteControl::IanaNumbers->{IntelIanaNumber} ); |
|
|
warn "args ",dump( @args ); |
|
|
|
|
|
do_soap($rcs, "RemoteControl", @args); |
|
|
} |
|
|
|
|
248 |
sub print_network_info() { |
sub print_network_info() { |
249 |
my $ret; |
my $ret; |
250 |
|
|
331 |
|
|
332 |
if ($amt_command eq "info") { |
if ($amt_command eq "info") { |
333 |
print_general_info; |
print_general_info; |
|
RemoteControlCapabilities; |
|
334 |
} elsif ($amt_command eq "netinfo") { |
} elsif ($amt_command eq "netinfo") { |
335 |
check_amt_version(2,5); |
check_amt_version(2,5); |
336 |
print_network_info; |
print_network_info; |
347 |
|
|
348 |
warn 'loaded'; |
warn 'loaded'; |
349 |
|
|
|
warn 'init ', init; |
|
|
|
|
350 |
1; |
1; |