phytronFilterIpPoerLog.pl: Translate status to readable string

Wed, 23 Feb 2022 16:47:37 +0100

author
Bernhard.Kuner@bessy.de
date
Wed, 23 Feb 2022 16:47:37 +0100
changeset 2437
edf7037215c1
parent 2436
714726513a7d
child 2438
2a8fd0711e15

phytronFilterIpPoerLog.pl: Translate status to readable string
Ignore-this: 218573778c5997c4f7994e6968f2d223d5c4513f8da01be44bb3059c197dc1969c725a3821c53933

bin/phytronFilterIpPortLog.pl file | annotate | diff | comparison | revisions
--- a/bin/phytronFilterIpPortLog.pl	Wed Feb 23 14:53:34 2022 +0100
+++ b/bin/phytronFilterIpPortLog.pl	Wed Feb 23 16:47:37 2022 +0100
@@ -12,7 +12,6 @@
 # 0M1.1P22R:XX
 # 2022/02/22 16:05:47.975 mou1s05l.blc05.bessy.de:22222 read 7
 # 0:0C
-
     use strict;
     use Getopt::Long;
 
@@ -78,6 +77,7 @@
             $lineNr++;
             if($line=~/(.*):../) {
                 $reply = $1;
+                $reply = getStatus($reply) if($command=~/M\d+\.\dSE/)
             }
             else {
                 chomp($line);
@@ -91,3 +91,28 @@
         }
     }
     close IN_FILE;
+
+sub getStatus 
+{   my ($reply) = @_;
+    my $hex  = sprintf("%X",$reply);
+    my $msg;
+
+    $msg .= " busy" if(($hex & 1));
+    $msg .= " Illegal" if(($hex & 2));
+    $msg .= " WaitSync" if(($hex & 4));
+    $msg .= " isInit" if(($hex & 0x8));
+    $msg .= " LS+" if(($hex & 0x10));
+    $msg .= " LS-" if(($hex & 0x20));
+    $msg .= " LSM" if(($hex & 0x40));
+    $msg .= " SwLS+" if(($hex & 80));
+    $msg .= " SwLS-" if(($hex & 100));
+    $msg .= " SwLS-" if(($hex & 100));
+    $msg .= " ready" if(($hex & 0x200));
+
+    $msg .= " LS_Err" if(($hex & 0x1000));
+    $msg .= " PwrStg_Err" if(($hex & 0x20000));
+
+    $msg .= " RUN" if(($hex & 0x10000));
+    $msg .= " DONE" if(($hex & 0x80000));
+    return "$reply, 0x$hex STAT:$msg";    
+}

mercurial