From 24cc9360dae1ae5340a695bcda3a1abbf548fa36 Mon Sep 17 00:00:00 2001
From: dpgilbert <dpgilbert@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Fri, 30 Apr 2004 06:17:52 +0000
Subject: [PATCH] move device temperature and start-stop log page into
 --attributes section (was in --info). More like ATA devices.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1695 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/scsiprint.c   | 55 ++++++++++++++++++++++++++---------------------
 sm5/scsiprint.cpp | 55 ++++++++++++++++++++++++++---------------------
 2 files changed, 62 insertions(+), 48 deletions(-)

diff --git a/sm5/scsiprint.c b/sm5/scsiprint.c
index fe6e6fa21..8edea21a8 100644
--- a/sm5/scsiprint.c
+++ b/sm5/scsiprint.c
@@ -41,7 +41,7 @@
 
 #define GBUF_SIZE 65535
 
-const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.77 2004/03/23 13:08:40 ballen4705 Exp $"
+const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.78 2004/04/30 06:17:52 dpgilbert Exp $"
 CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // control block which points to external global control variables
@@ -115,7 +115,7 @@ static void scsiGetSupportedLogPages(int device)
     }
 }
 
-void scsiGetSmartData(int device)
+void scsiGetSmartData(int device, int attribs)
 {
     UINT8 asc;
     UINT8 ascq;
@@ -140,14 +140,18 @@ void scsiGetSmartData(int device)
     } else if (gIecMPage)
         pout("SMART Health Status: OK\n");
 
-    if (currenttemp && !gTempLPage) {
-        if (255 != currenttemp)
-            pout("Current Drive Temperature:     %d C\n", currenttemp);
-        else
-            pout("Current Drive Temperature:     <not available>\n");
+    if (attribs && !gTempLPage) {
+        if (currenttemp || triptemp)
+            pout("\n");
+        if (currenttemp) {
+            if (255 != currenttemp)
+                pout("Current Drive Temperature:     %d C\n", currenttemp);
+            else
+                pout("Current Drive Temperature:     <not available>\n");
+        }
+        if (triptemp)
+            pout("Drive Trip Temperature:        %d C\n", triptemp);
     }
-    if (triptemp && !gTempLPage)
-        pout("Drive Trip Temperature:        %d C\n", triptemp);
 }
 
 
@@ -277,7 +281,7 @@ static void scsiPrintSeagateCacheLPage(int device)
         default: 
             if (con->reportscsiioctl > 0) {
                 PRINT_ON(con);
-                pout("\nVendor (Seagate) cache lpage has unexpected parameter"
+                pout("Vendor (Seagate) cache lpage has unexpected parameter"
                      ", skip\n");
                 PRINT_OFF(con);
             }
@@ -286,7 +290,7 @@ static void scsiPrintSeagateCacheLPage(int device)
         num -= pl;
         ucp += pl;
     }
-    pout("\nVendor (Seagate) cache information\n");
+    pout("Vendor (Seagate) cache information\n");
     num = len - 4;
     ucp = &gBuf[0] + 4;
     while (num > 3) {
@@ -908,23 +912,26 @@ int scsiPrintMain(int fd)
             }
             else
                 pout("TapeAlert Not Supported\n");
-            if (gTempLPage)
-                scsiPrintTemp(fd);         
-            if (gStartStopLPage)
-                scsiGetStartStopData(fd);
         } else { /* disk, cd/dvd, enclosure, etc */
-            scsiGetSmartData(fd);
-            if (gTempLPage)
-                scsiPrintTemp(fd);         
-            if (gStartStopLPage)
-                scsiGetStartStopData(fd);
+            scsiGetSmartData(fd, con->smartvendorattrib);
         }
     }   
     if (con->smartvendorattrib) {
-        if (gSeagateCacheLPage && (SCSI_PT_DIRECT_ACCESS == peripheral_type))
-            scsiPrintSeagateCacheLPage(fd);
-        if (gSeagateFactoryLPage && (SCSI_PT_DIRECT_ACCESS == peripheral_type))
-            scsiPrintSeagateFactoryLPage(fd);
+        if (! checkedSupportedLogPages)
+            scsiGetSupportedLogPages(fd);
+        if (gTempLPage) {
+            if (con->checksmart)
+                pout("\n");
+            scsiPrintTemp(fd);         
+        }
+        if (gStartStopLPage)
+            scsiGetStartStopData(fd);
+        if (SCSI_PT_DIRECT_ACCESS == peripheral_type) {
+            if (gSeagateCacheLPage)
+                scsiPrintSeagateCacheLPage(fd);
+            if (gSeagateFactoryLPage)
+                scsiPrintSeagateFactoryLPage(fd);
+        }
     }
     if (con->smarterrorlog) {
         scsiPrintErrorCounterLog(fd);
diff --git a/sm5/scsiprint.cpp b/sm5/scsiprint.cpp
index d714eb56d..a0f6c0e52 100644
--- a/sm5/scsiprint.cpp
+++ b/sm5/scsiprint.cpp
@@ -41,7 +41,7 @@
 
 #define GBUF_SIZE 65535
 
-const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.77 2004/03/23 13:08:40 ballen4705 Exp $"
+const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.78 2004/04/30 06:17:52 dpgilbert Exp $"
 CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // control block which points to external global control variables
@@ -115,7 +115,7 @@ static void scsiGetSupportedLogPages(int device)
     }
 }
 
-void scsiGetSmartData(int device)
+void scsiGetSmartData(int device, int attribs)
 {
     UINT8 asc;
     UINT8 ascq;
@@ -140,14 +140,18 @@ void scsiGetSmartData(int device)
     } else if (gIecMPage)
         pout("SMART Health Status: OK\n");
 
-    if (currenttemp && !gTempLPage) {
-        if (255 != currenttemp)
-            pout("Current Drive Temperature:     %d C\n", currenttemp);
-        else
-            pout("Current Drive Temperature:     <not available>\n");
+    if (attribs && !gTempLPage) {
+        if (currenttemp || triptemp)
+            pout("\n");
+        if (currenttemp) {
+            if (255 != currenttemp)
+                pout("Current Drive Temperature:     %d C\n", currenttemp);
+            else
+                pout("Current Drive Temperature:     <not available>\n");
+        }
+        if (triptemp)
+            pout("Drive Trip Temperature:        %d C\n", triptemp);
     }
-    if (triptemp && !gTempLPage)
-        pout("Drive Trip Temperature:        %d C\n", triptemp);
 }
 
 
@@ -277,7 +281,7 @@ static void scsiPrintSeagateCacheLPage(int device)
         default: 
             if (con->reportscsiioctl > 0) {
                 PRINT_ON(con);
-                pout("\nVendor (Seagate) cache lpage has unexpected parameter"
+                pout("Vendor (Seagate) cache lpage has unexpected parameter"
                      ", skip\n");
                 PRINT_OFF(con);
             }
@@ -286,7 +290,7 @@ static void scsiPrintSeagateCacheLPage(int device)
         num -= pl;
         ucp += pl;
     }
-    pout("\nVendor (Seagate) cache information\n");
+    pout("Vendor (Seagate) cache information\n");
     num = len - 4;
     ucp = &gBuf[0] + 4;
     while (num > 3) {
@@ -908,23 +912,26 @@ int scsiPrintMain(int fd)
             }
             else
                 pout("TapeAlert Not Supported\n");
-            if (gTempLPage)
-                scsiPrintTemp(fd);         
-            if (gStartStopLPage)
-                scsiGetStartStopData(fd);
         } else { /* disk, cd/dvd, enclosure, etc */
-            scsiGetSmartData(fd);
-            if (gTempLPage)
-                scsiPrintTemp(fd);         
-            if (gStartStopLPage)
-                scsiGetStartStopData(fd);
+            scsiGetSmartData(fd, con->smartvendorattrib);
         }
     }   
     if (con->smartvendorattrib) {
-        if (gSeagateCacheLPage && (SCSI_PT_DIRECT_ACCESS == peripheral_type))
-            scsiPrintSeagateCacheLPage(fd);
-        if (gSeagateFactoryLPage && (SCSI_PT_DIRECT_ACCESS == peripheral_type))
-            scsiPrintSeagateFactoryLPage(fd);
+        if (! checkedSupportedLogPages)
+            scsiGetSupportedLogPages(fd);
+        if (gTempLPage) {
+            if (con->checksmart)
+                pout("\n");
+            scsiPrintTemp(fd);         
+        }
+        if (gStartStopLPage)
+            scsiGetStartStopData(fd);
+        if (SCSI_PT_DIRECT_ACCESS == peripheral_type) {
+            if (gSeagateCacheLPage)
+                scsiPrintSeagateCacheLPage(fd);
+            if (gSeagateFactoryLPage)
+                scsiPrintSeagateFactoryLPage(fd);
+        }
     }
     if (con->smarterrorlog) {
         scsiPrintErrorCounterLog(fd);
-- 
GitLab