]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
add IP address to network map
authorJan Michel <j.michel@gsi.de>
Tue, 25 Aug 2020 17:51:20 +0000 (19:51 +0200)
committerJan Michel <j.michel@gsi.de>
Tue, 25 Aug 2020 17:51:20 +0000 (19:51 +0200)
web/htdocs/network/map.pl

index b3d363cb5993cb2f30a57379724bcddbe0a769b2..f85c96127ab8012a090ab1bde4b5d3f264dc4046 100755 (executable)
@@ -82,7 +82,7 @@ if($ENV{'QUERY_STRING'} =~ /getmap/) {
   <th>Compile Time
   <th>Temperature
   <th>UID - Endp
-  <th title=\"overlay: GbE data %\">MAC
+  <th title=\"overlay: GbE data %\">MAC/IP
   <th title=\"overlay: deadtime %\">serial\n";
   
   printlist(0,1);
@@ -254,7 +254,7 @@ if($ENV{'QUERY_STRING'} =~ /getmap/) {
       my $mac = '';
       my $gbelevel = '';
       if ($feat =~ /GbE/) {
-        $mac = GetMac($uids->{$addr},$btype);
+        $mac = GetMac($uids->{$addr},$btype,$addr);
         my $gbeval = $gbebusy2->{$addr}-$gbebusy1->{$addr};
         $gbeval /= 9E4;
         $gbeval = ceil(min($gbeval,100));
@@ -375,11 +375,21 @@ sub GetSerial {
 sub GetMac {
   my $id = shift @_;
   my $btype = shift @_;
-  $id = sprintf('%08x',$id);
-  my $r = 'da:7a:3'.substr($id,7,1).':'.substr($id,8,2).':'.substr($id,10,2).':'.substr($id,12,2);
-  if ($btype =~ /TRB3sc/i) {
-     $r = 'da:7a:0'.substr($id,7,1).':'.substr($id,8,2).':'.substr($id,10,2).':'.substr($id,12,2);
-     }
+  my $addr = shift @_;
+  my $d1 = trb_register_read($addr,0x83c0);
+  my $d2 = trb_register_read($addr,0x83c3);
+  my $r;
+  if ($d1->{$addr} || $d2->{$addr}) {
+    my $ip = $d1->{$addr} || $d2->{$addr};
+    $r = sprintf('%u.%u.%u.%u',$ip&0xFF,$ip>>8&0xFF,$ip>>16&0xFF,$ip>>24&0xFF);
+    }
+  else {
+    $id = sprintf('%08x',$id);
+    $r = 'da:7a:3'.substr($id,7,1).':'.substr($id,8,2).':'.substr($id,10,2).':'.substr($id,12,2);
+    if ($btype =~ /TRB3sc/i) {
+      $r = 'da:7a:0'.substr($id,7,1).':'.substr($id,8,2).':'.substr($id,10,2).':'.substr($id,12,2);
+      }
+    }
   return $r;
   }