Hello community, here is the log from the commit of package hdparm checked in at Sat Oct 28 16:56:28 CEST 2006. -------- --- hdparm/hdparm.changes 2006-06-12 02:06:17.000000000 +0200 +++ /mounts/work_src_done/STABLE/hdparm/hdparm.changes 2006-10-28 15:54:54.000000000 +0200 @@ -1,0 +2,18 @@ +Sat Oct 28 15:53:07 CEST 2006 - aj@suse.de + +- Update to version 6.9, changes since 6.6 are: + * added -s flag to control power-up in standby + * make --Istdin more robust + * added -I recognition of SMART Command Transport (SCT) + * fix X2 over-reporting of -T results + * add udma 3/4/5 modes to the -i results + * improve parsing/operation of --Istdin function + * don't default to "-v" when only new "--" longopts are used. + * calculate integrity word if not correct + * remove used code/parameter from identify() + * fix "(null)" strings from the "Drive conforms to" line of -I + * tidied up usage of prefix vars in Makefile + * fix bug in -C implementation + * new -H flag for (Hitachi) drive temperature + +------------------------------------------------------------------- Old: ---- hdparm-6.6.tar.bz2 New: ---- hdparm-6.9.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hdparm.spec ++++++ --- /var/tmp/diff_new_pack.EqYSyM/_old 2006-10-28 16:55:29.000000000 +0200 +++ /var/tmp/diff_new_pack.EqYSyM/_new 2006-10-28 16:55:29.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package hdparm (Version 6.6) +# spec file for package hdparm (Version 6.9) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,12 +11,12 @@ # norootforbuild Name: hdparm -License: FSR +License: Freely Redistributable Software (FSR) Group: Hardware/Other PreReq: %insserv_prereq %fillup_prereq coreutils Provides: base:/sbin/hdparm Autoreqprov: on -Version: 6.6 +Version: 6.9 Release: 1 Summary: A Program to Get and Set Hard Disk Parameters Source: hdparm-%{version}.tar.bz2 @@ -102,11 +102,26 @@ /var/adm/fillup-templates/sysconfig.ide %changelog -n hdparm +* Sat Oct 28 2006 - aj@suse.de +- Update to version 6.9, changes since 6.6 are: + * added -s flag to control power-up in standby + * make --Istdin more robust + * added -I recognition of SMART Command Transport (SCT) + * fix X2 over-reporting of -T results + * add udma 3/4/5 modes to the -i results + * improve parsing/operation of --Istdin function + * don't default to "-v" when only new "--" longopts are used. + * calculate integrity word if not correct + * remove used code/parameter from identify() + * fix "(null)" strings from the "Drive conforms to" line of -I + * tidied up usage of prefix vars in Makefile + * fix bug in -C implementation + * new -H flag for (Hitachi) drive temperature * Mon Jun 12 2006 - ro@suse.de - update to version 6.6 -- manpage updates / corrections. -- fixed bug in -C code. -- major updates to bring -I information up to current specs. + - manpage updates / corrections. + - fixed bug in -C code. + - major updates to bring -I information up to current specs. * Mon May 22 2006 - schwab@suse.de - Don't strip binaries. * Wed Jan 25 2006 - mls@suse.de ++++++ hdparm-6.6.tar.bz2 -> hdparm-6.9.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/Changelog new/hdparm-6.9/Changelog --- old/hdparm-6.6/Changelog 2006-03-08 04:16:19.000000000 +0100 +++ new/hdparm-6.9/Changelog 2006-10-25 16:43:18.000000000 +0200 @@ -1,3 +1,21 @@ +hdparm-6.9 + - added -s flag to control power-up in standby + (thanks to chrfranke) + - make --Istdin more robust + - added -I recognition of SMART Command Transport (SCT) + (thanks to chrfranke). + - fix X2 over-reporting of -T results + - add udma 3/4/5 modes to the -i results +hdparm-6.8 + - improve parsing/operation of --Istdin function +hdparm-6.7 + - don't default to "-v" when only new "--" longopts are used. + - calculate integrity word if not correct + - remove used code/parameter from identify() + - fix "(null)" strings from the "Drive conforms to" line of -I + - tidied up usage of prefix vars in Makefile + - fix bug in -C implementation + - new -H flag for (Hitachi) drive temperature hdparm-6.6 - fix build for Redhat/Fedora systems. - disable security commands when building on Redhat/Fedora, diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/Makefile new/hdparm-6.9/Makefile --- old/hdparm-6.6/Makefile 2005-10-29 23:43:23.000000000 +0200 +++ new/hdparm-6.9/Makefile 2006-10-05 17:58:51.000000000 +0200 @@ -3,12 +3,12 @@ # DESTDIR is for non root installs (eg packages, NFS) only! DESTDIR = -binprefix = / -manprefix = /usr/ -exec_prefix = $(binprefix) +binprefix = +manprefix = /usr +exec_prefix = $(binprefix)/ sbindir = $(exec_prefix)sbin -mandir = $(manprefix)share/man -oldmandir = $(manprefix)man +mandir = $(manprefix)/share/man +oldmandir = $(manprefix)/man ifndef CC CC = gcc diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/hdparm.8 new/hdparm-6.9/hdparm.8 --- old/hdparm-6.6/hdparm.8 2006-03-08 04:15:50.000000000 +0100 +++ new/hdparm-6.9/hdparm.8 2006-10-25 16:41:33.000000000 +0200 @@ -1,4 +1,4 @@ -.TH HDPARM 8 "March 2006" "Version 6.6" +.TH HDPARM 8 "October 2006" "Version 6.9" .SH NAME hdparm \- get/set hard disk parameters @@ -17,15 +17,12 @@ is assumed. .TP .I -a -Get/set sector count for filesystem read-ahead. This is used to improve -performance in sequential reads of large files, by prefetching additional +Get/set sector count for filesystem (software) read-ahead. +This is used to improve performance in sequential reads of large files, +by prefetching additional blocks in anticipation of them being needed by the running task. -In the current kernel version (2.0.10) this has a default setting -of 8 sectors (4KB). This value seems good for most purposes, -but in a system where most file accesses are random seeks, -a smaller setting might provide better performance. -Also, many IDE drives also have a separate built-in read-ahead function, -which alleviates the need for a filesystem read-ahead in many situations. +Many IDE drives also have a separate built-in read-ahead function, +which augments this filesystem (software) read-ahead function. .TP .I -A Disable/enable the IDE drive\'s read-lookahead feature (usually ON by default). @@ -302,6 +299,18 @@ .B -U option for more information. .TP +.I -s +Enable/disable the power-on in standby feature, if supported by +the drive. If enabled, the drive is powered-up in the +.B standby +mode to allow the controller to sequence the spin-up of devices. +This feature is usually disabled and the drive is powered-up in the +.B active +mode (see -C above). +Note that a drive may also allow to enable this feature by a jumper. +Some SATA drives support the control of this feature by pin 11 of +the SATA power connector. In these cases, this command may be +unsupported or may have no effect. .I -S Set the standby (spindown) timeout for the drive. This value is used by the drive to determine how long to wait (with no disk activity) @@ -472,6 +481,11 @@ (ST3xxx models?), to prevent them from idling/spinning-down at inconvenient times. .TP +.I -H +Read the temperature from some (mostly Hitachi) drives. +Also reports if the temperature is within operating condition range +(this may not be reliable). Does not cause the drive to spin up if idle. +.TP .SH ATA Security Feature Set .PP These switches are DANGEROUS to experiment with, and might not work with every diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/hdparm.c new/hdparm-6.9/hdparm.c --- old/hdparm-6.6/hdparm.c 2006-03-08 04:15:31.000000000 +0100 +++ new/hdparm-6.9/hdparm.c 2006-10-25 16:41:33.000000000 +0200 @@ -26,7 +26,7 @@ extern const char *minor_str[]; -#define VERSION "v6.6" +#define VERSION "v6.9" #undef DO_FLUSHCACHE /* under construction: force cache flush on -W0 */ @@ -44,7 +44,6 @@ #define TIMING_BUF_MB 2 #define TIMING_BUF_BYTES (TIMING_BUF_MB * 1024 * 1024) -#define BUFCACHE_FACTOR 2 char *progname; static int verbose = 0, get_identity = 0, get_geom = 0, noisy = 1, quiet = 0; @@ -85,6 +84,8 @@ static unsigned long set_seagate = 0, get_seagate = 0; static unsigned long set_standbynow = 0, get_standbynow = 0; static unsigned long set_sleepnow = 0, get_sleepnow = 0; +static unsigned long set_powerup_in_standby = 0, get_powerup_in_standby = 0, powerup_in_standby = 0; +static unsigned long get_hitachi_temp = 0; #ifdef IDE_DRIVE_TASK_NO_DATA static unsigned long set_freeze = 0; @@ -107,7 +108,7 @@ static unsigned long get_powermode = 0; static unsigned long set_apmmode = 0, get_apmmode= 0, apmmode = 0; -#endif +#endif // HDIO_DRIVE_CMD #ifdef CDROM_SELECT_SPEED static unsigned long set_cdromspeed = 0, cdromspeed = 0; #endif /* CDROM_SELECT_SPEED */ @@ -252,6 +253,12 @@ if (id->dma_ultra & 0x002) strcat(umodes,"udma1 "); if (id->dma_ultra & 0x400) strcat(umodes,"*"); if (id->dma_ultra & 0x004) strcat(umodes,"udma2 "); + if (id->dma_ultra & 0x800) strcat(umodes,"*"); + if (id->dma_ultra & 0x008) strcat(umodes,"udma3 "); + if (id->dma_ultra & 0x1000) strcat(umodes,"*"); + if (id->dma_ultra & 0x010) strcat(umodes,"udma4 "); + if (id->dma_ultra & 0x2000) strcat(umodes,"*"); + if (id->dma_ultra & 0x020) strcat(umodes,"udma5 "); #ifdef __NEW_HD_DRIVE_ID if (id->hw_config & 0x2000) { #else /* !__NEW_HD_DRIVE_ID */ @@ -425,14 +432,14 @@ elapsed -= elapsed2; - if ((BUFCACHE_FACTOR * total_MB) >= elapsed) /* more than 1MB/s */ + if (total_MB >= elapsed) /* more than 1MB/s */ printf("%3u MB in %5.2f seconds = %6.2f MB/sec\n", - (BUFCACHE_FACTOR * total_MB), elapsed, - (BUFCACHE_FACTOR * total_MB) / elapsed); + total_MB, elapsed, + total_MB / elapsed); else printf("%3u MB in %5.2f seconds = %6.2f kB/sec\n", - (BUFCACHE_FACTOR * total_MB), elapsed, - (BUFCACHE_FACTOR * total_MB) / elapsed * 1024); + total_MB, elapsed, + total_MB / elapsed * 1024); flush_buffer_cache(fd); sleep(1); @@ -894,6 +901,16 @@ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) perror(" HDIO_DRIVE_CMD(setreadahead) failed"); } + if (set_powerup_in_standby) { + unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; + args[2] = powerup_in_standby ? 0x06 : 0x86; + if (get_powerup_in_standby) { + printf(" setting power-up in standby to %ld", powerup_in_standby); + on_off(powerup_in_standby); + } + if (ioctl(fd, HDIO_DRIVE_CMD, &args)) + perror(" HDIO_DRIVE_CMD(powerup_in_standby) failed"); + } if (set_apmmode) { unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; if (apmmode<1) apmmode=1; @@ -1110,6 +1127,21 @@ if (ioctl(fd, HDIO_DRIVE_CMD, &args)) perror(" HDIO_DRIVE_CMD(setidle1) failed"); } + if (get_hitachi_temp) { + unsigned char args[4] = {0xf0,0,0x01,0}; /* "Sense Condition", vendor-specific */ + if (ioctl(fd, HDIO_DRIVE_CMD, &args)) + perror(" HDIO_DRIVE_CMD(hitachisensecondition) failed"); + else { + printf(" drive temperature (celsius) is: "); + if (args[2]==0) + printf("under -20"); + else if (args[2]==0xFF) + printf("over 107"); + else + printf("%d", args[2]/2-20); + printf("\n drive temperature in range: %s\n", YN(!(args[1]&0x10)) ); + } + } if (!flagcount) verbose = 1; @@ -1237,7 +1269,7 @@ unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0}; const char *state; if (ioctl(fd, HDIO_DRIVE_CMD, &args) - && (args[0] == WIN_CHECKPOWERMODE2) /* try again with 0x98 */ + && (args[0] = WIN_CHECKPOWERMODE2) /* (single =) try again with 0x98 */ && ioctl(fd, HDIO_DRIVE_CMD, &args)) { if (errno != EIO || args[0] != 0 || args[1] != 0) state = "unknown"; @@ -1298,7 +1330,7 @@ for(i = 0; i < 0x100; ++i) { __le16_to_cpus(&id[i]); } - identify((void *)id, NULL); + identify((void *)id); } identify_abort: ; } @@ -1348,6 +1380,7 @@ #endif /* HDIO_SET_ACOUSTIC */ #ifdef HDIO_GET_ACOUSTIC if (get_acoustic) { + // FIXME: use Word94 from IDENTIFY for this value if (ioctl(fd, HDIO_GET_ACOUSTIC, &parm)) { perror(" HDIO_GET_ACOUSTIC failed"); } else { @@ -1404,6 +1437,9 @@ " -f flush buffer cache for device on exit\n" " -g display drive geometry\n" " -h display terse usage information\n" +#ifdef HDIO_DRIVE_CMD + " -H read temperature from drive (Hitachi only)\n" +#endif " -i display drive identification\n" " -I detailed/current information directly from drive\n" " --Istdin read identify data from stdin as ASCII hex\n" @@ -1437,6 +1473,7 @@ " -R register an IDE interface (DANGEROUS)\n" #endif #ifdef HDIO_DRIVE_CMD + " -s set power-up in standby flag (0/1)\n" " -S set standby (spindown) timeout\n" #endif " -t perform device read timings\n" @@ -1542,38 +1579,55 @@ static int fromhex (unsigned char c) { - if (c >= 'a' && c <= 'f') - return 10 + (c - 'a'); if (c >= '0' && c <= '9') return (c - '0'); + if (c >= 'a' && c <= 'f') + return 10 + (c - 'a'); + if (c >= 'A' && c <= 'F') + return 10 + (c - 'A'); fprintf(stderr, "bad char: '%c' 0x%02x\n", c, c); exit(-1); } +static int ishex (char c) +{ + return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); +} + static int identify_from_stdin (void) { - unsigned short sbuf[800]; - unsigned char buf[1600], *b = (unsigned char *)buf; - int i, count; - - // skip leading cruft - while (1 == read(0, buf, 1) && (*buf < '0' || *buf > '9') && (*buf < 'a' || *buf > 'f')) - while (1 == read(0, buf, 1) && *buf != '\n'); - - count = read(0, buf+1, 1279); - if (count != 1279) { - fprintf(stderr, "read(1279 bytes) failed (rc=%d)", count); - perror(""); - exit(errno); - } - for (i = 0; count >= 4; ++i) { - sbuf[i] = (fromhex(b[0]) << 12) | (fromhex(b[1]) << 8) | (fromhex(b[2]) << 4) | fromhex(b[3]); - __le16_to_cpus((__u16 *)(&sbuf[i])); - b += 5; - count -= 5; - } - identify(sbuf, NULL); + unsigned short sbuf[512]; + int err, wc = 0; + + do { + int digit; + char d[4]; + + if (ishex(d[digit=0] = getchar()) + && ishex(d[++digit] = getchar()) + && ishex(d[++digit] = getchar()) + && ishex(d[++digit] = getchar())) { + sbuf[wc] = (fromhex(d[0]) << 12) | (fromhex(d[1]) << 8) | (fromhex(d[2]) << 4) | fromhex(d[3]); + __le16_to_cpus((__u16 *)(&sbuf[wc])); + ++wc; + } else if (d[digit] == EOF) { + goto eof; + } else if (wc == 0) { + /* skip over leading lines of cruft */ + while (d[digit] != '\n') { + if (d[digit] == EOF) + goto eof; + d[digit=0] = getchar(); + }; + } + } while (wc < 256); + putchar('\n'); + identify(sbuf); return 0; +eof: + err = errno; + fprintf(stderr, "read only %u/256 IDENTIFY words from stdin: %s\n", wc, strerror(err)); + exit(err); } int main(int argc, char **argv) @@ -1596,14 +1650,17 @@ if (*p == '-') { if (0 == strcmp(p, "--direct")) { open_flags |= O_DIRECT; + ++flagcount; continue; } if (0 == strcmp(p, "--Istdin")) { identify_from_stdin(); + ++flagcount; continue; } if (0 == strcmp(p, "--Istdout")) { get_IDentity = 2; + ++flagcount; continue; } if (!*++p) @@ -1696,6 +1753,14 @@ GET_NUMBER(set_io32bit,io32bit); break; #ifdef HDIO_DRIVE_CMD + case 's': + get_powerup_in_standby = noisy; + noisy = 1; + GET_NUMBER(set_powerup_in_standby,powerup_in_standby); + if (!set_powerup_in_standby) + fprintf(stderr, "-s: missing value\n"); + break; + case 'S': get_standby = noisy; noisy = 1; @@ -1810,6 +1875,10 @@ noisy = 1; set_seagate = 1; break; + case 'H': + get_hitachi_temp = noisy; + noisy = 1; + break; #endif /* HDIO_DRIVE_CMD */ #ifdef HDIO_GET_KEEPSETTINGS case 'k': diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/hdparm.h new/hdparm-6.9/hdparm.h --- old/hdparm-6.6/hdparm.h 2005-04-10 21:30:40.000000000 +0200 +++ new/hdparm-6.9/hdparm.h 2006-04-28 16:33:01.000000000 +0200 @@ -11,7 +11,7 @@ others, though, were declared in hdparm.c with global scope; since other functions in that file have static (file) scope, I assume the difference is intentional. */ -extern void identify (__u16 *id_supplied, const char *devname); +extern void identify (__u16 *id_supplied); extern void usage_error(int out) __attribute__((noreturn)); extern int main(int argc, char **argv) __attribute__((noreturn)); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/hdparm.lsm new/hdparm-6.9/hdparm.lsm --- old/hdparm-6.6/hdparm.lsm 2006-03-08 04:18:03.000000000 +0100 +++ new/hdparm-6.9/hdparm.lsm 2006-10-25 16:44:03.000000000 +0200 @@ -1,8 +1,11 @@ Begin4 Title: hdparm -Version: 6.6 -Entered-date: 2006-03-07 +Version: 6.9 +Entered-date: 2006-10-25 Description: hdparm - get/set hard disk parameters for Linux IDE drives. + v6.9 --Istdin fix, new -s flag, new SCT reporting, fixed -T x2 error.. + v6.8 improve parsing/operation of --Istdin function + v6.7 misc fixes, new -H flag, fixed -C flag v6.6 fix build on Redhat/Fedora v6.5 fix -I bugs introduced in v6.4 v6.4 major update for -I, bug fix for -C @@ -52,7 +55,7 @@ Maintained-by: mlord@pobox.com (Mark Lord) Primary-site: http://sourceforge.net/projects/hdparm/ Alternate-site: http://www.ibiblio.org/pub/Linux/system/hardware - 46K hdparm-6.6.tar.gz + 47K hdparm-6.9.tar.gz 1K hdparm.lsm Platforms: Linux, kernels 2.2 through 2.6 Copying-policy: BSD License diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hdparm-6.6/identify.c new/hdparm-6.9/identify.c --- old/hdparm-6.6/identify.c 2006-03-01 02:17:28.000000000 +0100 +++ new/hdparm-6.9/identify.c 2006-10-16 19:10:53.000000000 +0200 @@ -99,6 +99,7 @@ #define LENGTH_MEDIA 20 /* 20 words (40 bytes or characters)*/ #define START_MANUF 196 /* media manufacturer I.D. */ #define LENGTH_MANUF 10 /* 10 words (20 bytes or characters) */ +#define SCT_SUPP 206 /* SMART command transport (SCT) support */ #define TRANSPORT_MAJOR 222 /* PATA vs. SATA etc.. */ #define TRANSPORT_MINOR 223 /* minor revision number */ #define INTEGRITY 255 /* integrity word */ @@ -272,11 +273,11 @@ "ATA/ATAPI-6 T13 1410D revision 1", /* 0x001c */ "ATA/ATAPI-7 published, ANSI INCITS 397-2005", /* 0x001d */ "ATA/ATAPI-7 T13 1532D revision 0", /* 0x001e */ - "Reserved" /* 0x001f */ - "Reserved" /* 0x0020 */ + "Reserved", /* 0x001f */ + "Reserved", /* 0x0020 */ "ATA/ATAPI-7 T13 1532D revision 4a", /* 0x0021 */ "ATA/ATAPI-6 published, ANSI INCITS 361-2002", /* 0x0022 */ - "Reserved" /* 0x0023-0xfffe*/ + "Reserved", /* 0x0023-0xfffe*/ }; const char actual_ver[MINOR_MAX+2] = { /* word 81 value: */ @@ -479,6 +480,26 @@ #define PWR_MODE_OFF 0x1000 /* 1=CFA power moded disabled */ #define MAX_AMPS 0x0fff /* value = max current in ma */ +/* word 206: SMART command transport (SCT) */ +static const char *feat_sct_str[16] = { + "unknown 206[15]", /* word 206 bit 15 */ + "unknown 206[14]", /* word 206 bit 14 */ + "unknown 206[13]", /* word 206 bit 13 */ + "unknown 206[12]", /* word 206 bit 12 */ + "unknown 206[11]", /* word 206 bit 11 */ + "unknown 206[10]", /* word 206 bit 10 */ + "unknown 206[9]", /* word 206 bit 9 */ + "unknown 206[8]", /* word 206 bit 8 */ + "unknown 206[7]", /* word 206 bit 7 */ + "unknown 206[6]", /* word 206 bit 6 */ + "SCT Data Tables (AC5)", /* word 206 bit 5 */ + "SCT Features Control (AC4)", /* word 206 bit 4 */ + "SCT Error Recovery Control (AC3)", /* word 206 bit 3 */ + "SCT LBA Segment Access (AC2)", /* word 206 bit 2 */ + "SCT Long Sector Access (AC1)", /* word 206 bit 1 */ + "SMART Command Transport (SCT) feature set" /* word 206 bit 0 */ +}; + /* word 255: integrity */ #define SIG 0x00ff /* signature location */ #define SIG_VAL 0x00A5 /* signature value */ @@ -559,11 +580,9 @@ } /* our main() routine: */ -void identify (__u16 *id_supplied, const char *devname) +void identify (__u16 *id_supplied) { - char *id_file = NULL, fmt[]="/proc/ide/%s/identify"; - FILE *fl; __u16 val[256], ii, jj, kk; __u16 like_std = 1, std = 0, min_std = 0xffff; __u16 dev = NO_DEV, eqpt = NO_DEV; @@ -573,33 +592,12 @@ __u64 bb, bbbig; /* (:) */ int transport; - if (id_supplied) { - memcpy(val, id_supplied, sizeof(val)); - } else { - id_file = calloc(1, strlen(devname)+1+strlen(fmt)); - sprintf(id_file, fmt, devname); + memcpy(val, id_supplied, sizeof(val)); - /* open the file, read in all the info and close it */ - if (id_file == NULL) { - fl = stdin; - } else if(NULL == (fl = fopen(id_file, "r"))) { - perror(id_file); - exit(errno); - } - /* calculate checksum over all bytes */ - for(ii = GEN_CONFIG; ii<=INTEGRITY; ii++) { - unsigned int scratch; - if(1 != fscanf(fl,"%04x",&scratch)) break; - val[ii] = (__u16)scratch; - chksum += val[ii] + (val[ii] >> 8); - } - fclose(fl); - if(ii < (INTEGRITY+1)) { - fprintf(stderr,"Input file wrong format or length\n"); - exit(ii); - } + /* calculate checksum over all bytes */ + for(ii = GEN_CONFIG; ii<=INTEGRITY; ii++) { + chksum += val[ii] + (val[ii] >> 8); } - chksum &= 0xff; /* check if we recognise the device type */ printf("\n"); @@ -1039,6 +1037,8 @@ print_features(val[SATA_CAP_0], val[SATA_CAP_0], cap_sata0_str); if (transport == 1 || (val[SATA_SUPP_0] && val[SATA_SUPP_0] != 0xffff)) print_features(val[SATA_SUPP_0], val[SATA_EN_0], feat_sata0_str); + if (val[SCT_SUPP] & 0x1) + print_features(val[SCT_SUPP], val[SCT_SUPP] & 0x3f, feat_sct_str); } if((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP) printf("\tRemovable Media Status Notification feature set supported\n"); @@ -1106,9 +1106,13 @@ printf("\tMaximum current = %uma\n",val[CFA_PWR_MODE] & MAX_AMPS); } if((val[INTEGRITY] & SIG) == SIG_VAL) { - printf("Checksum: "); - if(chksum) printf("in"); - printf("correct\n"); + printf("Checksum: %scorrect", chksum ? "in" : ""); + if (chksum) + printf(" (0x%02x), expected 0x%02x\n", chksum, 0x100 - chksum); + putchar('\n'); + } else { + printf("\tIntegrity word not set (found 0x%04x, expected 0x%02x%02x)\n", + val[INTEGRITY], 0x100 - chksum, SIG_VAL); } } } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org