diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index c9c759af480e64aa563ce241deb2ef4bf912b5bc..8f3699c7a8cb767ceb7e4ed168d6d164e7e9023e 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.9 2002/10/20 19:40:23 ballen4705 Exp $ +$Id: CHANGELOG,v 1.10 2002/10/21 08:49:23 ballen4705 Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -29,6 +29,8 @@ NOTES FOR NEXT RELEASE: smartmontools-5.0-11 + device opened only in read-only not read-write mode. Don't need R/W + access to get smart data. smartctl now handles all possible choices of "multiple options" gracefully. It goes through the following phases of operation, @@ -37,6 +39,10 @@ smartmontools-5.0-11 operation. Control flow through ataPrintMain() simplified. + If reading device identity information fails, try seeing if the info + can be accessed using a "DEVICE PACKET" command. This way we can + at least get device info. + Modified Makefile to automatically tag CVS archive on issuance of a release diff --git a/sm5/atacmds.c b/sm5/atacmds.c index 510cece4d7af6f84158c43320691381d3c0b6b12..75e030550425405e8778e091547473190814104b 100644 --- a/sm5/atacmds.c +++ b/sm5/atacmds.c @@ -1,4 +1,4 @@ -// $Id: atacmds.c,v 1.10 2002/10/20 19:40:23 ballen4705 Exp $ +// $Id: atacmds.c,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $ /* * atacmds.c * @@ -128,7 +128,7 @@ void checksumwarning(const char *string){ int ataReadHDIdentity ( int device, struct hd_driveid *buf){ if (ioctl(device, HDIO_GET_IDENTITY, buf)){ perror ("ATA GET HD Failed"); - return -1; + return -1; } return 0; } @@ -138,13 +138,15 @@ int ataReadHDIdentity ( int device, struct hd_driveid *buf){ // Reads current Device Identity info (512 bytes) into buf int ataReadHDIdentity (int device, struct hd_driveid *buf){ unsigned char parms[HDIO_DRIVE_CMD_HDR_SIZE+sizeof(*buf)]= - {WIN_IDENTIFY, 0, 0, 1,}; - + {WIN_IDENTIFY, 0, 0, 1,}; + if (ioctl(device ,HDIO_DRIVE_CMD,parms)){ - perror ("ATA GET HD Identity Failed"); - return -1; + parms[0]=WIN_PIDENTIFY; + if (ioctl(device ,HDIO_DRIVE_CMD,parms)){ + perror ("ATA GET HD Identity Failed"); + return -1; + } } - // copy data into driveid structure memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf)); diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index 088f2c0332395de90095a67ea95d37d26b31195a..58ed944fa416154d03ab95ac6317757bc7a5708d 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -1,4 +1,4 @@ -// $Id: atacmds.cpp,v 1.10 2002/10/20 19:40:23 ballen4705 Exp $ +// $Id: atacmds.cpp,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $ /* * atacmds.c * @@ -128,7 +128,7 @@ void checksumwarning(const char *string){ int ataReadHDIdentity ( int device, struct hd_driveid *buf){ if (ioctl(device, HDIO_GET_IDENTITY, buf)){ perror ("ATA GET HD Failed"); - return -1; + return -1; } return 0; } @@ -138,13 +138,15 @@ int ataReadHDIdentity ( int device, struct hd_driveid *buf){ // Reads current Device Identity info (512 bytes) into buf int ataReadHDIdentity (int device, struct hd_driveid *buf){ unsigned char parms[HDIO_DRIVE_CMD_HDR_SIZE+sizeof(*buf)]= - {WIN_IDENTIFY, 0, 0, 1,}; - + {WIN_IDENTIFY, 0, 0, 1,}; + if (ioctl(device ,HDIO_DRIVE_CMD,parms)){ - perror ("ATA GET HD Identity Failed"); - return -1; + parms[0]=WIN_PIDENTIFY; + if (ioctl(device ,HDIO_DRIVE_CMD,parms)){ + perror ("ATA GET HD Identity Failed"); + return -1; + } } - // copy data into driveid structure memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf)); diff --git a/sm5/smartctl.c b/sm5/smartctl.c index c4995adc39cf061ab315cf167947f95a74ca5f10..5f94abe9e075e0ab34e96f201d3652dfff61edb4 100644 --- a/sm5/smartctl.c +++ b/sm5/smartctl.c @@ -1,4 +1,4 @@ -// $Id: smartctl.c,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $ +// $Id: smartctl.c,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $ /* * smartctl.c * @@ -229,7 +229,7 @@ int main (int argc, char **argv){ printf("is free software, and you are welcome to redistribute it\n"); printf("under the terms of the GNU General Public License Version 2.\n"); printf("See http://www.gnu.org for further details.\n\n"); - printf("CVS version ID %s\n","$Id: smartctl.c,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $"); + printf("CVS version ID %s\n","$Id: smartctl.c,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $"); if (argc==2) exit(0); } @@ -240,8 +240,8 @@ int main (int argc, char **argv){ exit (-1); } - /* open device */ - fd = open ( device=argv[2], O_RDWR ); + // open device - read-only mode is enough to issue needed commands + fd = open ( device=argv[2], O_RDONLY ); if ( fd < 0) { perror ( "Device open failed"); diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp index 1a5bf755d71194154e3a944bcc9d4e5f6f087f58..407eb7a8feb648ff67c2b22f9ebb1430b34b6a18 100644 --- a/sm5/smartctl.cpp +++ b/sm5/smartctl.cpp @@ -1,4 +1,4 @@ -// $Id: smartctl.cpp,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $ +// $Id: smartctl.cpp,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $ /* * smartctl.c * @@ -229,7 +229,7 @@ int main (int argc, char **argv){ printf("is free software, and you are welcome to redistribute it\n"); printf("under the terms of the GNU General Public License Version 2.\n"); printf("See http://www.gnu.org for further details.\n\n"); - printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $"); + printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $"); if (argc==2) exit(0); } @@ -240,8 +240,8 @@ int main (int argc, char **argv){ exit (-1); } - /* open device */ - fd = open ( device=argv[2], O_RDWR ); + // open device - read-only mode is enough to issue needed commands + fd = open ( device=argv[2], O_RDONLY ); if ( fd < 0) { perror ( "Device open failed");