my $duplex = $anvil->Storage->read_file({file => $full_path."/duplex"}); # full or half?
my $duplex = -e $full_path."/duplex" ? $anvil->Storage->read_file({file => $full_path."/duplex"}) : "unknown"; # full or half?
my $operational = $anvil->Storage->read_file({file => $full_path."/operstate"}); # up or down
my $operational = -e $full_path."/operstate" ? $anvil->Storage->read_file({file => $full_path."/operstate"}) : "unknown"; # up or down
my $speed = $link_state ? $anvil->Storage->read_file({file => $full_path."/speed"}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
my $speed = $link_state ? $anvil->Storage->read_file({file => $full_path."/speed"}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
if ($speed > 100000)
if ($speed > 100000)
{
{
@ -70,18 +70,22 @@ sub report_network
# Find the media, if possible.
# Find the media, if possible.
my $media = "unknown";
my $media = "unknown";
my $ethtool = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{ethtool}});
my $shell_call = $anvil->data->{path}{exe}{ethtool}." $interface";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { shell_call => $shell_call }});
my $ethtool = $anvil->System->call({shell_call => $shell_call});
foreach my $line (split/\n/, $ethtool)
foreach my $line (split/\n/, $ethtool)
{
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }});
if ($line =~ /Supported ports: \[ (.*?) \]/i)
if ($line =~ /Supported ports: \[ (.*?) \]/i)
{
{
$media = lc($1);
$media = lc($1);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { media => $media }});
last;
last;
}
}
}
}
# Log
# Log
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {