From 215bd604ec978a8209982a71f1f0103b386ab7cf Mon Sep 17 00:00:00 2001 From: dpgilbert <dpgilbert@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Tue, 18 Nov 2003 13:49:43 +0000 Subject: [PATCH] a little fine tuning when IE mode page not available/corrupted git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1253 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/smartd.c | 14 +++++++++----- sm5/smartd.cpp | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/sm5/smartd.c b/sm5/smartd.c index f986eb518..b9bd4e076 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -65,7 +65,7 @@ extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid; -const char *smartd_c_cvsid="$Id: smartd.c,v 1.241 2003/11/17 11:50:44 dpgilbert Exp $" +const char *smartd_c_cvsid="$Id: smartd.c,v 1.242 2003/11/18 13:49:43 dpgilbert Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; @@ -1015,14 +1015,18 @@ static int SCSIDeviceScan(cfgfile *cfg) { // that various USB devices that malform the response will lock up // if asked for a log page (e.g. temperature) so it is best to // bail out now. - if ((err = scsiFetchIECmpage(fd, &iec, cfg->modese_len))) { + err = scsiFetchIECmpage(fd, &iec, cfg->modese_len); + if (0 == err) + cfg->modese_len = iec.modese_len; + else if (SIMPLE_ERR_BAD_FIELD == err) + ; /* continue since it is reasonable not to support IE mpage */ + else { /* any other error (including malformed response) unreasonable */ PrintOut(LOG_INFO, - "Device: %s, Fetch of IEC (SMART) mode page failed, err=%d, skip device\n", device, err); + "Device: %s, Bad IEC (SMART) mode page, err=%d, skip device\n", + device, err); CloseDevice(fd, device); return 3; } - else - cfg->modese_len = iec.modese_len; // N.B. The following is passive (i.e. it doesn't attempt to turn on // smart if it is off). This may change to be the same as the ATA side. diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 0c9b7696b..bb19ea9d0 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -65,7 +65,7 @@ extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid; -const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.241 2003/11/17 11:50:44 dpgilbert Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.242 2003/11/18 13:49:43 dpgilbert Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; @@ -1015,14 +1015,18 @@ static int SCSIDeviceScan(cfgfile *cfg) { // that various USB devices that malform the response will lock up // if asked for a log page (e.g. temperature) so it is best to // bail out now. - if ((err = scsiFetchIECmpage(fd, &iec, cfg->modese_len))) { + err = scsiFetchIECmpage(fd, &iec, cfg->modese_len); + if (0 == err) + cfg->modese_len = iec.modese_len; + else if (SIMPLE_ERR_BAD_FIELD == err) + ; /* continue since it is reasonable not to support IE mpage */ + else { /* any other error (including malformed response) unreasonable */ PrintOut(LOG_INFO, - "Device: %s, Fetch of IEC (SMART) mode page failed, err=%d, skip device\n", device, err); + "Device: %s, Bad IEC (SMART) mode page, err=%d, skip device\n", + device, err); CloseDevice(fd, device); return 3; } - else - cfg->modese_len = iec.modese_len; // N.B. The following is passive (i.e. it doesn't attempt to turn on // smart if it is off). This may change to be the same as the ATA side. -- GitLab