From e7aeb341143cec32112475bc77708d4b47e09d73 Mon Sep 17 00:00:00 2001
From: Sergey Ivanov <seriv@cs.umd.edu>
Date: Tue, 19 Nov 2019 15:09:20 -0500
Subject: [PATCH] often verify is not reported but write and read are there.
 Assume 0 in this case

---
 lib/Core/SMART.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/Core/SMART.pm b/lib/Core/SMART.pm
index 7252dda..3e746f1 100644
--- a/lib/Core/SMART.pm
+++ b/lib/Core/SMART.pm
@@ -120,11 +120,18 @@ sub handler {
         elsif ($line =~ /^Elements in grown defect list:\s+(.+)$/) {
             $smartdata->{"elements_in_defect_list"} = [$1, "i"];
         }
-        elsif ($line =~ /^(read|write|verify):\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\d+)$/) {
+        elsif ($line =~ /^(verify):\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\d+)$/) {
             print STDERR "$1 $1_errors_corrected $5 $1_errors_uncorrected $8\n";
             $smartdata->{"$1_errors_corrected"} = [$5, "i"];
             $smartdata->{"$1_errors_uncorrected"} = [$8, "i"];
         }
+        elsif ($line =~ /^(read|write):\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\d+)$/) {
+            print STDERR "$1 $1_errors_corrected $5 $1_errors_uncorrected $8\n";
+            $smartdata->{"$1_errors_corrected"} = [$5, "i"];
+            $smartdata->{"$1_errors_uncorrected"} = [$8, "i"];
+            $smartdata->{"verify_errors_corrected"} =   [0, "i"] unless defined($smartdata->{"verify_errors_corrected"});
+            $smartdata->{"verify_errors_uncorrected"} = [0, "i"] unless defined($smartdata->{"verify_errors_uncorrected"});
+        }
         elsif ($line =~ /^Non-medium error count:\s+(.+)$/) {
             $smartdata->{"non_medium_errors"} = [$1, "i"];
         }
-- 
GitLab