script/lsec
changeset 835 23fd8b510803
parent 766 97e98cbd0cd2
--- a/script/lsec	Wed Feb 27 15:24:00 2008 +0000
+++ b/script/lsec	Thu Feb 28 10:58:43 2008 +0000
@@ -83,6 +83,7 @@
         next unless $entry =~ /^slave(\d+)$/;
 
         $slave = {};
+        $slave->{'current'} = 0;
         $slave_info_file = "$master_dir/$entry/info"; 
         open INFO, $slave_info_file or die
             "ERROR: Failed to open $slave_info_file.";
@@ -103,8 +104,6 @@
                     $slave->{'state'} = $1;
                 } elsif ($line =~ /^Configured station alias: .* \((\d+)\)$/) {
                     $slave->{'alias'} = $1;
-                } elsif ($line =~ /^Current consumption: (-?\d+) mA$/) {
-                    $slave->{'current'} = $1;
                 }
             } elsif ($category eq "Identity") {
                 if ($line =~ /Vendor ID: .* \((\d+)\)$/) {
@@ -115,6 +114,8 @@
             } elsif ($category eq "General") {
                 if ($line =~ /Name: (.*)$/) {
                     $slave->{'name'} = $1;
+                } elsif ($line =~ /Current consumption: (-?\d+) mA$/) {
+                    $slave->{'current'} = $1;
                 }
             }
         }