From d92be8d4d6e786f743745a3b50cf75cd1bd68a63 Mon Sep 17 00:00:00 2001
From: samm2 <samm2@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Mon, 12 Oct 2009 12:17:32 +0000
Subject: [PATCH] os_linux.cpp - hiding more debug messages from megaraid code,
 add correct comments for the smart response emulation

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2957 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/os_linux.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index 5a9d123e2..821bf0f29 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -902,6 +902,8 @@ linux_megaraid_device::~linux_megaraid_device() throw()
 
 smart_device * linux_megaraid_device::autodetect_open()
 {
+  int report = con->reportscsiioctl; 
+
   // Open device
   if (!open())
     return this;
@@ -924,7 +926,8 @@ smart_device * linux_megaraid_device::autodetect_open()
   if (len < 36)
       return this;
 
-  printf("Got MegaRAID inquiry.. %s\n", req_buff+8);
+  if (report)
+    printf("Got MegaRAID inquiry.. %s\n", req_buff+8);
 
   // Use INQUIRY to detect type
   smart_device * newdev = 0;
@@ -1051,12 +1054,12 @@ bool linux_megaraid_device::scsi_pass_through(scsi_cmnd_io *iop)
     // Emulate SMART STATUS CHECK drive reply
     // smartctl fail to work without this
     if(iop->cmnd[2]==0x2c) {
-      iop->resp_sense_len=22;
-      iop->sensep[0]=0x72; // response code
-      iop->sensep[7]=0x0e; // no idea what it is, copied from sat device answer
-      iop->sensep[8]=0x09; // 
-      iop->sensep[17]=0x4f; // lm
-      iop->sensep[19]=0xc2; // lh
+      iop->resp_sense_len=22; // copied from real response
+      iop->sensep[0]=0x72; // descriptor format
+      iop->sensep[7]=0x0e; // additional length
+      iop->sensep[8]=0x09; // description pointer
+      iop->sensep[17]=0x4f; // low cylinder GOOD smart status
+      iop->sensep[19]=0xc2; // high cylinder GOOD smart status
     }
     return true;
   }
-- 
GitLab